Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CWE-502 (可信数据的反序列化) — Vulnerability Class 1687

1687 vulnerabilities classified as CWE-502 (可信数据的反序列化). AI Chinese analysis included.

CWE-502 represents a critical security weakness where applications deserialize untrusted data without validating its integrity or structure. Attackers typically exploit this vulnerability by crafting malicious serialized objects that, when processed by the application, trigger unintended code execution or logic flaws. This often leads to remote code execution, denial of service, or privilege escalation, as the deserialization process may instantiate dangerous classes or invoke unsafe methods. To mitigate this risk, developers must strictly avoid deserializing data from untrusted sources. Instead, they should implement robust input validation, use allowlists for permitted data types, or adopt safer serialization formats like JSON that do not inherently support arbitrary object instantiation. Additionally, employing cryptographic signatures to verify data authenticity before deserialization ensures that only trusted, unaltered payloads are processed, effectively neutralizing the threat of malicious object injection.

MITRE CWE Description
The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.
Common Consequences (3)
IntegrityModify Application Data, Unexpected State
Attackers can modify unexpected objects or data that was assumed to be safe from modification. Deserialized data or code could be modified without using the provided accessor functions, or unexpected functions could be invoked.
AvailabilityDoS: Resource Consumption (CPU)
If a function is making an assumption on when to terminate, based on a sentry in a string, it could easily never terminate.
OtherVaries by Context
The consequences can vary widely, because it depends on which objects or methods are being deserialized, and how they are used. Making an assumption that the code in the deserialized object is valid is dangerous and can enable exploitation. One example is attackers using gadget chains to perform una…
Mitigations (5)
Architecture and Design, ImplementationIf available, use the signing/sealing features of the programming language to assure that deserialized data has not been tainted. For example, a hash-based message authentication code (HMAC) could be used to ensure that data has not been modified.
ImplementationWhen deserializing data, populate a new object rather than just deserializing. The result is that the data flows through safe input validation and that the functions are safe.
ImplementationExplicitly define a final object() to prevent deserialization.
Architecture and Design, ImplementationMake fields transient to protect them from deserialization. An attempt to serialize and then deserialize a class containing transient fields will result in NULLs where the transient data should be. This is an excellent way to prevent time, environment-based, or sensitive variables from being carried over and used improperly.
ImplementationAvoid having unnecessary types or gadgets (a sequence of instances and method invocations that can self-execute during the deserialization process, often found in libraries) available that can be leveraged for malicious ends. This limits the potential for unintended or unauthorized types and gadgets to be leveraged by the attacker. Add only acceptable classes to an allowlist. Note: new gadgets are…
Examples (2)
This code snippet deserializes an object from a file and uses it as a UI button:
try { File file = new File("object.obj"); ObjectInputStream in = new ObjectInputStream(new FileInputStream(file)); javax.swing.JButton button = (javax.swing.JButton) in.readObject(); in.close(); }
Bad · Java
private final void readObject(ObjectInputStream in) throws java.io.IOException { throw new java.io.IOException("Cannot be deserialized"); }
Good · Java
In Python, the Pickle library handles the serialization and deserialization processes. In this example derived from [REF-467], the code receives and parses data, and afterwards tries to authenticate a user based on validating a token.
try { class ExampleProtocol(protocol.Protocol): def dataReceived(self, data): # Code that would be here would parse the incoming data # After receiving headers, call confirmAuth() to authenticate def confirmAuth(self, headers): try: token = cPickle.loads(base64.b64decode(headers['AuthToken'])) if not check_hmac(token['signature'], token['data'], getSecretKey()): raise AuthFail self.secure_data = token['data'] except: raise AuthFail }
Bad · Python
CVE IDTitleCVSSSeverityPublished
CVE-2021-39207 Deserialization of Untrusted Data in parlai — ParlAI 8.4 High2021-09-10
CVE-2021-24040 parlai 代码问题漏洞 — ParlAI 7.2 -2021-09-10
CVE-2021-32568 Deserialization of Untrusted Data in zmister2016/mrdoc — zmister2016/mrdoc 7.8 -2021-09-06
CVE-2021-35218 Chart Endpoint Deserialization of Untrusted Data Remote Code Execution Vulnerability — Patch Manager 8.9 High2021-09-01
CVE-2021-35216 Deserialization of Untrusted Data in Resource Controls Remote Code Execution — Patch Manager 8.9 High2021-09-01
CVE-2021-35215 ActionPluginBaseView Deserialization of Untrusted Data RCE — Orion Platform 8.9 High2021-09-01
CVE-2021-39132 YAML deserialization can run untrusted code — rundeck 8.8 High2021-08-30
CVE-2021-24579 Bold Page Builder < 3.1.6 - PHP Object Injection — Bold Page Builder 8.8 -2021-08-30
CVE-2021-21869 3s-smart Software Solutions CODESYS Development System 代码问题漏洞 — CODESYS 7.8 -2021-08-25
CVE-2021-39150 A Server-Side Forgery Request vulnerability in XStream via PriorityQueue unmarshaling — xstream 8.5 High2021-08-23
CVE-2021-39152 A Server-Side Forgery Request vulnerability in XStream via HashMap unmarshaling — xstream 8.5 High2021-08-23
CVE-2021-39140 XStream can cause a Denial of Service — xstream 6.5 Medium2021-08-23
CVE-2021-39139 XStream is vulnerable to an Arbitrary Code Execution attack — xstream 8.5 High2021-08-23
CVE-2021-21868 3s-smart Software Solutions CODESYS Development System 代码问题漏洞 — CODESYS 7.8 -2021-08-18
CVE-2021-21867 3s-smart Software Solutions CODESYS Development System 代码问题漏洞 — CODESYS 7.8 -2021-08-18
CVE-2021-37678 Arbitrary code execution due to YAML deserialization — tensorflow 9.3 Critical2021-08-12
CVE-2021-37632 Deserialization of Untrusted Data in com.supermartijn642.configlib.ConfigSyncPacket — SuperMartijn642sConfigLib 8.1 High2021-08-05
CVE-2021-21863 3s-smart Software Solutions CODESYS Development System 代码问题漏洞 — CODESYS 7.8 -2021-08-05
CVE-2021-21866 3s-smart Software Solutions CODESYS Development System代码问题漏洞 — CODESYS 7.8 -2021-08-02
CVE-2021-21865 3s-smart Software Solutions CODESYS Development System 代码问题漏洞 — CODESYS 7.8 -2021-08-02
CVE-2021-21864 3s-smart Software Solutions CODESYS Development System 代码问题漏洞 — CODESYS 7.8 -2021-08-02
CVE-2021-37578 Remote code execution via RMI — Apache jUDDI 9.8 -2021-07-29
CVE-2020-5341 Dell EMC Avamar Server 代码问题漏洞 — Avamar Virtual Edition 9.8 Critical2021-07-28
CVE-2021-22777 SoSafe Configurable 代码问题漏洞 — SoSafe Configurable prior to V1.8.1 7.8 -2021-07-21
CVE-2021-32742 Untrusted data fed into `Data.init(base32Encoded:)` can result in exposing server memory and/or crash — vapor 7.5 High2021-07-09
CVE-2021-24384 JoomSport < 5.1.8 - Unauthenticated PHP Object Injection — JoomSport – for Sports: Team & League, Football, Hockey & more 9.8 -2021-07-06
CVE-2021-29485 Remote Code Execution Vulnerability in Session Storage — ratpack 9.9 Critical2021-06-29
CVE-2020-9493 Java deserialization in Chainsaw — Apache Chainsaw 9.8 -2021-06-16
CVE-2021-3040 Bridgecrew Checkov: Unsafe deserialization of Terraform files allows code execution — Bridgecrew Checkov 6.7 Medium2021-06-10
CVE-2021-33176 VerneMQ MQTT Broker 安全漏洞 — vernemq 7.5 -2021-06-08

Vulnerabilities classified as CWE-502 (可信数据的反序列化) represent 1687 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.