Apache Log4j is a Java-based logging utility and several Java logging frameworks. Log4j is a popular logging package written in Java. log4j has been ported to the C, C++, C#, Perl, Python, Ruby, and Eiffel languages. On Dec 9th, 2021, a Zero-day vulnerability named “Log4Shell” (tracked as CVE–2021-44228) was detected and rated 10 under CVSS by Apache Foundation. It is of Remote Code Execution (RCE) type vulnerability, allowing attackers to remotely run malicious code within the target system without requiring physical access to the system. Proof of Concept and investigations revealed that the exploitation was easy to perform. Based on the system’s configuration, the attacker will craft a request from Log4j LDAP and JNDI servers, as the responses are not checked. This will allow the attacker to execute arbitrary Java code on a server or computer or leak sensitive information.
Log4j is used by millions of web applications, including Minecraft, Apple iCloud, Twitter and Steam. It is a login utility used in enterprise software applications, including those custom applications developed in-house by businesses, and forms part of many clouds computing services. Logging is used by developers and soc members to check out the activity of an application. It can be seen in the smartwatches, smartphones and other smart devices we use in our daily life.
As this framework is very widely used across the globe and more often seen in the wild as a logging service, the attack surface is huge. International security company ESET released a map showing where Log4j exploitation attempts have been made, with the highest volume occurring in the US, UK, Turkey, Germany, and the Netherlands.
A logger writes down everything that is set to log on to the hard drive or store it on the server. In the case of log4j few actions are performed before writing. It looks for patterns like ${date} and will try to fetch the relative information. When we use something like ${jdni: resource} it triggers a mechanism where it loads a resource from another computer. This resource can be a malicious piece of code that will be executed by the victim who is parsing our payload (it is a simple script that will let hackers/adversaries perform unauthorized or malicious actions on one’s computer).
To check whether your application is likely affected you must verify:
If both are true, your Log4j version is older than 2.15.0 and your Java version patch level is older than listed above, you’re almost certainly affected.
You can use these commands to search for exploitation attempts against log4j RCE vulnerability.
This command searches for exploitation attempts in uncompressed files in folder /var/log and all sub folders.
This command searches for exploitation attempts in compressed files in folder /var/log and all sub folders.
These commands cover even the obfuscated variants but lack the file name in a match.
This command searches for exploitation attempts in uncompressed files in folder /var/log and all sub folders.
This command searches for exploitation attempts in compressed files in folder /var/log and all sub folders.
File Hashes
This vulnerability should be considered seriously as it is extravagantly exploitable that could allow hacker’s/adversaries to control java-based web servers and get RCE (remote code execution). In layman’s language, it would help a hacker to gain full control of the system. This library is used almost everywhere and the exploit gives full server control and it is easy to conduct. It is why the rating of this vulnerability is quite severe. Firstly, this vulnerability was seen in Microsoft’s owned Minecraft, NetApp products, Cisco’s Webex meeting server, and many others joining the list. The biggest problem is where the hackers/adversaries are using for illegal crypto mining where hackers steal one’s resources and perform cryptocurrency transactions and gain benefit for completing the transactions.
Any Log4J version prior to v2.15.0 is affected by this issue. we will have to upgrade to v2.16.0 as it is considered the safe version. For version greater than or equal to 2.10 we can set log4j2.formatMsgNoLookups to true and for releases from 2.0 to 2.10.0 we will have to remove the ldap class from the log4j by running the command zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class and then set the system property log4j2.formatMsgNoLookups to true. If upgrading is not possible then we have to confirm the system property -Dlog4j2.formatMsgNoLookups is set to true on both client and server-side components. Also, many organizations don’t sanitize the logs before storing assuming nothing could go wrong. To mitigate this issue, we need to make sure that the logs are being sanitized before storing them on the server.
Log4j 2.15.0-rc1 has been released. The fix included restricting the servers and protocols that may be used for lookups, which can be configured using several system properties. This replaced the system property {log4j2.formatMsgNoLookups}, which is recommended to be used to mitigate the vulnerability in previous versions since 2.10.0 by setting it to ‘true’. For versions before 2.10.0, the class {org.apache.logging.log4j.core.lookup.JndiLookup} needs to be removed from the class path.
Additionally, all features using JNDI will be disabled by default, and support for message lookups removed from version 2.16.0 onwards.
Newer versions of the Java Runtime Environment (JRE) also mitigate this vulnerability by blocking remote code from being loaded by default, although other attack vectors still exist in certain applications. Several methods and tools have been published to help detect the usage of vulnerable log4j versions in built Java packages.
Get more insights from cybersecurity experts and top 5 learnings from core PFIs here: SISA Forensics Learning Session – Customized Cybersecurity Need |
SISA is a global forensics-driven cybersecurity solutions company, trusted by leading organizations for securing their businesses with robust preventive, detective, and corrective cybersecurity solutions. Our problem-first, human-centric approach helps businesses strengthen their cybersecurity posture.
Industry recognition by CREST, CERT-In and PCI SSC serves as a testament to our skill, knowledge, and competence.
We apply the power of forensic intelligence and advanced technology to offer true security to 2,000+ customers in 40+ countries.
<a onmouseover=“alert(document.cookie)“>xxs link</a>