结构: Simple
Abstraction: Variant
状态: Draft
被利用可能性: High
The code contains a class with sensitive data, but the class does not explicitly deny serialization. The data can be accessed by serializing the class through another class.
Serializable classes are effectively open classes since data cannot be hidden in them. Classes that do not explicitly deny serialization can be serialized by any other class, which can then in turn use the data stored inside it.
cwe_Nature: ChildOf cwe_CWE_ID: 664 cwe_View_ID: 1000 cwe_Ordinal: Primary
cwe_Nature: CanPrecede cwe_CWE_ID: 200 cwe_View_ID: 1000
cwe_Nature: CanPrecede cwe_CWE_ID: 200 cwe_View_ID: 699
Language: {'cwe_Name': 'Java', 'cwe_Prevalence': 'Undetermined'}
范围 | 影响 | 注释 |
---|---|---|
Confidentiality | Read Application Data | an attacker can write out the class to a byte stream, then extract the important data from it. |
策略:
In Java, explicitly define final writeObject() to prevent serialization. This is the recommended solution. Define the writeObject() function to throw an exception explicitly denying serialization.
策略:
Make sure to prevent serialization of your objects.
This code creates a new record for a medical patient:
bad Java
This object does not explicitly deny serialization, allowing an attacker to serialize an instance of this object and gain a patient's name and Social Security number even though those fields are private.
映射的分类名 | ImNode ID | Fit | Mapped Node Name |
---|---|---|---|
CLASP | Information leak through serialization | ||
The CERT Oracle Secure Coding Standard for Java (2011) | SER03-J | Do not serialize unencrypted, sensitive data | |
The CERT Oracle Secure Coding Standard for Java (2011) | SER05-J | Do not serialize instances of inner classes | |
Software Fault Patterns | SFP23 | Exposed Data |