Summary
A Java deserialization flaw in the RemoteQueryCachePlugin of the AWS Advanced JDBC Wrapper allows untrusted serialized objects from a shared cache to be processed without class filtering.
If an attacker can write crafted entries to the shared Redis or Valkey cache, they might execute arbitrary code on application servers that read and deserialize cached query results.
Affected context
This vulnerability appears in Java applications using the AWS Advanced JDBC Wrapper RemoteQueryCachePlugin with a shared cache backend such as Redis or Valkey.
It becomes relevant when application servers deserialize cached query results originating from infrastructure that may be writable by other services, tenants, or users.
Environments where cache isolation is weak or where cache poisoning is possible are particularly exposed, especially if multiple applications or trust domains share the same cache.
Exploit preconditions
- Attack surface: Application servers running Java and using AWS Advanced JDBC Wrapper with RemoteQueryCachePlugin enabled.
- Required access: Ability to write or modify serialized cache entries in the shared Redis or Valkey infrastructure (e.g., via another service, tenant, or misconfigured credentials).
- Trigger point: Application server reads a poisoned cache entry and invokes ObjectInputStream on the attacker-controlled serialized data.
- Why exploitation is possible: The plugin uses ObjectInputStream without class filtering or type constraints, so arbitrary gadget classes already on the classpath may be instantiated and executed during deserialization.
Why this happens
The core issue is the deserialization of untrusted data using Java's ObjectInputStream without applying any form of class filtering or type restriction.
This aligns with CWE-502: Deserialization of Untrusted Data, where attacker-controlled serialized objects are treated as trusted and rehydrated into live objects.
Because ObjectInputStream can trigger method invocations and initialization logic during object reconstruction, an attacker who can inject or modify serialized data in the cache can leverage existing gadget chains in the application's classpath to achieve arbitrary code execution.
The vulnerable pattern is the use of generic, unrestricted Java deserialization on data that originates from a shared, potentially multi-tenant cache rather than a strictly controlled, authenticated channel.
Potential impact
- Attackers may execute arbitrary code in the context of the vulnerable application server.
- Compromise of sensitive data handled by the affected JVM process, including database credentials or business data.
- Lateral movement within the application environment or broader infrastructure using the compromised server as a foothold.
- Tampering with query results or application behavior by manipulating cached responses.
- Denial of service via crafted payloads that crash the JVM or exhaust server resources during deserialization.
General mitigation guidance
Effective mitigation focuses on eliminating unsafe deserialization and reducing trust in shared cache data:
- Replace native Java serialization with safer, data-only serialization formats (e.g., JSON, protocol buffers) that do not execute code during parsing.
- Introduce strict class filtering or whitelisting for any remaining deserialization logic, ensuring only a narrow set of benign, value-type classes can be reconstructed.
- Treat cache data as untrusted input: apply validation, integrity checks, and schema enforcement before use.
- Isolate shared cache infrastructure by tenant, application, or trust boundary to prevent untrusted writers from influencing cached objects read by sensitive services.
- Run application servers with least-privilege OS and network permissions so that, even if deserialization is abused, the blast radius of code execution is constrained.
How teams detect issues like this
Organizations can look for this class of issue through a combination of code-centric and infrastructure-centric approaches:
- Static analysis rules that flag uses of ObjectInputStream, readObject, or similar APIs on data originating from external stores like Redis or message queues, especially when no ObjectInputFilter or allowlist is present.
- Code reviews focused on caching and messaging layers, highlighting any use of Java serialization across process or trust boundaries.
- Runtime application security monitoring that detects anomalous deserialization behavior, unexpected gadget class loading, or unusual reflective calls during cache access.
- Infrastructure-level monitoring of shared cache instances for unexpected writers, unusual key patterns, or serialized payloads where only primitive or structured data was expected.
- Policy enforcement in CI/CD pipelines that disallows new usages of native Java serialization for cross-component communication without explicit security review.

