JAVA-027 / Advanced
Java deserialization of untrusted input (ObjectInputStream.readObject)
Why is this a problem?
Gadget chains such as Commons Collections can lead to arbitrary command execution (RCE).
How to fix it
java
// Use a data-only format such as JSON instead of serialization
ObjectMapper om = new ObjectMapper();
Dto dto = om.readValue(request.getInputStream(), Dto.class);
// If unavoidable, allowlist classes using ObjectInputFilter