CWE-594: J2EE Framework: Saving Unserializable Objects to Disk
When the J2EE container attempts to write unserializable objects to disk there is no guarantee that the process will complete successfully.
How it's found
J2EE Framework: Saving Unserializable Objects to Disk is a specific, narrowly defined instance of a broader pattern. Testers confirm it with targeted code review and a proof-of-concept input that exercises the exact code path this weakness describes.
In heavy load conditions, most J2EE application frameworks flush objects to disk to manage memory requirements of incoming requests. For example, session scoped objects, and even application scoped objects, are written to disk when required. While these application frameworks do the real work of writing objects to disk, they do not enforce that those objects be serializable, thus leaving the web application vulnerable to crashes induced by serialization failure. An attacker may be able to mount a denial of service attack by sending enough requests to the server to force the web application to save objects to disk.
Vulnerable vs. safe
private String id;private String firstName;private String lastName;private Address address;public Customer() {}public Customer(String id, String firstName, String lastName) {...}@Idpublic String getCustomerId() {...}public void setCustomerId(String id) {...}public String getFirstName() {...}public void setFirstName(String firstName) {...}public String getLastName() {...}public void setLastName(String lastName) {...}@OneToOne()public Address getAddress() {...}public void setAddress(Address address) {...}@Entitypublic class Customer {}public class Customer implements Serializable {...}Consequences
- Modify Application Data: Data represented by unserializable objects can be corrupted.
- DoS: Crash, Exit, or Restart: Non-serializability of objects can lead to system crash.
Mitigations
- Architecture and Design/Implementation: All objects that become part of session and application scope must implement the java.io.Serializable interface to ensure serializability of containing objects.
Where this fits in a TurboPentest engagement
This weakness is not covered by the automated black-box pentest. IntegSec pentesters cover it in a manual engagement.
Frequently asked questions
What is CWE-594?
When the J2EE container attempts to write unserializable objects to disk there is no guarantee that the process will complete successfully.
How do you find J2EE Framework: Saving Unserializable Objects to Disk?
J2EE Framework: Saving Unserializable Objects to Disk is a specific, narrowly defined instance of a broader pattern. Testers confirm it with targeted code review and a proof-of-concept input that exercises the exact code path this weakness describes.
What is the impact of CWE-594?
Modify Application Data: Data represented by unserializable objects can be corrupted. DoS: Crash, Exit, or Restart: Non-serializability of objects can lead to system crash.
Does TurboPentest test for J2EE Framework: Saving Unserializable Objects to Disk?
This weakness is not covered by the automated black-box pentest. IntegSec pentesters cover it in a manual engagement.
Related CWEs
Written and reviewed by
Michel Chamberland - Founder & CEO, IntegSec
CISSP, OSCP, OSCE, CEH, GIAC, CCSK · 20+ years in offensive security
Michel has spent 20+ years on offensive security teams including IBM X-Force Red and Trustwave SpiderLabs, leading penetration tests, red team engagements, and breach response for Fortune 500 customers. He is the founder of IntegSec and the architect of TurboPentest.
Find these issues before an attacker does
TurboPentest runs an agentic AI pentest against your target and reports findings with proof, from $99 per target.
Start a pentest