Skip to content
NewCybercrime Report 2026 · Eight Chapters · A Post Is Not An Incident → Explore The ChaptersCybercrime Report 2026 → Explore

Odin Research / What is / Techniques and vulnerabilities

What Is JNDI Injection? How the Java Lookup Attack Works

The Java weakness behind Log4Shell: how a single lookup string can make a server fetch an attacker's object, and how to cut the callback.

By
Odin by Brandefense
Updated
21 Nov 2026
Reading time
7 min read
Type
Attack technique

In short

JNDI injection is an attack on Java applications that pass untrusted input to a Java Naming and Directory Interface (JNDI) lookup. The attacker supplies an address for an LDAP, RMI or other directory server they control. The application connects, receives a reference or serialized object and may run attacker code. Log4Shell is the best-known example.

Key takeaways

What it is
A Java vulnerability class where untrusted data reaches a JNDI lookup, so the application asks an attacker's naming or directory server for an object.
How it works
The attacker's LDAP or RMI server answers with a remote reference or a serialized payload. If the client trusts it, the app loads a class or decodes the payload and runs it.
Why it matters
It powered Log4Shell, CVE-2021-44228, rated CVSS 10.0. Exploit servers that automate JNDI, LDAP and RMI callbacks are still easy to find online.
What Odin Research saw
Archived Log4Shell probes in one toolkit, a rogue JNDI LDAP server on another host, and 42 JavaChains weaponizer endpoints with built-in JNDI, LDAP and RMI listeners.
What to do first
Patch Log4j and other libraries, block outbound LDAP, RMI and DNS from application servers, and enable Java deserialization filters.

What is JNDI injection?

JNDI injection is an attack on Java applications that pass untrusted input to a Java Naming and Directory Interface lookup. The attacker supplies the address of an LDAP, RMI or other directory server they control. The application connects, receives a reference or serialized object and may end up running the attacker's code.

Oracle defines JNDI as an API that provides naming and directory functionality to Java applications, independent of any specific directory service. The JDK ships service providers for LDAP, the RMI registry, DNS and the CORBA naming service.

Researchers Alvaro Muñoz and Oleksandr Mirosh, then at HPE Fortify, laid out the attack class at Black Hat USA 2016. Their rule is short: applications should not perform JNDI lookups with untrusted data. Five years later, Log4Shell showed what happens when a widely used library does exactly that.

How JNDI injection works

The Black Hat paper describes a five-step attack process:

  1. The attacker binds a payload in a naming or directory service they control.
  2. The attacker injects an absolute URL into a vulnerable JNDI lookup.
  3. The application performs the lookup.
  4. The application connects to the attacker's service, which returns the payload.
  5. The application decodes the response and triggers the payload.

Two kinds of answers make this dangerous:

  • Naming references. JNDI can return a reference that names a remote factory class and a codebase, which is the location of that class file. If remote class loading is allowed, the application downloads and instantiates the class.
  • Serialized objects. An LDAP entry can carry a Java serialized object. If the application deserializes it and a usable gadget chain is on the classpath, the object can run code without any remote class download.

Java has narrowed the first path over time. The Black Hat paper notes that RMI remote codebases are off by default since JDK 7u21, and that LDAP remote codebases need a property that defaults to false. The second path, serialized payloads, still works against applications with risky libraries on the classpath. That is why exploit kits now favor it.

JNDI injection and Log4Shell

NVD describes CVE-2021-44228 as a flaw in Apache Log4j2 from 2.0-beta9 through 2.15.0, excluding certain security releases. JNDI features in configuration, log messages and parameters did not protect against attacker-controlled LDAP and other JNDI endpoints. An attacker who controls a log message can run arbitrary code when message lookup substitution is enabled.

  • NVD rates it CVSS 3.1 10.0, Critical. It was published on 10 December 2021, and CISA added it to the Known Exploited Vulnerabilities catalog the same day.
  • Log4j 2.15.0 disabled the behavior by default, and 2.16.0 removed it.
  • CISA and partner agencies listed two follow-on flaws, CVE-2021-45046 (CVSS 9.0) and CVE-2021-45105 (CVSS 5.9). They told organizations to move to Log4j 2.17.0 or later for Java 8.

