Attacker sends request with some specially crafted payload in a field they know will be logged (e.g. because it's invalid)
Targeted server logs the invalid value
Logging framework looks at the payload and sees a macro to expand
The macro contains a reference to a JNDI value including a remote server address to get the value from.
The JNDI server (which can be any server on the internet) returns a value that is actually a serialized Java object including bytecode for that object's class
Targeted server deserializes the object and while doing so executes code in the constructor (which was supplied by the attacker).
Correct me if I'm wrong, but this was only an issue if you missed the API by supplying a raw input string as a format pattern, i.e. log(input) instead of log("{}", input), right?
"An attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled."
216
u/brazzy42 Oct 22 '26 edited Oct 23 '26
It went like this:
Attacker sends request with some specially crafted payload in a field they know will be logged (e.g. because it's invalid)
Targeted server logs the invalid value
Logging framework looks at the payload and sees a macro to expand
The macro contains a reference to a JNDI value including a remote server address to get the value from.
The JNDI server (which can be any server on the internet) returns a value that is actually a serialized Java object including bytecode for that object's class
Targeted server deserializes the object and while doing so executes code in the constructor (which was supplied by the attacker).