Critical vulnerability: remote code execution vulnerability (CVE-2021-44228) in Apache Log4j library
The Apache Log4j library (a logging tool used in many Java-based applications) has been used in lot of the Java projects I worked. High performing, Easy to use and convenient. Love that. Recently on 9th Dec 2021 Chen Zhaojun of Alibaba Cloud Security Team discovered the remote code execution vulnerability (CVE-2021-44228) related to Apache Log4j.
Which versions of the Log4j library are vulnerable?
Apache Log4j2 <=2.14.1 JNDI features used in configuration, log messages, and parameters do not protect against attacker controlled LDAP and other JNDI related endpoints. An attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled. From log4j 2.15.0, this behavior has been disabled by default.
Analysis of the CVE-2021-44228 vulnerability
According to Microsoft Blog,
The vulnerability is a remote code execution vulnerability that can allow an unauthenticated attacker to gain complete access to a target system. It can be triggered when a specially crafted string is parsed and processed by the vulnerable Log4j 2 component. This could happen through any user provided input.
Successful exploitation allows for arbitrary code execution in the targeted application. Attackers do not need prior access to the system to log the string and can remotely cause the logging event by using commands like curl against a target system to log the malicious string in the application log. When processing the log, the vulnerable system reads the string and executes it, which in current attacks is used to execute the code from the malicious domain. Doing so can grant the attacker full access and control of the affected application.
Given the fact that logging code and functionalities in applications and services are typically designed to process a variety of external input data coming from upper layers and from many possible vectors, the biggest risk factor of this vulnerability is predicting whether an application has a viable attack vector path that will allow the malformed exploit string to reach the vulnerable Log4j 2 code and trigger the attack.
A common pattern of exploitation risk, for example, is a web application with code designed to process usernames, referrer, or user-agent strings in logs. These strings are provided as external input (e.g., a web app built with Apache Struts). An attacker can send a malformed username or set user-agent with the crafted exploit string hoping that this external input will be processed at some point by the vulnerable Log4j 2 code and trigger code execution.
Recommended by LinkedIn
How to Mitigate
The recommended action is to update Log4j 2 to 2.15.0. A service restart will be required.
From log4j 2.15.0, JNDI features used in configuration, log messages, and parameters has been disabled by default.
Mitigation Guidance for Microsoft Services
After further analysis of our services and products, below are a few mitigation strategies given by various Microsoft services.
Microsoft Azure AD
While the industry is determining and mitigating overall exposure, attackers are probing all endpoints for vulnerability. Applying rigorous least privilege access policies to all resources in your environment is critical. If you use Azure Active Directory for single-sign on in your environment, we recommend you do the following with a special focus on applications you deploy or manage directly (SaaS apps, including those deployed by Microsoft, must be secured by their vendors). Note that log4j2 usage may be pre-auth for some of your applications, but these steps will help prevent post-authentication exploitation. Templates and examples for these policies are built in to facilitate deployment.
Azure Application Gateway, Azure Front Door, and Azure WAF
In our investigation so far, we have not found any evidence that these services are vulnerable however customer applications running behind these services might be vulnerable to this exploit. We highly recommend customers to follow mitigations and workarounds mentioned in this blog to protect their applications. In parallel we are also working on enhancing WAF managed RuleSets to help protect against this vulnerability.
Azure App Service (Windows and Linux)
Azure App Service and Functions does not distribute Log4J in the managed runtimes such as Tomcat, Java SE, JBoss EAP, or the Functions Runtime. However, your applications may use Log4J and be susceptible to this vulnerability.
For details, Please visit Microsoft Blog
Lead Developer at Carsync GmbH
3yNice article
Experienced IT & Telecom Professional | Data Analytics | IT Operations | Project Management | ERP (ODOO), Web-Applications, IoT
3ywonderfully explained the fact, keep going friend 👍
Principal Cloud Platform / Automation Engineer at Department of Energy, Environment and Climate Action
3yGreat article bhai... Sharing with my network :)