GitHub Advisoryadvisory · Maven
GHSA-q4qq-jhjv-7rh2 MySQL JDBC deserialization vulnerability
CRITICAL
Official page ↗
- Aliases
- CVE-2022-39312
- Ecosystem
- Maven
- Packages
- io.dataease:dataease-plugin-common
- Severity
- Critical
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Weaknesses
- CWE-20, CWE-502
- Reviewed
- 2022-10-18
Affected packages
• Maven io.dataease:dataease-plugin-common: < 1.15.2 → fixed in 1.15.2
Description
Impact
In Dataease, the Mysql data source in the data source function can customize the JDBC connection parameters and the Mysql server target to be connected.
In `backend/src/main/java/io/dataease/provider/datasource/JdbcProvider.java`, MysqlConfiguration class don't filter any parameters, directly concat user input.
```java
@Getter
@Setter
public class MysqlConfiguration extends JdbcConfiguration {
private String driver = "com.mysql.jdbc.Driver";
private String extraParams = "characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true&zeroDateTimeBehavior=convertToNull";
public String getJdbc() {
if(StringUtils.isEmpty(extraParams.trim())){
return "jdbc:mysql://HOSTNAME:PORT/DATABASE"
.replace("HOSTNAME", getHost().trim())
.replace("PORT", getPort().toString().trim())
.replace("DATABASE", getDataBase().trim());
}else {
return "jdbc:mysql://HOSTNAME:PORT/DATABASE?EXTRA_PARAMS"
.replace("HOSTNAME", getHost().trim())
.replace("PORT", getPort().toString().trim())
.replace("DATABASE", getDataBase().trim())
.replace("EXTRA_PARAMS", getExtraParams().trim());
}
}
}
```
So, if the attack add some parameters in JDBC url, and connect to evil mysql server, he can trigger the mysql jdbc deserialization vulnerability, and eventually the attacker can execute through the deserialization vulnerability system commands and obtain server privileges.
Affected versions: illegalParameters = Arrays.asList("autoDeserialize", "queryInterceptors", "statementInterceptors", "detectCustomCollations");
public String getJdbc() {
if (StringUtils.isEmpty(extraParams.trim())) {
return "jdbc:mysql://HOSTNAME:PORT/DATABASE"
.replace("HOSTNAME", getHost().trim())
.replace("PORT", getPort().toString().trim())
.replace("DATABASE", getDataBase().trim());
} else {
for (String illegalParameter : illegalParameters) {
if (getExtraParams().contains(illegalParameter)) {
throw new RuntimeException("Illegal parameter: " + illegalParameter);
}
}
return "jdbc:mysql://HOSTNAME:PORT/DATABASE?EXTRA_PARAMS"
.replace("HOSTNAME", getHost().trim())
.replace("PORT", getPort().toString().trim())
.replace("DATABASE", getDataBase().trim())
.replace("EXTRA_PARAMS", getExtraParams().trim());
}
}
}
```
Workarounds
It is recommended to upgrade the version to v1.15.2.
For more information
If you have any questions or comments about this advisory:
• Open an issue in https://github.com/dataease/dataease
• Email us at [email protected]
Related
Alias · CVE (1)
- CVE-2022-39312 Dataease is an open source data visualization analysis tool. vulnerability
References
- https://github.com/dataease/dataease/security/advisories/GHSA-q4qq-jhjv-7rh2 web
- https://nvd.nist.gov/vuln/detail/CVE-2022-39312 advisory
- https://github.com/dataease/dataease/pull/3328 web
- https://github.com/dataease/dataease/commit/956ee2d6c9e81349a60aef435efc046888e10a6d web
- https://github.com/dataease/dataease package
- https://github.com/dataease/dataease/releases/tag/v1.15.2 web