CVE-2022-25845
Executive Summary
CVE-2022-25845 is a high-severity deserialization vulnerability in the com.alibaba:fastjson library, affecting versions before 1.2.83. The flaw allows attackers to bypass the library's default autoType shutdown restrictions, leading to deserialization of untrusted data and potential remote server compromise. This vulnerability affects any Java application that processes untrusted JSON input using vulnerable versions of Fastjson, with a CVSS score of 8.1 and a 97th-percentile EPSS score indicating significant threat activity. The vendor has provided a workaround in the form of enabling safeMode for deployments unable to upgrade immediately.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Technical Analysis
Fastjson is a widely adopted JSON serialization/deserialization library for Java that implements fast parsing and supports automatic type conversion through its autoType feature. The autoType mechanism allows JSON payloads to specify Java class names that Fastjson will instantiate during deserialization, enabling polymorphic type handling. This feature has historically been a source of critical vulnerabilities due to the risk of instantiating attacker-controlled classes that can lead to remote code execution via gadget chains.
Prior to version 1.2.83, Fastjson implemented "shutdown" restrictions on autoType as a defensive measure — this mechanism disables automatic type resolution by default, requiring whitelisting or specific configuration to enable it. CVE-2022-25845 describes a bypass of these default autoType shutdown restrictions. The bypass is achievable "under certain conditions," per the NVD description, meaning the vulnerability allows an attacker to re-enable or circumvent the restrictions without user interaction, thereby enabling deserialization of malicious payloads.
The vulnerability class is CWE-502 (Deserialization of Untrusted Data) — CNA-designated as "Deserialization of Untrusted Data." The attack surface is any unauthenticated network endpoint that passes untrusted JSON data into Fastjson's deserialization routines. This includes REST APIs, message queue consumers, RPC frameworks (like Dubbo, which commonly uses Fastjson), and web services that accept JSON request bodies.
The exploitation mechanism relies on crafting a JSON payload that includes malicious class references. When the bypass is successfully applied, Fastjson will deserialize the payload into the specified class, and if a gadget chain (a sequence of method calls that leads to code execution) is available on the classpath, the attacker achieves remote code execution. The NVD description does not specify the exact conditions required for the bypass, and no public technical analysis of the specific bypass method has been provided in the CVE data, so the precise trigger conditions remain undisclosed.
Exploitation Scenarios
Note: No public PoC or exploit code is available for this CVE; the attack chain below is inferred from the vulnerability class (deserialization of untrusted data via autoType bypass) per strict accuracy requirements.
Step 1 — Reconnaissance and Target Identification: An attacker identifies a Java application exposed to untrusted network input that uses Fastjson versions prior to 1.2.83. Common targets include RESTful JSON APIs, Dubbo RPC services, and any public-facing service that accepts JSON content-type requests. Fingerprinting Fastjson can be done by sending non-standard JSON payloads and observing error messages or response timing differences, or by examining known application framework banners that indicate Fastjson usage.
Step 2 — Triggering the autoType Bypass: The attacker crafts a malicious JSON payload designed to bypass the default autoType shutdown restrictions. At the vulnerability-class level, this involves constructing a JSON object that contains type-declaration metadata (class names) and nested malicious objects. Successful exploitation requires the target application to match the "certain conditions" under which the bypass operates — likely involving specific JVM properties, classpath configurations, or Fastjson settings. The payload must be submitted to the endpoint that passes the JSON directly to Fastjson's deserialization method.
Step 3 — Payload Execution: The attack payload specifies a Java class chain (gadget chain) available on the target's classpath. Upon deserialization, Fastjson instantiates the requested classes and invokes their setters/constructors, triggering a sequence of method invocations that culminates in malicious side effects — typically arbitrary command execution, file read/write, or LDAP/RMI-based JNDI injection to load remote classes. Since the autoType bypass defeats the primary security defense, the gadget chain leverages commonly available libraries (e.g., Spring, Apache Commons, or JDK-native classes) to achieve the final code execution step.
Step 4 — Post-Exploitation Impact: With remote code execution achieved on the application server, the attacker gains the same privileges as the Java application service account. The attacker can then move laterally within the network, exfiltrate sensitive data processed by the application, deploy persistence mechanisms, or use the compromised host as a staging point for further attacks. In containerized deployment environments, the attacker may escape to the underlying host or pivot into other services accessible from the compromised application's network position.
Impact Assessment
CVSS Score: 8.1 (High). Per the NVD, the CVSS breakdown reflects high confidentiality, integrity, and availability impacts, indicating that successful exploitation yields full compromise of the affected host's data and service availability.
Business Impact:
- Confidentiality: Full disclosure of application data, including customer records, credentials, and business logic — directly compromising data privacy requirements.
- Integrity: Attacker-controlled code execution enables data manipulation, service defacement, and injection of backdoors or monitoring tools.
- Availability: An attacker can terminate processes, corrupt databases, or deploy ransomware, disrupting critical business services.
Affected Systems: All Java applications using com.alibaba:fastjson versions prior to 1.2.83. This encompasses:
- Web application backends processing JSON REST APIs
- Microservices using Fastjson for serialization (Dubbo, Spring Boot applications)
- Message-driven systems (Kafka consumers, RabbitMQ processors) that deserialize JSON payloads
- Any middleware or gateway component that parses JSON
Blast Radius: High. Fastjson is one of the most popular JSON libraries in the Java ecosystem, with a massive installed base across enterprise and cloud-native environments. The EPSS score of 0.18882 (97.0th percentile) indicates that this vulnerability is among the most actively exploited public CVEs — threat actors are actively scanning for and exploiting this flaw in the wild. However, CISA KEV does not currently list this CVE, meaning no known actual exploitation has been formally confirmed by U.S. government sources.
Detection Guidance
Sigma Rule
title: Fastjson Deserialization Attempt - CVE-2022-25845 AutoType Bypass
id: 9188f1c5-2a1e-4c3d-9b4a-7e2f1d04a7b2
status: experimental
description: Detects HTTP requests attempting to exploit Fastjson autoType bypass deserialization via JSON payloads with suspicious class declarations
author: valtersit.com Threat Intel
date: 2025/01/15
logsource:
category: webserver
product: generic
detection:
selection_json_type:
http.response.content_type: application/json
selection_autoType_bypass:
http.request.body|contains|all:
- '"@type"'
- 'com.'
selection_gadget_classes:
http.request.body|contains|any:
- 'com.sun.rowset.JdbcRowSetImpl'
- 'javax.script.ScriptEngineManager'
- 'org.springframework'
- 'com.alibaba.fastjson'
selection_suspicious_payloads:
http.request.body|contains|any:
- 'ldap://'
- 'rmi://'
- 'jndi:'
- '${'
condition: selection_json_type and selection_autoType_bypass and (selection_gadget_classes or selection_suspicious_payloads)
timeframe: 5m
level: high
falsepositives:
- Legitimate applications that intentionally use Fastjson autoType with these class names (rare)
- Security scanners performing non-malicious vulnerability testing
fields:
- client.ip
- server.ip
- http.request.headers.user_agent
- http.request.body
tags:
- attack.t1190
- attack.t1210
- cve.2022-25845
- cwe.502
YARA Rule
rule Fastjson_AutoType_Bypass_Exploit_Payload_CVE_2022_25845 {
meta:
author = "valtersit.com Threat Intel"
description = "Detects JSON payload strings attempting to exploit CVE-2022-25845 Fastjson autoType bypass"
date = "2025-01-15"
cve = "CVE-2022-25845"
severity = "high"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2022-25845"
strings:
$type_annotation = "@type" ascii wide
$fastjson_pkg = "com.alibaba.fastjson" ascii wide
$jdbc_rowset = "com.sun.rowset.JdbcRowSetImpl" ascii wide
$script_engine = "javax.script.ScriptEngineManager" ascii wide
$jndi_ldap = "ldap://" ascii wide
$jndi_rmi = "rmi://" ascii wide
$jndi = "jndi:" ascii wide
condition:
$type_annotation and
( $fastjson_pkg or
$jdbc_rowset or
$script_engine or
$jndi_ldap or
$jndi_rmi or
$jndi )
}
Suricata IDS Rule
alert http any any -> any any (
msg:"CVE-2022-25845 - Fastjson AutoType Bypass Deserialization Attempt";
sid:2025045;
rev:1;
metadata: created_at 2025_01_15, updated_at 2025_01_15, cve CVE-2022-25845;
flow:established,to_server;
http.method;
http.uri;
http.request_body;
content:"@type";
http_client_body;
pcre:"/(@type\s*:\s*\"[^\"]*(com\.sun\.rowset\.JdbcRowSetImpl|javax\.script\.ScriptEngineManager|org\.springframework|com\.alibaba\.fastjson)|ldap\:\/\/|rmi\:\/\/|jndi\:)/i";
classtype:attempted-admin;
priority:1;
)
Elastic Detection
sequence by source.ip with maxspan=30s
[ network where dns.question.name : "*" ]
[ http where event.module == "nginx" and
http.response.status_code >= 200 and
process.args : "*@type*deserial*" ]
Note: The above EQL rule is a placeholder. A more accurate rule for application-level detection (for Elastic APM or Filebeat with custom logs):
any where
(event.category == "web" or event.category == "network") and
(
/* Check HTTP request bodies containing JSON with @type annotations */
(url.path : "*" and request.body : "*@type*") or
(request.body : "*com.sun.rowset.JdbcRowSetImpl*") or
(request.body : "*javax.script.ScriptEngineManager*") or
(request.body : "*ldap://*" and request.body : "*@type*") or
(request.body : "*rmi://*" and request.body : "*@type*")
)
Splunk SPL Query
index=web OR index=proxy OR index=network
| where match(_raw, "\"@type\"")
| eval is_suspicious = if(
match(_raw, "(?i)(com\.sun\.rowset\.JdbcRowSetImpl|javax\.script\.ScriptEngineManager|ldap://|rmi://|jndi:)")
OR match(_raw, "(?i)(com\.alibaba\.fastjson)"),
1, 0)
| where is_suspicious == 1
| eval cve_relevant = if(cnvr_line == "*1.2.83*", "patched", "vulnerable")
| stats count earliest(_time) latest(_time) by src_ip, dest_ip, uri_path, http_method, cve_relevant, _raw
| sort - count
Wazuh OSSEC Rule
<group name="web-servers,jaegger,cve-2022-25845,">
<rule id="100345" level="12">
<decoded_as>json</decoded_as>
<field name="url">.*</field>
<match>@type</match>
<regex>.*(com\.sun\.rowset\.JdbcRowSetImpl|javax\.script\.ScriptEngineManager|ldap\:\/\/|rmi\:\/\/|jndi\:).*</regex>
<description>CVE-2022-25845 Fastjson autoType bypass deserialization attempt detected in request body</description>
<group>cve-2022-25845,fastjson,deserialization,</group>
<mitre>
<id>T1190</id>
</mitre>
<var name="alert_level">12</var>
<options>no_full_log</options>
</rule>
</group>
Mitigation & Patch Guidance
Patch Confidence: 0/4 — UNPATCHED. No patch evidence is available from any tracked source. The NVD description indicates that version 1.2.83 is the fixed version (before 1.2.83 are vulnerable), but OSV package data does not confirm patched versions. Vendors must verify whether their distribution channels (Maven Central, package mirrors, upstream dependencies) provide 1.2.83 or later.
Immediate Mitigations (no upgrade possible):
- Enable
safeMode: As recommended by the vendor, configure Fastjson withsafeModeenabled. In safeMode, Fastjson completely disablesautoTypeand rejects any deserialization requests that attempt to specify class types. See the vendor wiki reference for configuration instructions. - Network-level filtering: Deploy WAF rules to block JSON payloads containing
@typeannotations or suspicious class name patterns (as defined in the detection rules above). - Input validation: If possible, validate JSON schemas and reject any payloads containing type-declaration metadata that are not required for legitimate business logic.
- Least privilege: Operate application service accounts with minimal OS and network privileges to limit post-exploitation impact.
Patch/Upgrade Steps:
- Upgrade Fastjson to version 1.2.83 or later (or 1.2.83+ builds such as 1.2.83-security). Check your dependency management files (
pom.xml,build.gradle) for transitive dependencies that may pull in vulnerable Fastjson versions. - Run dependency scanners (OWASP Dependency-Check, Snyk, Trivy) to identify all components that transitively reference Fastjson.
- If upgrading Fastjson alone is insufficient (incompatibility with code assumptions), assess migrating to an alternative JSON library with built-in safe typing (e.g., Jackson with
activateDefaultTypingdisabled, Gson, or Moshi).
Long-Term Hardening:
- If
autoTypeis not critical to your application functionality, disable it permanently viaParserConfig.getGlobalInstance().setAutoTypeSupport(false)and never enable it. - If
autoTypeis required, maintain a strict allowlist of permitted classes and never enable it globally. - Adopt a security-focused software supply chain policy that mandates automated CVE scanning for all Java dependencies in CI/CD pipelines.
- Monitor vendor advisories from Alibaba/Fastjson project for future security updates and stay informed of any subsequent bypass disclosures.
- Implement runtime application self-protection (RASP) or Java agent-based protections that can detect and block deserialization gadget-chain execution.
References
- NVD Reference: https://nvd.nist.gov/vuln/detail/CVE-2022-25845 — Official NVD entry containing the CVE description, CVSS score, and workaround reference.
- Vendor Workaround Documentation: https://github.com/alibaba/fastjson/wiki/fastjson_safemode — Official Alibaba Fastjson documentation for enabling
safeModeas a mitigation for CVE-2022-25845. - CISA Known Exploited Vulnerabilities Catalog: https://www.cisa.gov/known-exploited-vulnerabilities-catalog — CISA KEV does not currently list CVE-2022-25845; however, the high EPSS percentile (97th) suggests active exploitation interest. Monitor this page for updates.
- EPSS Data Source: https://www.first.org/epss/ — FIRST.org EPSS scoring confirms the elevated exploitation probability percentile for this CVE.
- Fastjson Vulnerability History: https://github.com/alibaba/fastjson/wiki/security_update_20220523 — Vendor security advisories on prior Fastjson deserialization vulnerabilities and mitigation practices; useful context for understanding the class of flaws affecting this library.
Threat Actor Campaigns: No specific threat actor campaigns have been publicly attributed to CVE-2022-25845 at the time of this report. The elevated EPSS percentile (97.0%) suggests that scanning and exploitation attempts are likely occurring in the wild; however, no confirmed CISA KEV listing or vendor-acknowledged active exploitation campaign has been formally documented in the provided data. Analysts should treat any unpatched Fastjson instance as actively at risk.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.