CVE-2022-25845: Fastjson Fastjson Vulnerability

HIGH
Advisory Identifier: GHSA-pv7h-hx5h-mgfj
CVSS 8.1
CWE-502
Published
Advisory Summary

CVE-2022-25845 is a HIGH (CVSS 8.1) fastjson vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Fastjson libraries in the Maven ecosystem. The issue involves fastjson. Remediation is available by upgrading affected packages to version 1.2.83.

CVE-2022-25845 at a Glance

CVE Identifier CVE-2022-25845
GHSA Identifier GHSA-pv7h-hx5h-mgfj
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-502: Deserialization of Untrusted Data
Affected Product Fastjson
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 8.1

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

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
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-25845

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

com.alibaba:fastjson fixed: 1.2.83
<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>fastjson</artifactId>
    <version>1.2.83</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=com.alibaba

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=com.alibaba

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

Note: The mvn dependency:tree -Dincludes=com.alibaba 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 Fastjson, 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

The package com.alibaba:fastjson before 1.2.83 is vulnerable to Deserialization of Untrusted Data by bypassing the default autoType shutdown restrictions, which is possible under certain conditions. Exploiting this vulnerability allows attacking remote servers. Workaround: If upgrading is not possible, you can enable [safeMode](https://github.com/alibaba/fastjson/wiki/fastjson_safemode).

CVE-2022-25845 Affected Fastjson Versions

1 component(s)
Fixed Versions:
1.2.83
Product / Package Ecosystem Affected Versions Fixed Version
com.alibaba:fastjson
Maven
≥ 1.2.25
< 1.2.83
1.2.83

References

Frequently Asked Questions

What is CVE-2022-25845?
CVE-2022-25845 is a security vulnerability in Fastjson involving fastjson under CWE-502: Deserialization of Untrusted Data.
Which Fastjson versions are affected?
Affected versions include releases prior to 1.2.83 across affected packages: com.alibaba:fastjson.
What version fixes CVE-2022-25845?
Upgrading to 1.2.83 (or the latest patched release for your respective branch) resolves the vulnerability.
Is fastjson affected?
Yes, com.alibaba:fastjson is affected in releases prior to 1.2.83. Upgrade your dependency to 1.2.83 or later.
What is the CVSS score of CVE-2022-25845?
CVE-2022-25845 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-25845?
CVE-2022-25845 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-25845?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=com.alibaba'. 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-pv7h-hx5h-mgfj",
  "modified" : "2024-05-15T06:28:35Z",
  "published" : "2022-06-11T00:00:17Z",
  "aliases" : [ "CVE-2022-25845" ],
  "summary" : "Unsafe deserialization in com.alibaba:fastjson",
  "details" : "The package com.alibaba:fastjson before 1.2.83 is vulnerable to Deserialization of Untrusted Data by bypassing the default autoType shutdown restrictions, which is possible under certain conditions. Exploiting this vulnerability allows attacking remote servers. Workaround: If upgrading is not possible, you can enable [safeMode](https://github.com/alibaba/fastjson/wiki/fastjson_safemode).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.alibaba:fastjson"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.2.25"
      }, {
        "fixed" : "1.2.83"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-25845"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/alibaba/fastjson/commit/35db4adad70c32089542f23c272def1ad920a60d"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/alibaba/fastjson/commit/8f3410f81cbd437f7c459f8868445d50ad301f15"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/alibaba/fastjson"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/alibaba/fastjson/releases/tag/1.2.83"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/alibaba/fastjson/wiki/security_update_20220523"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JAVA-COMALIBABA-2859222"
  }, {
    "type" : "WEB",
    "url" : "https://www.ddosi.org/fastjson-poc"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-502" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-17T00:58:22Z",
    "nvd_published_at" : "2022-06-10T20:15:00Z"
  }
}