# DetectLog4j

{% embed url="<https://cyberdefenders.org/blueteam-ctf-challenges/86#nav-overview>" %}

## Q1 What is the computer hostname?

for this challenge, I will use autopsy and fkt imager,

go-to operating system information and u will see the hostname in the right panel *<mark style="color:green;">(note that your result may have some difference from mine as the file is still loading )</mark>*

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FiUWX7qqpiVTr0FY7edrf%2Fimage.png?alt=media&#x26;token=7da53651-1604-44cd-ab2e-64107082b340" alt=""><figcaption></figcaption></figure>

**Answer: vcw65**

## **Q2** What is the Timezone of the compromised machine?

we need to open the SYSTEM file to know the timezone

it will be at the following path: windows/system32/config

the system file would be on the right panel

we would search by Ftk imager this time till the autopsy completes its loading&#x20;

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FChqFy1Vys7GVA9ttL4Cf%2Fimage.png?alt=media&#x26;token=7de7804a-4627-4579-83b7-e713b78546b4" alt=""><figcaption></figcaption></figure>

export the file then load hive by registry editor.

go to the path: system\ControlSet001\Control\TimeZoneInformation to find the timezone

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FohH0HCAxYHaO7Ha87tkL%2Fimage.png?alt=media&#x26;token=7057e815-05a7-4af4-9d43-ce41991df5ab" alt=""><figcaption></figcaption></figure>

the time zone is pacific standard time, google it&#x20;

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FiJ7p3NOAR6t9a6Ob6aD3%2Fimage.png?alt=media&#x26;token=6e3df1fa-02cc-47a2-a4d6-69987f9b8ea2" alt=""><figcaption></figcaption></figure>

**Answer: UTC-8**

## **Q3** What is the current build number on the system?

from the same path at Q2 for the system at ftk imager, scroll down for the SOFTWARE file and export it&#x20;

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2Fvs0yOR3OPJfdBwN5WGNn%2Fimage.png?alt=media&#x26;token=c3fb5b93-9808-41a5-96f5-79751031aa3e" alt=""><figcaption></figcaption></figure>

load the hive using the registry editor and go to the path: software\Microsoft\Windows NT\CurrentVersion

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2Fbb7mD2eviAw18SA7XTr4%2Fimage.png?alt=media&#x26;token=270dc6c3-f939-4605-a846-e1d3b7dea4a6" alt=""><figcaption></figcaption></figure>

**Answer: 14393**

## Q4 What is the computer IP?

in the registry editor go to the path: system\ControlSet001\Services\Tcpip\Parameters\Interfaces{82e90056-fd8d-4a24-913a-fc46f535fddf}

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2F9c9DzSFMreCQHXbmddDj%2Fimage.png?alt=media&#x26;token=0b0a8d86-1c82-4a9b-84b2-edfaa99eacb8" alt=""><figcaption></figcaption></figure>

**Answer: 192.168.112.139**

## **Q5** What is the domain computer was assigned to?

in the registry editor go to the path:&#x20;

system\ControlSet001\Services\Tcpip\Parameters

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2Ftixbuv2XdnjymWTFhKg1%2Fimage.png?alt=media&#x26;token=6f0561af-3714-4875-aa91-030db5e6befe" alt=""><figcaption></figcaption></figure>

**Answer: cyberdefenders.org**

## Q6 When was myoussef user created?

now would use autopsy in the "Account" panel for the mentioned user time creation

![](https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FQeyiPE80U0kdYUaLP4fS%2Fimage.png?alt=media\&token=2d3e452a-49f0-4477-9194-50d21c1bf6d8)

**Answer: 2021-12-28 06:57:23 utc**

## Q7 What is the user mhasan password hint?

from the same panel at Q6 "Account",

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FpVXKkNKy69PSiJZ4UagT%2Fimage.png?alt=media&#x26;token=e91caea3-a2db-4003-881d-baa04893694b" alt=""><figcaption></figcaption></figure>

Answer: <https://www.linkedin.com/in/0xmohamedhasan/>

## Q8 What is the version of the VMware product installed on the machine?

in the registry editor go to the path: software\VMware, Inc.\apacheTomcat

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2Fd1NewhGUuGlUpH1bvltD%2Fimage.png?alt=media&#x26;token=acbb98c9-d8c8-4a76-9a3b-d8f4e95a6e1c" alt=""><figcaption></figcaption></figure>

