差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

兩邊的前次修訂版 前次修改
下次修改
前次修改
tech:sqlmap [2018/04/10 18:38] – [基本檢測語法] Jonathan Tsaitech:sqlmap [2019/07/12 16:21] (目前版本) jonathan_tsai
行 1: 行 1:
 +====== 檢測 SQL Injection 的工具 - SQLMap ======
 +  * 最近剛好有網站被 [[https://hitcon.org|HITCON]] 通報, 發現提報的使用工具就是 SQLMap, 因此修改後也去了解與使用 SQLMap  自行檢測一下
 +
 +  * SQLMap 檢測運行環境 :
 +    * CentOS 6.9 x86_64 / CentOS Linux release 7.6.1810 (Core)
 +    * python-2.6.6-66 / python-2.7.5-80
 +
 +===== 安裝程序 =====
 +  * 只要下載解壓縮就可執行<code sh>
 +wget https://github.com/sqlmapproject/sqlmap/tarball/master
 +mv master master.tar.gz
 +tar -zxvf master.tar.gz
 +cd sqlmapproject-sqlmap-*
 +</code>
 +
 +===== 基本檢測語法 =====
 +  * 要檢測的網址 - http://192.168.1.101/myapp/index.php?id=1
 +  * SQLMap 執行語法 <code sh>
 +python sqlmap.py -u "http://192.168.1.101/myapp/index.php?id=1" --batch --banner --level=5 --risk=3
 +</code> or <code sh>
 +python sqlmap.py --url="http://192.168.1.101/myapp/index.php?id=1" --user-agent=SQLMAP --delay=1 --timeout=15 --retries=2 --keep-alive --threads=5 --eta --batch --dbms=MySQL --os=Linux --level=5 --risk=3 --banner --is-dba --dbs --tables --technique=BEUST -s /tmp/scan_report_myapp_1.txt --flush-session -t /tmp/scan_trace_myapp_1.txt --fresh-queries > /tmp/scan_out_myapp_1.txt &
 +</code>
 +  * 如果有 SQL Injection 會出現類似以下的訊息<file>
 +        ___
 +       __H__
 + ___ ___[.]_____ ___ ___  {1.2.4.3#dev}
 +|_ -| . ['    | .'| . |
 +|___|_  [)]_|_|_|__, _|
 +      |_|V          |_|   http://sqlmap.org
 +
 +:
 +:
 +[22:01:46] [INFO] heuristic (basic) test shows that GET parameter 'id' might be injectable (possible DBMS: 'MySQL')
 +[22:01:47] [INFO] heuristic (XSS) test shows that GET parameter 'id' might be vulnerable to cross-site scripting (XSS) attacks
 +:
 +[22:01:47] [WARNING] reflective value(s) found and filtering out
 +:
 +[22:07:23] [INFO] the back-end DBMS is MySQL
 +[22:07:23] [INFO] fetching banner
 +[22:07:24] [INFO] retrieved: 5.6.39-83.1-56
 +web server operating system: Linux CentOS 5.10
 +web application technology: PHP 5.2.10, Apache 2.2.3
 +back-end DBMS: MySQL >= 5.0
 +banner:    '5.6.39-83.1-56'
 +</file> 可以獲取後端 DB 的資訊
 +  * 如果沒有問題, 在每段檢測後都會出現以下訊息 <file>
 +        ___
 +       __H__
 + ___ ___[,]_____ ___ ___  {1.2.4.3#dev}
 +|_ -| . [.]     | .'| . |
 +|___|_  [(]_|_|_|__, _|
 +      |_|V          |_|   http://sqlmap.org
 +:
 +:
 +[22:09:35] [WARNING] heuristic (basic) test shows that GET parameter 'id' might not be injectable
 +:
 +[22:24:57] [WARNING] GET parameter 'id' does not seem to be injectable
 +:
 +:
 +</file>
 +
 +
 +===== 參考網址 =====
 +  * https://github.com/sqlmapproject/sqlmap/wiki/Usage
 +
 +{{tag>類型:資安 狀態:已發行 SQL}}