{"id":17088,"date":"2021-12-14T15:51:54","date_gmt":"2021-12-14T10:21:54","guid":{"rendered":"https:\/\/www.getastra.com\/blog\/?p=17088"},"modified":"2025-10-03T18:45:07","modified_gmt":"2025-10-03T13:15:07","slug":"zero-day-rce-in-log4j2","status":"publish","type":"post","link":"https:\/\/www.getastra.com\/blog\/security-audit\/zero-day-rce-in-log4j2\/","title":{"rendered":"CVE-2021-44228: Zero Day RCE in Log4j 2 (Explained with Mitigation)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A recent critical zero-day exploit in the popular <strong>Java logging system Log4J<\/strong> which was developed by Apache Foundation has set the internet on fire. In this blog, we&#8217;re going to detail how this vulnerability was exploited, how you may be affected, and how you can protect yourself against its active exploits.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On 9th December 2021, security researchers at Alibaba Cloud reported this vulnerability to Apache.&nbsp; An attacker can exploit this vulnerability to achieve unauthenticated <strong>remote code execution<\/strong>, affecting the old versions of Log4J. The report also says that it impacts default configurations of multiple Apache frameworks, including Apache Struts2, Apache Solr, Apache Druid, Apache Flink, and others.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Still, before understanding this vulnerability, you need to know what exactly Log4J is and why should you be worried?<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1920\" height=\"1080\" src=\"\/cdn-cgi\/image\/quality=80,format=auto,onerror=redirect,metadata=none\/https:\/\/cdn-blog.getastra.com\/2021\/12\/CVE-2021-44228-1-1.png\" alt=\"Impact of CVE-2021-44228 (Log4j 2)\" class=\"wp-image-17100\" srcset=\"\/cdn-cgi\/image\/quality=80,format=auto,onerror=redirect,metadata=none\/https:\/\/cdn-blog.getastra.com\/2021\/12\/CVE-2021-44228-1-1.png 1920w, \/cdn-cgi\/image\/width=1536,height=864,fit=crop,quality=80,format=auto,onerror=redirect,metadata=none\/https:\/\/cdn-blog.getastra.com\/2021\/12\/CVE-2021-44228-1-1.png 1536w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><figcaption class=\"wp-element-caption\"><strong><em> Image: Impact of CVE-2021-44228 (Log4j 2)<\/em><\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Log4J\"><\/span>What is Log4J?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Logging is an essential element of any application, and there are several ways to do it. <a href=\"https:\/\/logging.apache.org\/log4j\/2.x\/index.html\" target=\"_blank\" rel=\"noopener\">Log4J<\/a> is an open-source tool that makes it simple to record messages and errors. It&#8217;s flexible, easy to use and manages the complexity of logging for you.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Logging is built-in to many programming languages, and there are many logging frameworks available for Java. Log4J is probably the most popular logging API for Java and is an excellent choice for a standalone logging framework.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Log4j is a logging library based on the Java Platform, Standard Edition (Java SE), and has been around since the early days. <a href=\"https:\/\/github.com\/ceki\" target=\"_blank\" rel=\"noopener\">Ceki G\u00fclc\u00fc<\/a> created it, and The Apache Software Foundation currently maintains the library. Log4J is the most popular logging framework for Java and is an excellent choice for a standalone logging framework.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Why_should_you_be_worried_about_a_vulnerability_in_Log4J\"><\/span>Why should you be worried about a vulnerability in Log4J ?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.java.com\/en\/\" target=\"_blank\" rel=\"noopener\">Java<\/a> is the most popular language used for the development of software applications. As of today, Java is used for developing applications for mobile phones, tablets, and other smart devices. Furthermore, it is used for developing web applications in the JAVA language.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The most important fact is that Java has the most extensive ecosystem and an extensive community of users and developers. <strong>Most of these devices running Java use Log4J for logging<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Log4J API allows remote code execution. This means that an attacker can abuse the Log4J API to execute code on the server and other devices connected to it. A remote attacker can do this without any authentication.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you are using Log4J for logging in Java directly or indirectly, you should take immediate steps to fix it as soon as possible.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_exactly_is_this_vulnerability_CVE-2021-44228_Explained\"><\/span>What exactly is this vulnerability? (CVE-2021-44228 Explained)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The vulnerability was found by <strong>Chen Zhaojun<\/strong> from <strong>Alibaba Alibaba Cloud Security Team<\/strong> and has been assigned <a href=\"https:\/\/cve.mitre.org\/cgi-bin\/cvename.cgi?name=CVE-2021-44228\" target=\"_blank\" rel=\"noopener\">CVE-2021-44228<\/a>. It is a critical flaw dubbed as Log4Shell or LogJam and is second only to the infamous Heartbleed bug with a base CVSS score of 10.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This vulnerability impacts all the log4j-core versions &gt;=2.0-beta9 and &lt;=2.14.1.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">According to<a href=\"https:\/\/logging.apache.org\/log4j\/2.x\/security.html\" target=\"_blank\" rel=\"noopener\"> Apache<\/a>:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>\u201cApache Log4j &lt;=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.\u201d<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The affected version of Log4j allows attackers to lookup objects in local or virtual context over data and resources by a name via RMI and LDAP queries using this API AFAIK, so when a log entry is created, JNDI is encountered and invoked, which supports RMI and LDAP calls. It may make it possible to download remote classes and execute them.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Mitigate_CVE-2021-44228\"><\/span>How to Mitigate CVE-2021-44228?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1. Upgrade to the latest release,&nbsp;<strong>Log4j v2.15.0<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. If you are using version &gt;=2.10<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Set <code>log4j2.formatMsgNoLookups<\/code> or <code>LOG4J_FORMAT_MSG_NO_LOOKUPS<\/code> to <code>TRUE<\/code><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3. For version &gt;=2.0-beta9 and &lt;=2.10.0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Remove the <code>JndiLookup<\/code> class from the classpath: <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code><strong>zip -q -d log4j-core-*.jar org\/apache\/logging\/log4j\/core\/lookup\/JndiLookup.class<\/strong><\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_can_Astra_protect_you_from_CVE-2021-44228\"><\/span>How can Astra protect you from CVE-2021-44228?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A top-notch automated vulnerability scanner by Astra identifies CVE-2021-44228 and helps your organization get rid of it with a recommended fix. With Astra Penest, you can find out all vulnerabilities that exist in your organization and get a comprehensive vulnerability management dashboard to see and fix your vulnerabilities on time.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1920\" height=\"1080\" src=\"\/cdn-cgi\/image\/quality=80,format=auto,onerror=redirect,metadata=none\/https:\/\/cdn-blog.getastra.com\/2021\/12\/Astra-Dashboard.png\" alt=\"Detection of CVE-2021-44228 by Astra's Scanner\" class=\"wp-image-17124\" srcset=\"\/cdn-cgi\/image\/quality=80,format=auto,onerror=redirect,metadata=none\/https:\/\/cdn-blog.getastra.com\/2021\/12\/Astra-Dashboard.png 1920w, \/cdn-cgi\/image\/width=1536,height=864,fit=crop,quality=80,format=auto,onerror=redirect,metadata=none\/https:\/\/cdn-blog.getastra.com\/2021\/12\/Astra-Dashboard.png 1536w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><figcaption class=\"wp-element-caption\"><strong><em>Image: Detection of CVE-2021-44228 by Astra&#8217;s Scanner<\/em><\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Wrapping_it_up%E2%80%A6\"><\/span>Wrapping it up&#8230;<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Whether it&#8217;s a new zero-day security vulnerability or a ransomware attack, you never know when your business will be affected by a new form of cyber attack. That&#8217;s why having a <strong>penetration testing solution<\/strong> by your side is essential. With Astra, you won&#8217;t have to worry about anything. Check out our<a href=\"https:\/\/www.getastra.com\/website-vapt#pricing\"> website<\/a> today to learn more and see how we can help you with your next project.<\/p>\n\n\n","protected":false},"excerpt":{"rendered":"<p>A recent critical zero-day exploit in the popular Java logging system Log4J which was developed by Apache Foundation has set the internet on fire. In this blog, we&#8217;re going to detail how this vulnerability was exploited, how you may be affected, and how you can protect yourself against its active exploits. On 9th December 2021, &#8230; <a title=\"CVE-2021-44228: Zero Day RCE in Log4j 2 (Explained with Mitigation)\" class=\"read-more\" href=\"https:\/\/www.getastra.com\/blog\/security-audit\/zero-day-rce-in-log4j2\/\" aria-label=\"Read more about CVE-2021-44228: Zero Day RCE in Log4j 2 (Explained with Mitigation)\">Read more<\/a><\/p>\n","protected":false},"author":91,"featured_media":17094,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[340],"tags":[],"class_list":["post-17088","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security-audit"],"_links":{"self":[{"href":"https:\/\/www.getastra.com\/blog\/wp-json\/wp\/v2\/posts\/17088","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.getastra.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.getastra.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.getastra.com\/blog\/wp-json\/wp\/v2\/users\/91"}],"replies":[{"embeddable":true,"href":"https:\/\/www.getastra.com\/blog\/wp-json\/wp\/v2\/comments?post=17088"}],"version-history":[{"count":7,"href":"https:\/\/www.getastra.com\/blog\/wp-json\/wp\/v2\/posts\/17088\/revisions"}],"predecessor-version":[{"id":41868,"href":"https:\/\/www.getastra.com\/blog\/wp-json\/wp\/v2\/posts\/17088\/revisions\/41868"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.getastra.com\/blog\/wp-json\/wp\/v2\/media\/17094"}],"wp:attachment":[{"href":"https:\/\/www.getastra.com\/blog\/wp-json\/wp\/v2\/media?parent=17088"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.getastra.com\/blog\/wp-json\/wp\/v2\/categories?post=17088"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.getastra.com\/blog\/wp-json\/wp\/v2\/tags?post=17088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}