Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
1.0.7
-
windows,
Tomcat server
Description
http://cwe.mitre.org/data/definitions/502.html
Description Summary
The application deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
Extended Description
It is often convenient to serialize objects for communication or to save them for later use. However, deserialized data or code can often be modified without using the provided accessor functions if it does not use cryptography to protect itself. Furthermore, any cryptography would still be client-side security – which is a dangerous security assumption.
Data that is untrusted can not be trusted to be well-formed.
Potential Mitigations
Phases: Architecture and Design; Implementation
If 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.
Phase: Implementation
When 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.
Phase: Implementation
Explicitly define final readObject() to prevent deserialization. An example of this is:
(Good Code)
Example Language: Java
private final void readObject(ObjectInputStream in) throws java.io.IOException
Phases: Architecture and Design; Implementation
Make 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.
Occurrences:
SocketNode.java: 64