To trigger this vulnerability, all the attacker needs to do is get the app to log a special string. The vulnerability gets triggered if the logged string contains any untrusted strings in any part of the logged data. Guess what can be used to log this string to the system? HTTP headers, Usernames, Email addresses and URLs.
${jndi:ldap://127.0.0.1:1389/a}
and you’re the owner of it. Try applying for a job in a firm having Log4j with the aforementioned name and the least you could get is a full-time job XD. Have you heard of secret santa? Apparently, this is the perfect gift to bad guys from Santa.Why does this happen?
Mitigation
- Setting the system property formatMsgNoLookups: true
- Set the JVM parameter -Dlog4j2.formatMsgNoLookups=true
- Elasticsearch using log4j-2.10.x can add -Dlog4j2.formatMsgNoLookups=true to ES_JAVA_OPTS or /etc/elasticsearch/jvm.options
- Removing JndiLookup class from the classpath
Detection
index=bro AND http_uri:(\/\$\{jndi\:*)
tail 10 <
https://rules.emergingthreatspro.com/open/suricata-5.0/rules/emerging-exploit.rules
IOCs
- 194.48.199.78
- 181.214.39.2
- 62.76.41.46
- 45.137.21.9
- CVE-2021–44228_IPs.csv
- Callback Domains
References:
https://www.lunasec.io/docs/blog/log4j-zero-day/
https://www.veracode.com/blog/security-news/urgent-analysis-and-remediation-guidance-log4j-zero-day-rce-cve-2021-44228