Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hotfix] Fix arbitrary file readvulnerability on mysql jdbc #166

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.function.Function;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -187,11 +188,15 @@ private Connection getConnection(Map<String, String> requestParams, String datab
String url =
JdbcUtils.replaceDatabase(
requestParams.get(MysqlOptionRule.URL.key()), databaseName);

Properties info = new java.util.Properties();
info.put("autoDeserialize", "false");
info.put("allowLoadLocalInfile", "false");
info.put("allowLoadLocalInfileInPath", "");
if (requestParams.containsKey(MysqlOptionRule.USER.key())) {
String username = requestParams.get(MysqlOptionRule.USER.key());
String password = requestParams.get(MysqlOptionRule.PASSWORD.key());
return DriverManager.getConnection(url, username, password);
info.put("user", requestParams.get(MysqlOptionRule.USER.key()));
info.put("password", requestParams.get(MysqlOptionRule.PASSWORD.key()));
}
return DriverManager.getConnection(url);
return DriverManager.getConnection(url, info);
}
}
1 change: 1 addition & 0 deletions tools/dependencies/known-dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ commons-collections4-4.4.jar
commons-codec-1.13.jar
commons-io-2.11.0.jar
config-1.3.3.jar
db2jcc-db2jcc4.jar
gson-2.8.6.jar
guava-19.0.jar
hibernate-validator-6.2.2.Final.jar
Expand Down
Loading