Scrivio Interview library
LeadershipPrincipal6 min read · updated 12 November 2026

Java serialization based remoting (RMI, HttpInvoker, Hessian) caused several of the industry's worst Java vulnerabilities. What lessons does this give for choosing integration technologies, and how would you find and retire such endpoints across a large company?

The lesson is that protocols which deserialize arbitrary object graphs from untrusted input are dangerous by design, so we should prefer formats with explicit schemas and types, such as JSON mapped to DTOs or Protobuf, and avoid integration styles that hide the network behind local-looking calls. To retire existing endpoints, I would find them through dependency scans, network scans for RMI ports and code searches for ObjectInputStream, apply serialization filters as a stopgap, run a funded programme with an owner and deadline per endpoint and security-approved exceptions, and stop new uses with build rules and architecture review.

Background to this question

Some of the most damaging Java vulnerabilities of the last decade came not from a single bug but from a whole family of technologies that trusted bytes from the network to decide which objects to build. Senior engineers are asked about this because the same pattern keeps returning in new forms, and because cleaning it up across a large company is a leadership problem as much as a technical one. In this answer, we will look at what went wrong, the design lessons it teaches, how to find such endpoints across an estate, how to retire them with a real programme, and how to stop them from coming back.

1What Went Wrong With Serialization Remoting

Java serialization turns an object graph into bytes and back. On the way back, the bytes name the classes to create and supply their fields, and some classes run logic during that process. In 2015, public research showed that chains of ordinary library classes, called gadget chains, could be combined so that deserializing a crafted payload runs any command. Apache Commons Collections was the famous example, but chains were later found in many popular libraries.

Every endpoint that deserialized untrusted input became a remote code execution hole: RMI registries, JMX ports, Spring's HttpInvoker, application servers' internal protocols, and custom socket listeners. Hessian and some other binary formats that also instantiate arbitrary classes had similar issues. Patching one gadget did not help much, because attackers simply found another; the only real fix was to stop deserializing untrusted object graphs.

2Lesson 1: Formats Should Carry Data, Not Choose Types

The first lesson is about the shape of the format. Safe integration formats carry data, and the receiver decides which types to build from it. JSON mapped onto a DTO class works this way: the payload can only fill the fields our class declares. Protobuf goes further with a schema compiled into both sides. Formats that let the sender name the classes, which includes Java serialization and polymorphic JSON with type information enabled for arbitrary classes, put that choice in the attacker's hands.

So when we choose an integration technology, one question goes on the checklist: can the sender cause the receiver to instantiate a class of the sender's choosing? If yes, we need a strong reason and strict allowlists, or we choose something else.

Integration formats by how much the sender controls
FormatWho chooses the typesRisk with untrusted input
Java serialization (RMI, HttpInvoker)the sender, any class on the classpathhigh: gadget chains
Hessian and similar binary object formatslargely the senderhigh: similar chains found
JSON with default typing on arbitrary classesthe sender, via type idshigh if not restricted
JSON mapped to DTOsthe receiver's declared classeslow
Protobuf or Avro with a schemathe shared schemalow

3Lesson 2: Do Not Hide the Network

The second lesson is about convenience. RMI, Hessian and HttpInvoker made a remote call look exactly like a local method call. That felt productive, but it hid the facts of distributed systems: calls can be slow, fail halfway or time out, and the two sides are deployed separately. Teams shared entity classes between client and server, so every change needed a coordinated release, and few code paths had timeouts, retries or clear error handling.

A senior engineer generalises this: an abstraction that hides an important cost or risk eventually charges for it. Good integration APIs make the boundary visible, with explicit contracts, versioning, timeouts and failure handling, even if that is a little more code.

4Finding Endpoints Across a Large Company

In a company with hundreds of services, nobody knows where all the serialization endpoints are, so we search in several ways at once. Dependency scanning over every repository and artifact finds Spring remoting classes, Hessian jars and old gadget libraries. Code search finds ObjectInputStream and readObject calls, XMLDecoder, and serialization-based frameworks. Network scanning finds open RMI registry ports such as 1099, JMX ports and unusual listeners. Traffic analysis at gateways finds HTTP requests with the application/x-java-serialized-object content type that HttpInvoker used.

