Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS1xNHFxLWpoanYtN3JoMs4AAvaS
MySQL JDBC deserialization vulnerability
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.
@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: < 1.15.2
Patches
The vulnerability has been fixed in v1.15.2.
https://github.com/dataease/dataease/blob/6c3a011955c5c753ffd616d030bea5db4793c51c/backend/src/main/java/io/dataease/dto/datasource/MysqlConfiguration.java#L19
the MysqlConfiguration class use illegalParameters
filter illegal parameters to fix this vulnerability.
@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";
private List<String> 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]
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1xNHFxLWpoanYtN3JoMs4AAvaS
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Critical
Classification: General
Published: over 1 year ago
Updated: over 1 year ago
CVSS Score: 9.8
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Identifiers: GHSA-q4qq-jhjv-7rh2, CVE-2022-39312
References:
- https://github.com/dataease/dataease/security/advisories/GHSA-q4qq-jhjv-7rh2
- https://nvd.nist.gov/vuln/detail/CVE-2022-39312
- https://github.com/dataease/dataease/pull/3328
- https://github.com/dataease/dataease/commit/956ee2d6c9e81349a60aef435efc046888e10a6d
- https://github.com/dataease/dataease/releases/tag/v1.15.2
- https://github.com/advisories/GHSA-q4qq-jhjv-7rh2
Blast Radius: 3.0
Affected Packages
maven:io.dataease:dataease-plugin-common
Dependent packages: 4Dependent repositories: 2
Downloads:
Affected Version Ranges: < 1.15.2
Fixed in: 1.15.2
All affected versions: 1.8.0, 1.9.0, 1.10.0, 1.11.0, 1.11.1, 1.11.3, 1.12.0, 1.13.0, 1.14.0, 1.15.0
All unaffected versions: 1.16.0, 1.17.0, 1.18.0, 1.18.1, 1.18.2, 1.18.3, 1.18.4, 1.18.5, 1.18.6, 1.18.7, 1.18.8, 1.18.9, 1.18.10, 1.18.11, 1.18.12, 1.18.13, 1.18.14, 1.18.15, 1.18.16