MITRE's CWE-917, improper neutralization of expression language statements, lists Log4Shell as an observed example. The bug fits both worlds: an expression in a log line triggers a JNDI lookup. It is a classic case of Exploit Public-Facing Application.

How attackers use JNDI injection

Attackers rarely type lookups by hand. They use two kinds of infrastructure:

  • Blind probes and callbacks. Scanners spray lookup strings into headers, form fields and API bodies. A vulnerable server reveals itself by calling back to an out-of-band listener. See our page on out-of-band application security testing (OAST).
  • Weaponizers. Integrated tools run LDAP, RMI, HTTP and rogue database listeners at once. A vulnerable target then pulls a second-stage Java class or serialized object. JavaChains is one example.

After a successful lookup, the payload usually opens a shell or drops a web shell, and the attacker moves on from there.

What Odin Research observed

JNDI tooling appears in four Odin Research studies:

  • Archived Log4Shell probes. In Monograph 01, a staging toolkit kept two Log4Shell probes in a folder literally named "failed attempts". One sent JNDI strings, including one in a POST XML username field, and pointed the callback at a commercial out-of-band testing domain. The operator gave up on this path.
  • A rogue JNDI LDAP server. In Monograph 09, one exposed host staged a rogue LDAP server on port 1389. It answered searches with a serialized Java payload, which sidesteps the remote codebase limit in JDK 8u191 and later. The server's own log recorded repeated inbound LDAP connections. The same host staged rogue MySQL servers and an H2 database payload.
  • A weaponizer fleet. Monograph 23 found 42 JavaChains endpoints, 16 of them confirmed on dedicated cloud hosting. JavaChains bundles gadget generation for libraries such as CommonsCollections, Fastjson, Jackson, Hessian and SnakeYAML, plus built-in JNDI, LDAP and RMI listeners. Its web console uses port 8011 by default.
  • Blind JNDI callbacks. Monograph 17 explains how a Java logging sink reveals itself with an anonymous LDAPv3 bind on port 389 or 1389.