Step throughRetiring one serialization endpoint
  1. Found by scandependency, code, network or traffic
  2. Assign an ownerteam and engineering manager
  3. Reachable from untrusted networks?
    YesFilter and restrict now, deadline 30 daysNoFilter, deadline 90 days
  4. Migrate to JSON DTOs or Protobufkeep the same operations
  5. Exception needed?
    YesSecurity approves, with an expiry dateNoRemove the endpoint
  6. Verify with a rescanand close the item

6 steps in order. Play them, or step through them one at a time.

While the clean-up runs, serialization filters reduce the risk. The JDK supports a process-wide filter through the jdk.serialFilter system property, and since Java 17 a filter factory for context-specific filters. An allowlist such as com.example.dto.*;java.util.*;!* rejects every class not explicitly allowed, which blocks most known gadget chains. It is a stopgap, not a fix, because a wrong allowlist breaks the application or still lets something dangerous through.

5Retiring Them With a Real Programme

Finding endpoints is easy compared with removing them, because each one belongs to a team with other priorities. That is why this needs a funded programme, not an email. Leadership agrees that the work has a budget and a priority, a small central team provides migration guides, shared libraries and help, and every endpoint gets an owning team and a deadline based on its exposure.

Some endpoints cannot be removed on time, perhaps because a vendor product depends on them. Those get exceptions, approved by security, with compensating controls such as network isolation and strict filters, and an expiry date so that the exception is reviewed rather than forgotten. Progress is reported regularly to engineering leadership as a simple count of open, filtered and removed endpoints.

6Preventing New Uses

Finally, we close the door behind us. Build rules, for example dependency bans in Maven Enforcer or Gradle and static analysis rules, fail the build when a project adds a remoting library or uses ObjectInputStream on network input without an approved exception. Architecture review checklists ask the type-selection question from Lesson 1 for every new integration. And a short internal guide explains the approved integration styles, REST with DTOs, gRPC and messaging with schemas, so the safe choice is also the obvious one.

7Follow-up questions

Does this lesson apply beyond Java?

Yes. Python's pickle, PHP's unserialize, .NET's BinaryFormatter and YAML loaders that construct arbitrary objects have all caused similar vulnerabilities. Any format that lets the sender choose which types the receiver builds carries the same risk.

Is a serialization filter enough on its own?

No. It narrows the attack surface, but allowlists drift as code changes, a mistake re-opens the hole, and the coupling and operability problems remain. Filters buy time to migrate; they do not replace migration.

How do you get product teams to prioritise this?

Make the risk concrete and the work small. Show which of their endpoints are reachable and what an exploit would allow, provide a ready migration path and help from the central team, and have leadership set the priority so teams are not asked to choose between security and their roadmap on their own.

8Conclusion

In this answer, we saw that serialization-based remoting caused severe vulnerabilities because deserializing object graphs lets the sender choose the classes the receiver builds, so we should prefer explicit schemas such as JSON with DTOs or Protobuf, and avoid technologies that make network calls look local. To clean up a large company, we find endpoints with dependency, code, network and traffic scans, apply jdk.serialFilter allowlists as a stopgap, retire endpoints through a funded programme with owners, deadlines and security-approved exceptions, and prevent new uses with build rules and architecture review.

What to say in the interviewAbout 90 seconds aloud

Open with

I take two lessons from it. The first is that any protocol that deserializes arbitrary object graphs from untrusted input is dangerous by design. The bytes choose which classes get built, and gadget chains in common libraries turned that into remote code execution, again and again, because patching one gadget just moved attackers to the next.

Then, if they want more

So I prefer formats where the receiver decides the types: JSON mapped onto DTOs, or Protobuf with a schema. The second lesson is that convenience that hides the network, where a remote call looks like a local method, leads to shared entity classes, coordinated releases and missing timeouts and error handling.

To retire these endpoints across a large company, I would first find them: dependency scans for Spring remoting and Hessian jars, code search for ObjectInputStream, network scans for RMI registry and JMX ports, and gateway traffic with the Java serialized object content type. As a stopgap I would apply jdk.serialFilter allowlists.

Then I would run it as a funded programme with an owner and a deadline per endpoint based on exposure, migration help from a central team, and exceptions only when security approves them with an expiry date.

Finally I would prevent new uses with dependency bans and static analysis in the build, and a question about type selection in architecture review.

About this answer

Last updated
12 November 2026
Versions it names
Java 17
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Java serialization based remoting (RMI, HttpInvoker, Hessian) caused several of the...": https://scrivio-interview-library.netlify.app/spring-boot/web-other/4b5298cce3/