<mark style="color:red;">**Another way**</mark>**&#x20;using autopsy:** from the installed programs :&#x20;

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2Fud1wDdUROOVgCuzBMgPL%2Fimage.png?alt=media&#x26;token=de53f91e-5721-4c42-be57-b60ca3d9c0ab" alt=""><figcaption></figcaption></figure>

**Answer: 6.7.0.40322**

## **Q9** What is the version of the log4j library used by the installed VMware product?

actually, I didn't know how to find the library path so I tried to search for it by name using Autopsy and fortunately, I found it&#x20;

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2F111K2KBmmBt1jN38NS3a%2Fimage.png?alt=media&#x26;token=fea3b68b-4048-40a1-a886-ecae48a03f91" alt=""><figcaption></figcaption></figure>

**Answer: 2.11.2**

## **Q10** What is the log4j library log level specified in the configuration file?

Search for log4j.properties and read the files till find their stat ..

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FeCJGOWwlUiEqAFieXowj%2Fimage.png?alt=media&#x26;token=2e24c5e2-8263-4eab-87ce-301732e4f180" alt=""><figcaption></figcaption></figure>

**Answer: INFO**

## Q11 The attacker exploited log4shell through an HTTP login request. What is the HTTP header used to inject payload?

By searching in Google, the header is *x-forwarded-for*

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FXXgmUO66TqxNGCHTZHKG%2Fimage.png?alt=media&#x26;token=2bac53d5-7d99-418e-a9b6-18fac26aabfe" alt=""><figcaption><p><a href="https://thestack.technology/vmware-log4j-exposure-attack-log4shell/">https://thestack.technology/vmware-log4j-exposure-attack-log4shell/</a></p></figcaption></figure>

**Answer: x-forwarded-for**

## **Q12** The attacker used the log4shell.huntress.com payload to detect if vcenter instance is vulnerable. What is the first link of the log4huntress payload?

in autopsy search for log4shell.huntress.com, and export the log file.

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2F7tyZDsRlQswvJfpL2y4N%2Fimage.png?alt=media&#x26;token=da2c5bb6-4a8d-4124-ac6e-3084b9fb9387" alt=""><figcaption></figcaption></figure>

**Answer: log4shell.huntress.com:1389/b1292f3c-a652-4240-8fb4-59c43141f55a**

## **Q13** When was the first successful login to vsphere WebClient?

Search for audit\_events at autopsy or go to the path: ProgramData\VMware\vCenterServer\runtime\VMwareSTSService\logs

then find the earlier Loginsuccess event.

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FZoBquj7bb8srh30T0Z3K%2Fimage.png?alt=media&#x26;token=28e3a8cb-5d04-475b-934b-3947f30b2e81" alt=""><figcaption></figcaption></figure>

**Answer: 28/12/2021 20:39:29 UTC**

## **Q14** What is the attacker's IP address?

from the same events, we could find the IP 192.168.112.128 tried many times to log in.

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2F4vYRZRVvw0gdrycEXku4%2Fimage.png?alt=media&#x26;token=54880660-07be-4546-9604-30b5eec13d7c" alt=""><figcaption></figcaption></figure>

**Answer: 192.168.112.128**

## **Q15** What is the port the attacker used to receive the cobalt strike reverse shell?

search for PowerShell lunching logs, name : **Microsoft-Windows-PowerShell%4Operational.evtx**

then search for BASE64&#x20;

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FXKvGIjLFgBKTl7EoZu1C%2Fimage.png?alt=media&#x26;token=15612088-54f8-43b3-ad82-e7daebe6c306" alt=""><figcaption></figcaption></figure>

useing cyberchef transform from base 64 and gunzip

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FPHpWCzt2qK9bXt3fDgew%2Fimage.png?alt=media&#x26;token=88fd503a-4421-4e3e-9c6b-571db6c2e00d" alt=""><figcaption></figcaption></figure>

use execute the code using Fakenet then analyze it by Wireshark.

**Answer: 1337**

## Q16 What is the script name published by VMware to mitigate log4shell vulnerability?

Google it,&#x20;

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FUgZCHx0i8yziQuqVkEFL%2Fimage.png?alt=media&#x26;token=5073f0fe-4f9b-471c-81a9-b5c27106c7e4" alt=""><figcaption></figcaption></figure>

**Answer:vc\_log4j\_mitigator.py**

## Q17 In some cases, you may not be able to update the products used in your network. What is the system property needed to set to 'true' to work around the log4shell vulnerability?

Again google it, then try both solutions : &#x20;