How to detect JNDI injection

  • Lookup strings in requests. Inspect HTTP headers and bodies for ${jndi: followed by ldap, ldaps, rmi or dns. Expect obfuscated variants and decode before matching.
  • Outbound LDAP and RMI from app servers. A web or middleware server that opens an LDAP connection to the internet, especially to port 1389, is a strong signal.
  • Serialized data from outside. LDAP answers from external hosts that carry Java serialized data should never reach production Java servers.
  • Child processes. Java processes that suddenly start shells, PowerShell or download tools deserve immediate review.

Monograph 01 publishes Suricata rules for ${jndi: probes in headers and bodies. Monograph 09 adds a Suricata signature for rogue LDAP answers carrying serialized data and a YARA rule for rogue JNDI LDAP kits. Monograph 17 detects outbound anonymous LDAP binds, and Monograph 23 covers JavaChains traffic. All are in the Defense Kit.

How to defend against JNDI injection

  1. Patch libraries. Upgrade Log4j to 2.17.0 or later on Java 8, as CISA advises. CISA notes that updating Java alone is not enough.
  2. Never pass untrusted data to a lookup. The Black Hat authors also advise against object-returning LDAP queries and remote codebase settings.
  3. Cut the callback. CISA recommends blocking or allowlisting outbound LDAP and RMI and blocking direct outbound DNS from web application servers.
  4. Filter deserialization. Turn on JDK serialization filters and remove gadget-rich libraries you do not need, as Monograph 23 recommends.
  5. Know where Java runs. Keep an inventory of every Java service, including vendor appliances. See How to respond to actively exploited vulnerabilities.

JNDI injection compared with related Java attacks

AttackEntry pointWhat the server fetches or parsesKey fix
JNDI injectionUntrusted string reaches a JNDI lookupReference or serialized object from attacker LDAP or RMINo untrusted lookups; block outbound LDAP and RMI
Log4ShellLookup expression inside a log messageSame JNDI answers, triggered by loggingLog4j 2.17.0 or later on Java 8
Rogue JDBC serverDriver connects to an attacker MySQL serverSerialized data returned in query resultsRemove auto-deserialize driver options (Monograph 09)
SnakeYAML gadgetsUntrusted YAML parsed with an unsafe loaderObject construction from YAML tagsSnakeYAML 2.0 or later with a safe loader (Monograph 23)

Frequently asked questions about JNDI injection

What is JNDI injection?

JNDI injection is an attack where untrusted input reaches a Java JNDI lookup, so the application contacts an attacker's LDAP, RMI or other directory server and may load or deserialize a hostile object.

What does JNDI stand for?

Java Naming and Directory Interface. Oracle describes it as an API that gives Java applications a common way to use naming and directory services such as LDAP, DNS and the RMI registry.

Is JNDI itself a vulnerability?

No. JNDI is a normal Java API. The vulnerability appears when an application passes attacker-controlled data to a JNDI lookup or trusts objects returned from an untrusted server.

How is JNDI injection related to Log4Shell?

Log4Shell, CVE-2021-44228, let attackers put a JNDI lookup expression into a log message. Vulnerable Log4j versions resolved it, connected to the attacker's server and could run arbitrary code.

Does updating Java stop JNDI injection?

Not fully. Newer JDKs block remote class loading by default, but serialized payloads can still work through gadget libraries. CISA says updating Java alone does not fix Log4Shell; patch the library too.

How do I detect JNDI injection attempts?

Look for ${jndi: strings in HTTP headers and bodies, outbound LDAP or RMI from application servers, and Java processes that spawn shells. Odin Research publishes Suricata and YARA rules for these patterns.

Which ports do JNDI exploit servers use?

Rogue LDAP servers often listen on 1389 or 389. In Odin Research data, the JavaChains weaponizer console used 8011 by default with a secondary listener on 8012.

Who discovered JNDI injection?

The attack class was described in detail by Alvaro Muñoz and Oleksandr Mirosh of HPE Fortify at Black Hat USA 2016, in a talk on JNDI and LDAP manipulation.

Sources

  1. Oracle, The Java Tutorials: JNDI Overview. docs.oracle.com/javase/tutorial/jndi/overview/index.html (checked 21 November 2026)
  2. Alvaro Muñoz and Oleksandr Mirosh, "A Journey From JNDI/LDAP Manipulation to Remote Code Execution Dream Land", Black Hat USA 2016. www.blackhat.com/docs/us-16/materials/us-16-Munoz-A-Journey-From-JNDI-LDAP-Manipulation-To-RCE.pdf (checked 21 November 2026)
  3. NVD, CVE-2021-44228. nvd.nist.gov/vuln/detail/CVE-2021-44228 (checked 21 November 2026)
  4. CISA and partners, "Mitigating Log4Shell and Other Log4j-Related Vulnerabilities" (AA21-356A). www.cisa.gov/news-events/cybersecurity-advisories/aa21-356a (checked 21 November 2026)
  5. NVD, CVE-2021-45046. nvd.nist.gov/vuln/detail/CVE-2021-45046 (checked 21 November 2026)
  6. NVD, CVE-2021-45105. nvd.nist.gov/vuln/detail/CVE-2021-45105 (checked 21 November 2026)
  7. MITRE CWE, CWE-917. cwe.mitre.org/data/definitions/917.html (checked 21 November 2026)

Related tools and terms

All Odin Research explanations · Brandefense glossary

Odin Research

Get the rules, not just the definition

Every Odin Research report ships with verified indicators and detection rules you can load today.

Open the Defense Kit