顯示頁面舊版反向連結Fold/unfold all回到頁頂 本頁是唯讀的,您可以看到原始碼,但不能更動它。您如果覺得它不應被鎖上,請詢問管理員。 ====== 檢測 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}} tech/sqlmap.txt 上一次變更: 2019/07/12 08:21由 jonathan_tsai