`log4j2.formatMsgNoLookups` or the `LOG4J_FORMAT_MSG_NO_LOOKUPS`

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2Fy9xlrc9vbIW9UlYplH9c%2Fimage.png?alt=media&#x26;token=702bd228-f766-48bc-9262-17f23e4a3c92" alt=""><figcaption></figcaption></figure>

**Answer: log4j2.formatMsgNoLookups**

## Q18 What is the log4j version which contains a patch to CVE-2021-44228?

search for CVE-2021-44228 path&#x20;

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2F5FflzI0CapmVMNqkBx7e%2Fimage.png?alt=media&#x26;token=00e7e804-6d90-46e2-8061-e4b0c64a1e1e" alt=""><figcaption></figcaption></figure>

**Answer: 2.15.0**

## Q19 Removing JNDIlookup.class may help in mitigating log4shell. What is the sha256 hash of the *JNDILookup.class*?

Search for *JNDILookup.class and export the file,*

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FsnxGAw5imQrnLJNzLifV%2Fimage.png?alt=media&#x26;token=d61717bb-6ef4-464d-b235-8907b80b71ef" alt=""><figcaption></figcaption></figure>

then extract the file and search for *JNDILookup.class*&#x20;

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FVVj4BkGEk1pwH79MOmAy%2Fimage.png?alt=media&#x26;token=d122b571-861b-4e2c-a4b5-46917e81163b" alt=""><figcaption></figcaption></figure>

using HachMyFiles,

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FmK8Wr1yWpayj3ZbxUt38%2Fimage.png?alt=media&#x26;token=d5c78329-7255-4b92-926e-0363874886f3" alt=""><figcaption></figcaption></figure>

**Answer: 0f038a1e0aa0aff76d66d1440c88a2b35a3d023ad8b2e3bac8e25a3208499f7e**

## **Q20** Analyze JNDILookup.class. What is the value stored in the CONTAINER\_JNDI\_RESOURCE\_PATH\_PREFIX variable?

in Autopsy search for "CONTAINER\_JNDI\_RESOURCE\_PATH\_PREFIX"

![](https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FoaYfUuUi7WCljNO1caG4%2Fimage.png?alt=media\&token=bf5cc34f-0d81-44d0-853e-db71e1085662)

**Answer: java: comp/env/**

## Q21 What is the executable used by the attacker to gain persistence?

to find that we need to search for any startup program or executable file,

so search in the user's file for NTUSER.DAT&#x20;

we will find it at the path: root\Users\Administrator.WIN-B633EO9K91M\NTUSER.DAT

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2F1csBjsTj0FQFcf3QPYZh%2Fimage.png?alt=media&#x26;token=5a26d18c-cb4c-4d59-b72e-6f62050f7c22" alt=""><figcaption></figcaption></figure>

export the file and open the hive using the registry editor

finally, search for any  file with " Run ", we would find "RunOnce"

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FLFSzm5OSiH68ByJIXjBC%2Fimage.png?alt=media&#x26;token=d99c76c4-dcbb-4dd1-9e0b-dcbc84e1ddb6" alt=""><figcaption></figcaption></figure>

**Answer: baaaackdooor.exe**

## **Q22** When was the first submission of ransomware to virustotal?

after many searches, I found that the first ransomware submitted is "khonsari.exe"

then I searched for its analysis report.

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2Fh6Ilu8JcASM0LAth6svl%2Fimage.png?alt=media&#x26;token=d348d3de-6e0b-4ce4-98da-8257d1d45509" alt=""><figcaption></figcaption></figure>

**Answer: 2021-12-11 22:57:01**

## **Q24** What is the ISP that owns that IP that serves the text file?

from the previous virustotal report, the domain is Amazon

![](https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FJ9lk1bhNg1q1GEicoQ1A%2Fimage.png?alt=media\&token=34b1941b-c70a-48cd-8bd2-cfc0d68039ad)

**Answer: Amazon**

## **Q25** The ransomware check for extensions to exclude them from the encryption process. What is the second extension the ransomware checks for?

from the article Khonsari ransomware analysis, we could see its behavior

<figure><img src="https://3554695797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpkZ2jQy5PAQnYRhE2XnB%2Fuploads%2FaLDmHxVzXGynratxZuap%2Fimage.png?alt=media&#x26;token=0f169a9f-15df-426e-8022-b953a5442a41" alt=""><figcaption></figcaption></figure>

**Answer: ini**

&#x20;                                                          <mark style="color:red;">Hope that helps you, and thank you  :)</mark>&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ahmedrehan.gitbook.io/ahmedrehan/ctf-walkthrough/detectlog4j.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
