Currently, our security tool scans for a vulnerability related to JNDI injection from JndiVariableResolver.java, which is disabled by default. Therefore, this vulnerability only occurs if your application meets all the following conditions.
- Your application enables it by default.
- Your application allows end users to input JNDI pattern mappings from user input.
According to its documentation,
JndiVariableResolver resolves variables in the following order:
- java:comp/env
- java:comp
- java:
- The variable will be looked up as a session bean with a prepended key.
- The key-value pairs defined by the mapping.
This security vulnerability can only occur if step 5 is used and the returned value of the malicious code is passed through end-user input.
To resolve this issue, remember to never allow any end-user input without proper validation. Alternatively, disable this resolver by default.