CVE-2022-39312: Dataease plugin common MySQL JDBC Deserialization Vulnerability Vulnerability

CRITICAL
Advisory Identifier: GHSA-q4qq-jhjv-7rh2
CVSS 9.8
CWE-502 CWE-20
Published
Advisory Summary

CVE-2022-39312 is a CRITICAL (CVSS 9.8) mysql jdbc deserialization vulnerability vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Dataease plugin common libraries in the Maven ecosystem. The issue involves mysql jdbc deserialization vulnerability. Remediation is available by upgrading affected packages to version 1.15.2.

CVE-2022-39312 at a Glance

CVE Identifier CVE-2022-39312
GHSA Identifier GHSA-q4qq-jhjv-7rh2
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-502: Deserialization of Untrusted Data
Affected Product Dataease plugin common
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 9.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2022-39312

To remediate this vulnerability, upgrade all affected Dataease plugin common dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

io.dataease:dataease-plugin-common fixed: 1.15.2
<dependency>
    <groupId>io.dataease</groupId>
    <artifactId>dataease-plugin-common</artifactId>
    <version>1.15.2</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=io.dataease

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2022-39312, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=io.dataease

Analyze the terminal output to locate any version of Dataease plugin common in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.15.2), your application is affected.

Note: The mvn dependency:tree -Dincludes=io.dataease command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-502: Deserialization of Untrusted Data, where the product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid. In Dataease plugin common, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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. ![6fc8d5c539807157ee471464b184ab66](https://user-images.githubusercontent.com/13026505/195741851-19f32efb-4391-428a-949f-3d11849f417a.png) 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: < 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](https://github.com/dataease/dataease) * Email us at [wei@fit2cloud.com](mailto:wei@fit2cloud.com)

CVE-2022-39312 Affected Dataease plugin common Versions

1 component(s)
Fixed Versions:
1.15.2
Product / Package Ecosystem Affected Versions Fixed Version
io.dataease:dataease-plugin-common
Maven
< 1.15.2
1.15.2

References

Frequently Asked Questions

What is CVE-2022-39312?
CVE-2022-39312 is a security vulnerability in Dataease plugin common involving MySQL JDBC deserialization vulnerability under CWE-502: Deserialization of Untrusted Data.
Which Dataease plugin common versions are affected?
Affected versions include releases prior to 1.15.2 across affected packages: io.dataease:dataease-plugin-common.
What version fixes CVE-2022-39312?
Upgrading to 1.15.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is dataease-plugin-common affected?
Yes, io.dataease:dataease-plugin-common is affected in releases prior to 1.15.2. Upgrade your dependency to 1.15.2 or later.
What is the CVSS score of CVE-2022-39312?
CVE-2022-39312 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-39312?
CVE-2022-39312 is classified under CWE-502: Deserialization of Untrusted Data (The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.).
How can I check Maven dependencies for CVE-2022-39312?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=io.dataease'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-q4qq-jhjv-7rh2",
  "modified" : "2022-10-25T20:31:45Z",
  "published" : "2022-10-18T18:05:36Z",
  "aliases" : [ "CVE-2022-39312" ],
  "summary" : "MySQL JDBC deserialization vulnerability",
  "details" : "### Impact\n\nIn Dataease, the Mysql data source in the data source function can customize the JDBC connection parameters and the Mysql server target to be connected.\n![6fc8d5c539807157ee471464b184ab66](https://user-images.githubusercontent.com/13026505/195741851-19f32efb-4391-428a-949f-3d11849f417a.png)\n\nIn `backend/src/main/java/io/dataease/provider/datasource/JdbcProvider.java`, MysqlConfiguration class don't filter any parameters, directly concat user input.\n```java\n@Getter\n@Setter\npublic class MysqlConfiguration extends JdbcConfiguration {\n\n    private String driver = \"com.mysql.jdbc.Driver\";\n    private String extraParams = \"characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true&zeroDateTimeBehavior=convertToNull\";\n\n    public String getJdbc() {\n        if(StringUtils.isEmpty(extraParams.trim())){\n            return \"jdbc:mysql://HOSTNAME:PORT/DATABASE\"\n                    .replace(\"HOSTNAME\", getHost().trim())\n                    .replace(\"PORT\", getPort().toString().trim())\n                    .replace(\"DATABASE\", getDataBase().trim());\n        }else {\n            return \"jdbc:mysql://HOSTNAME:PORT/DATABASE?EXTRA_PARAMS\"\n                    .replace(\"HOSTNAME\", getHost().trim())\n                    .replace(\"PORT\", getPort().toString().trim())\n                    .replace(\"DATABASE\", getDataBase().trim())\n                    .replace(\"EXTRA_PARAMS\", getExtraParams().trim());\n        }\n    }\n}\n```\nSo, 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.\n\nAffected versions: < 1.15.2\n\n### Patches\n\nThe vulnerability has been fixed in v1.15.2.\nhttps://github.com/dataease/dataease/blob/6c3a011955c5c753ffd616d030bea5db4793c51c/backend/src/main/java/io/dataease/dto/datasource/MysqlConfiguration.java#L19\nthe MysqlConfiguration class use `illegalParameters` filter illegal parameters to fix this vulnerability.\n```\n@Getter\n@Setter\npublic class MysqlConfiguration extends JdbcConfiguration {\n\n    private String driver = \"com.mysql.jdbc.Driver\";\n    private String extraParams = \"characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true&zeroDateTimeBehavior=convertToNull\";\n    private List<String> illegalParameters = Arrays.asList(\"autoDeserialize\", \"queryInterceptors\", \"statementInterceptors\", \"detectCustomCollations\");\n\n    public String getJdbc() {\n        if (StringUtils.isEmpty(extraParams.trim())) {\n            return \"jdbc:mysql://HOSTNAME:PORT/DATABASE\"\n                    .replace(\"HOSTNAME\", getHost().trim())\n                    .replace(\"PORT\", getPort().toString().trim())\n                    .replace(\"DATABASE\", getDataBase().trim());\n        } else {\n            for (String illegalParameter : illegalParameters) {\n                if (getExtraParams().contains(illegalParameter)) {\n                    throw new RuntimeException(\"Illegal parameter: \" + illegalParameter);\n                }\n            }\n\n            return \"jdbc:mysql://HOSTNAME:PORT/DATABASE?EXTRA_PARAMS\"\n                    .replace(\"HOSTNAME\", getHost().trim())\n                    .replace(\"PORT\", getPort().toString().trim())\n                    .replace(\"DATABASE\", getDataBase().trim())\n                    .replace(\"EXTRA_PARAMS\", getExtraParams().trim());\n        }\n    }\n}\n```\n\n### Workarounds\n\nIt is recommended to upgrade the version to v1.15.2.\n\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [https://github.com/dataease/dataease](https://github.com/dataease/dataease)\n* Email us at [wei@fit2cloud.com](mailto:wei@fit2cloud.com)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "io.dataease:dataease-plugin-common"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.15.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/dataease/dataease/security/advisories/GHSA-q4qq-jhjv-7rh2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-39312"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dataease/dataease/pull/3328"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dataease/dataease/commit/956ee2d6c9e81349a60aef435efc046888e10a6d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/dataease/dataease"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dataease/dataease/releases/tag/v1.15.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-502" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-10-18T18:05:36Z",
    "nvd_published_at" : "2022-10-25T17:15:00Z"
  }
}