> For the complete documentation index, see [llms.txt](https://ctf.laet4x.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ctf.laet4x.com/ctf-2020/rootcon-recovery-mode/forensics-warm-up.md).

# Forensics (Warm Up)

Category: Forensics

Challenge: Warm Up

Points: 100

<figure><img src="https://382757542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfAxmqRz869b0dQQ6DjHW%2Fuploads%2Fgbye1qLBHDH1fpIq6hKa%2F1_GjoJTIvZ6nmSfhEhAgmheQ.png?alt=media&amp;token=42a414f0-c86b-4a06-be7c-f2e1b43117fa" alt=""><figcaption></figcaption></figure>

We are given a *.zip* file that contains ***challenge.raw*** file. Since this is a memory image file, I decided to use ***volatility*** tools for this challeng&#x65;*.*

<figure><img src="https://382757542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfAxmqRz869b0dQQ6DjHW%2Fuploads%2FhvOc2bGgxJsxAHEbSIww%2F1_OiEqUZio10tZlM4QbwD7fg.png?alt=media&amp;token=3064387b-cce5-4c85-a9fb-7a437aee00e5" alt=""><figcaption></figcaption></figure>

It worked! I get a suggested profile and confirmed that this is a memory image file.

Now let’s start solving the questions:

**Number 1**: ***What is the hostname of the source of this memory image?***

For this one, I dump the hives to get the offset where we will get the hostname:

<figure><img src="https://382757542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfAxmqRz869b0dQQ6DjHW%2Fuploads%2FZuIYnlkKutKNR81vSMqc%2F1_Si7LO5XmC4PWssO5qTyBrg.png?alt=media&amp;token=f671475d-5a5a-40d2-bbaa-d074dad11d62" alt=""><figcaption></figcaption></figure>

Then I dump the registry key where the hostname is revealed.

<figure><img src="https://382757542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfAxmqRz869b0dQQ6DjHW%2Fuploads%2FT61rRkdfq4l0kCGHKOU5%2F1_S-TVRZLjryDz_EACrafEeQ.png?alt=media&amp;token=a80d636a-815d-49f6-8cb4-c8ac1cd22963" alt=""><figcaption></figcaption></figure>

Question number **2, 3, and 4** has the same goal which is to get the password of the users.

**What is the password of user Le?**

**What is the password of user Li?**

**What is the password of user S?**

I’m interested in the 2 offsets: SYSTEM (-y) and SAM (-s)

<figure><img src="https://382757542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfAxmqRz869b0dQQ6DjHW%2Fuploads%2FZssHOP0Gn7qGOQM69krn%2F1_biyVH8CUD_1CZTczKS9tjw.png?alt=media&amp;token=045f5eca-d3f4-4f5d-ba5e-08e1e7336378" alt=""><figcaption></figcaption></figure>

I use crackstation.net, an online password hash cracker to crack the password. I was able to crack the first user and the others.

<figure><img src="https://382757542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfAxmqRz869b0dQQ6DjHW%2Fuploads%2Fkg1sulTodiFlqgBYCGfm%2F1_G_36-PekS10dpLeEXo6EfQ.png?alt=media&amp;token=50ded592-7b75-423f-83e6-bd4a525f5721" alt=""><figcaption></figcaption></figure>

Now let’s proceed to **Number 5, 6, and 7** which needs the IP Address and port of backdoor listening on.

**What is the attacker’s IP address?**

**What is the victim’s IP address?**

**Which port is the backdoor listening on?**

I run `connections` and `connscan` but it seems the profile does not support this command so I look for other solutions and found that we need to run `netscan` command. From there, I get the IP Address of the Attacker and Victim and port which is the backdoor listening on.

<figure><img src="https://382757542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfAxmqRz869b0dQQ6DjHW%2Fuploads%2FwDSthfdpyrGR9tZUVN4X%2F1_32qZlSeISMvkBFw7GR5u2Q.png?alt=media&amp;token=62bc37a6-0a9e-40d1-8919-64a8cd466a91" alt=""><figcaption></figcaption></figure>

Now let’s proceed to questions **Number 8 to 13,** which takes me longer to solve. I won’t discuss the other steps I tried here. I’ll just go straight to the right solution. Since we are looking for malware I run `pslist` and `pstree` command. `pstree` uses the same technique as `pslist` but the result is based on the parent-child relationship between the processes.

<figure><img src="https://382757542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfAxmqRz869b0dQQ6DjHW%2Fuploads%2FQObvHfCDwhuFmfVv8EhQ%2F1_0w8bxX6anLdPcCQ0ROVr2g.png?alt=media&amp;token=744ab0e5-5cde-4c30-9fdd-df6f166096d7" alt=""><figcaption></figcaption></figure>

For example, here we can see that `nc64.exe` started `cmd.exe` which in turn started the instances of `lsass.exe` and `svchost.exe.` So we search for commands and can be done using the`cmdline`

<figure><img src="https://382757542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfAxmqRz869b0dQQ6DjHW%2Fuploads%2FInYyzk3e3CRPDAyxmIvV%2F1_eEdp_NP6dpyMr83Z5PKHnA.png?alt=media&amp;token=a293f338-dbb1-442d-a068-28835efa0666" alt=""><figcaption></figcaption></figure>

### Analysis: <a href="#id-613e" id="id-613e"></a>

1. The attacker run `nc64.exe`
2. Download the `lsass.exe` and the path is located at `C:\Users\samael\lsass.exe`
3. Execute the `lsass.exe` that's running on pid `1952`to download `svchost.exe`located at `C:\Users\samael\svchost.exe`
4. Execute the `svchost.exe` that's running on pid `2972`, the file is mimikatz upon analysis

I assume the `lsass.exe`is malware. I dump a process’s executable by using the `procdump` command and uploaded it to the virustotal.com. Few AV detected this as malware.

<figure><img src="https://382757542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfAxmqRz869b0dQQ6DjHW%2Fuploads%2FMSaTHtHZDwNPW1GeIOF1%2F1_7bgrjN44LYyR8B14ngnWpQ.png?alt=media&amp;token=869a3e3b-de59-4e7e-a133-32bbe57130a5" alt=""><figcaption></figcaption></figure>

I use `memdump`, a simple analysis of these files can be done by using the “**strings**”, we are looking for a relation between the piece of information already retrieved from the dump (especially the opened TCP connection towards the `10.163.7.130` IP)

`strings 1952.dmp | grep -Fi “10.163.7.130” -C 5`

Look what I found, So it seems `lsass.exe`processes is to download a new file `svchost.exe`

<figure><img src="https://382757542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfAxmqRz869b0dQQ6DjHW%2Fuploads%2F0MGtn77ZAq9qZZNmDeOQ%2F1_l1ACV_3MKo1rA-gTpDdxDA.png?alt=media&amp;token=f0076926-149c-442f-bec8-36ca2dec5a3d" alt=""><figcaption></figcaption></figure>

I suspected that this file is malware. I run `procdump` again on pid `2972`and uploaded it to virustotal.com and look what I found?! Its **mimikatz!!!**

<figure><img src="https://382757542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfAxmqRz869b0dQQ6DjHW%2Fuploads%2Fv1Ebmeo4PgmnC6M57lj3%2F1_eEd3qnTAmJIhmlKtNSZ_xw.png?alt=media&amp;token=2aa0cf73-36a8-43ae-a752-286086930372" alt=""><figcaption></figcaption></figure>

So now I identify all **process name** of malware running in lower and higher **pid** and the path.

*Number 8: **lsass.exe***

*Number 9: **1952***

*Number 10: **svchost.exe***

*Number 11: **2972***

*Number 12:**C:\Users\samael\lsass.exe***

*Number 13:**C:\Users\samael\svchost.exe***

Now we combine all the results and run **md5sum**

> printf ‘%s’ “RC-MINIONS\~darklighter\~97sunfire\~poisonthewell\~10.163.7.130\~10.163.7.100\~5900\~lsass.exe\~1952\~svchost.exe\~2972\~C:\Users\samael\lsass.exe\~C:\Users\samael\svchost.exe” | md5sum

Voila!!!

**rc14{81cd8971d7cdbf45d2cdf4c90fbaa339}**

## Conclusion <a href="#id-460c" id="id-460c"></a>

I would like to thanks my teammates (*Sai and Chris*). Thanks also to **ROOTCON** and **PWN DE MANILA** for the challenge.

I hope you guys enjoyed reading this write-up!

For references, you may look into these links:

1. Volatility Command Reference — <https://github.com/volatilityfoundation/volatility/wiki/Command-Reference>
2. <https://www.secjuice.com/malware-analysis-memory-forensics/>

<br>
