...
Deviating from the proper signatures of serialization methods can lead to unexpected behavior. Failure to limit the accessibility of the readObject()
and writeObject()
methods can leave code vulnerable to untrusted invocations. Declaring readResolve()
and writeReplace()
methods to be static or private can force subclasses to silently ignore them, while declaring them public allows them to be invoked by untrusted code.
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
SER01-J | High | Likely | Low | P27 | L1 |
Automated Detection
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
CodeSonar |
| JAVA.CLASS.SER.ND | Serialization Not Disabled (Java) | ||||||
Coverity | 7.5 | UNSAFE_DESERIALIZATION | Implemented | ||||||
Parasoft Jtest |
| CERT.SER01.ROWO | Ensure that the 'readObject()' and 'writeObject()' methods have the correct signature | |||||||
PVS-Studio |
| V6075 | |||||||
SonarQube |
|
|
| S2061 |
Custom serialization method signatures should meet requirements |
Related Guidelines
Bibliography
...
...