{"id":2758,"date":"2021-12-21T07:02:53","date_gmt":"2021-12-21T15:02:53","guid":{"rendered":"https:\/\/www.cloudinsidr.com\/content\/?p=2758"},"modified":"2021-12-24T02:53:45","modified_gmt":"2021-12-24T10:53:45","slug":"log4j-rce-in-vivo","status":"publish","type":"post","link":"https:\/\/www.cloudinsidr.com\/content\/log4j-rce-in-vivo\/","title":{"rendered":"Log4j RCE and mitigation techniques"},"content":{"rendered":"<p>For quite some time it seemed as if cyber vulnerabilities in the Java ecosystem would be losing ground. Instead, it was the calm before the storm: a vulnerability in the <a href=\"https:\/\/logging.apache.org\/log4j\/2.x\/download.html\">Log4j<\/a> library threatens web servers and other applications in a variety of ways.<\/p>\n<p><!--more--><\/p>\n<p>Log4j RCE made its first appearance on December 1st, 2021. That&#8217;s how far you need to backdate your analysis, if not more.<\/p>\n<p><a href=\"https:\/\/twitter.com\/eastdakota\/status\/1469800951351427073\">Matthew Prince, the Co-founder &amp; CEO of Cloudflare (NYSE: NET), declared on Twitter<\/a>:<\/p>\n<p style=\"padding-left: 40px;\"><em>&#8216;Earliest evidence we\u2019ve found so far of #Log4J exploit is 2021-12-01 04:36:50 UTC. That suggests it was in the wild at least 9 days before publicly disclosed. (&#8230;)&#8217;. <\/em><\/p>\n<p>Also, look for signs of malware mining crypto on your systems.<\/p>\n<h3>Log4j RCE out in the wild<\/h3>\n<p>It&#8217;s very hard to avoid<span style=\"color: #000000;\"> using the Log4j library. It is ubiquitous. <a href=\"https:\/\/blog.talosintelligence.com\/2021\/12\/apache-log4j-rce-vulnerability.html\">Talos Intelligence Group<\/a>, a security arm of Cisco, said that it observed a lead time between attackers&#8217; active penetration attempts and callbacks from affected systems, which may indicate lateral movement.\u00a0<\/span><\/p>\n<p>Log4j is used in software running on a wide variety of systems, not just traditional web servers. Vulnerable systems include SIEMs and log collectors.<\/p>\n<p>Attackers may use a plethora of protocols, including LDAP(S), RMI, DNS, NIS, IIOP, CORBA, NDS and HTTP, and a variety of obfuscation techniques.<\/p>\n<p>So far, botnets such as Mirai are having great success taking advantage of this vulnerability. Mirai is a malware that targets smart devices which run on ARC processors, turning them into a network of remotely controlled bots or &#8216;zombies&#8217;. Those networks of bots (a.k.a. &#8216;botnets&#8217;), can be misused to launch DDoS attacks.<\/p>\n<p>Log4j RCE (also known in the NIST database as <a href=\"https:\/\/logging.apache.org\/log4j\/2.x\/security.html\">CVE-2021-44228<\/a>) scored a maximum of 10.0 points on the CVSS severity scale.<\/p>\n<p>How dire the situation is show lists of vulnerable products at <a href=\"https:\/\/www.vmware.com\/security\/advisories\/VMSA-2021-0028.html\">VMware<\/a> and <a href=\"https:\/\/tools.cisco.com\/security\/center\/content\/CiscoSecurityAdvisory\/cisco-sa-apache-log4j-qRuKNEbd\">Cisco<\/a>. (Don&#8217;t look. It&#8217;s nauseating.)<\/p>\n<p>There is a perfect storm brewing that will occupy the Java community in the months ahead, maybe even much longer. It is not enough to merely identify affected packages. They need to be patched URGENTLY.<\/p>\n<h3>Here is what happens<\/h3>\n<p id=\"viewer-19n0u\" class=\"mm8Nw _1j-51 _1atvN _1FoOD _3M0Fe _2WrB- _1atvN public-DraftStyleDefault-block-depth0 public-DraftStyleDefault-text-ltr\"><span class=\"_2PHJq public-DraftStyleDefault-ltr\">Here is a quick overview of the attack on the main vector:<\/span><\/p>\n<ol class=\"public-DraftStyleDefault-ol\">\n<li id=\"viewer-8dpnr\" class=\"_1atvN _2ULPL public-DraftStyleDefault-orderedListItem public-DraftStyleDefault-depth0 public-DraftStyleDefault-list-ltr public-DraftStyleDefault-reset _1FoOD _3M0Fe _2WrB- _1atvN\">\n<p class=\"_1j-51 _1FoOD _3M0Fe _2WrB- _1atvN\">an attacker injects JNDI lookup (JNDI is Java Naming and Directory Interface, a Java API for a directory service that <b>allows Java software clients to discover and look up resources<\/b>) into something that&#8217;s going to be logged.<\/p>\n<\/li>\n<li id=\"viewer-9cre7\" class=\"_1atvN _2ULPL public-DraftStyleDefault-orderedListItem public-DraftStyleDefault-depth0 public-DraftStyleDefault-list-ltr _1FoOD _3M0Fe _2WrB- _1atvN\">\n<p class=\"_1j-51 _1FoOD _3M0Fe _2WrB- _1atvN\">Log4J logs the string, which causes it to query a malicious LDAP server under the attacker&#8217;s control<\/p>\n<\/li>\n<li id=\"viewer-59h69\" class=\"_1atvN _2ULPL public-DraftStyleDefault-orderedListItem public-DraftStyleDefault-depth0 public-DraftStyleDefault-list-ltr _1FoOD _3M0Fe _2WrB- _1atvN\">\n<p class=\"_1j-51 _1FoOD _3M0Fe _2WrB- _1atvN\">the LDAP server returns malicious code<\/p>\n<\/li>\n<li id=\"viewer-aaen6\" class=\"_1atvN _2ULPL public-DraftStyleDefault-orderedListItem public-DraftStyleDefault-depth0 public-DraftStyleDefault-list-ltr _1FoOD _3M0Fe _2WrB- _1atvN\">\n<p class=\"_1j-51 _1FoOD _3M0Fe _2WrB- _1atvN\">bad things happen<\/p>\n<\/li>\n<\/ol>\n<h3>Workarounds for Log4j RCE<\/h3>\n<p>What can you do to dodge this rolling calamity? For the time being, your options include:<\/p>\n<ul class=\"public-DraftStyleDefault-ul\">\n<li id=\"viewer-10nbe\" class=\"_1atvN _2TTR5 _3Kjjs public-DraftStyleDefault-unorderedListItem public-DraftStyleDefault-depth0 public-DraftStyleDefault-list-ltr _1FoOD _3M0Fe _2WrB- _1atvN\">applying a patch to your Log4J library (to at least log4j-2.1.50.rc2)<\/li>\n<\/ul>\n<p>But what if you cannot upgrade? You could use the vulnerability to patch itself with <a href=\"https:\/\/github.com\/Cybereason\/Logout4Shell\" target=\"_blank\" rel=\"noopener\">Logout4Shell<\/a>, actually.<\/p>\n<p>Other things that might help:<\/p>\n<ul class=\"public-DraftStyleDefault-ul\">\n<li>blocking $(jndi:ldap:\/\/ in your web application firewall<\/li>\n<li>disabling JNDI lookups by setting the system property &#8216;log4j2.formatMsgNoLookups&#8217; to true<\/li>\n<li>replacing and disabling Log4J entirely, but that&#8217;s somewhat more drastic<\/li>\n<\/ul>\n<p>Also, it might be temporarily advisable to remove the JndiLookup class from the classpath that&#8217;s used by Java.<\/p>\n<p>The Five Eyes Alliance\u2014intelligence agencies in the United States, United Kingdom, Australia, Canada, and New Zealand\u2014issued a <a href=\"http:\/\/Mitigating Log4Shell and Other Log4j-Related Vulnerabilities\" target=\"_blank\" rel=\"noopener\">Cybersecurity Advisory<\/a> offering guidance for mitigation of Log4j related vulnerabilities.<\/p>\n<p>Before you can roll up your sleeves, though, you need to figure out which systems, if any, are affected.<\/p>\n<h3>Scanners for Log4j RCE<\/h3>\n<p>Luckily, Log4J RCE scanners are free and open source.<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/fullhunt\/log4j-scan\">GitHub &#8211; fullhunt\/log4j-scan: A fully automated, accurate, and extensive scanner for finding log4j RCE CVE-2021-44228<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/CrowdStrike\/CAST\">GitHub &#8211; CrowdStrike\/CAST: CrowdStrike Archive Scan Tool<\/a><\/li>\n<\/ul>\n<p>While it is certainly possible to misuse Log4j to exfiltrate Java system properties, that&#8217;s unfortunately not all there is to it. According to the <a href=\"https:\/\/www.reddit.com\/r\/blueteamsec\/comments\/rd38z9\/log4j_0day_being_exploited\/\">NCC Group<\/a>, AWS secrets are also affected.<\/p>\n<p>On the upside&#8230;<\/p>\n<h3>Java is back!<\/h3>\n<p>According to &#8216;The State of Developer Ecosystem 2021&#8243; by JetBrains, 69% of all developers in large-scale enterprises around the globe rely on Java.<\/p>\n<p>From the get-go, Java JDK 8 was a hit with developers, JDK 11 not so much. Mostly because Oracle antagonized its user base with a licensing that was widely seen as a rip-off. A counter-revolution soon emerged and became\u00a0 known as OpenJDK.<\/p>\n<p>The exodus got so bad that even Oracle took notice.<\/p>\n<p>And it kept getting worse, before only recently, Java finally began turning the corner with JDK 17.<\/p>\n<p>How do you know that Java is back? When you have world-class hackers in your rear-view mirror, you know you made it back to the top.<\/p>\n<h3>The road ahead<\/h3>\n<p>The Log4j RCE is here to stay for some time, perhaps even a year. Log4j is sure to cause nightmares for affected system administrators, Java developers and others in charge of cyber security.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For quite some time it seemed as if cyber vulnerabilities in the Java ecosystem would be losing ground. Instead, it was the calm before the storm: a vulnerability in the Log4j library threatens web servers and other applications in a variety of ways.<\/p>\n","protected":false},"author":1,"featured_media":2769,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[275,1],"tags":[279,277,276,278],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v14.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Log4j RCE and mitigation techniques - CloudInsidr<\/title>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.cloudinsidr.com\/content\/log4j-rce-in-vivo\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Log4j RCE and mitigation techniques - CloudInsidr\" \/>\n<meta property=\"og:description\" content=\"For quite some time it seemed as if cyber vulnerabilities in the Java ecosystem would be losing ground. Instead, it was the calm before the storm: a vulnerability in the Log4j library threatens web servers and other applications in a variety of ways.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cloudinsidr.com\/content\/log4j-rce-in-vivo\/\" \/>\n<meta property=\"og:site_name\" content=\"CloudInsidr\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-21T15:02:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-24T10:53:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2021\/12\/coffee-1973549_1280_PIXABAY.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"903\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#website\",\"url\":\"https:\/\/www.cloudinsidr.com\/content\/\",\"name\":\"CloudInsidr\",\"description\":\"Cyber security, infotech\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.cloudinsidr.com\/content\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/log4j-rce-in-vivo\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2021\/12\/coffee-1973549_1280_PIXABAY.jpg\",\"width\":1280,\"height\":903},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/log4j-rce-in-vivo\/#webpage\",\"url\":\"https:\/\/www.cloudinsidr.com\/content\/log4j-rce-in-vivo\/\",\"name\":\"Log4j RCE and mitigation techniques - CloudInsidr\",\"isPartOf\":{\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/log4j-rce-in-vivo\/#primaryimage\"},\"datePublished\":\"2021-12-21T15:02:53+00:00\",\"dateModified\":\"2021-12-24T10:53:45+00:00\",\"author\":{\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#\/schema\/person\/dd6ee9cb21cf05763fd7cff3d6f11b2b\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.cloudinsidr.com\/content\/log4j-rce-in-vivo\/\"]}]},{\"@type\":[\"Person\"],\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#\/schema\/person\/dd6ee9cb21cf05763fd7cff3d6f11b2b\",\"name\":\"Cloud Insidr\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/8b2fa1415b3d573b97d818b8f8f83b7c?s=96&d=mm&r=g\",\"caption\":\"Cloud Insidr\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/posts\/2758"}],"collection":[{"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/comments?post=2758"}],"version-history":[{"count":16,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/posts\/2758\/revisions"}],"predecessor-version":[{"id":2777,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/posts\/2758\/revisions\/2777"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/media\/2769"}],"wp:attachment":[{"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/media?parent=2758"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/categories?post=2758"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/tags?post=2758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}