# Seized Lab

<figure><img src="https://miro.medium.com/v2/resize:fit:700/1*dhanXuLJNUv7wOvzcKwvxg.png" alt="" height="156" width="700"><figcaption></figcaption></figure>

#### Scenario <a href="#id-5cf8" id="id-5cf8"></a>

Using Volatility2, utilize your memory analysis skills as a security blue team analyst to investigate the provided Linux memory snapshots and figure out attack details.

#### Question 1 <a href="#a8f6" id="a8f6"></a>

What is the CentOS version installed on the machine?

#### Answer 1 <a href="#id-0293" id="id-0293"></a>

A quick search online for different versions of CentOS was required for this answer, knowing what profile image was supplied already was a large help.

Press enter or click to view image in full size

<figure><img src="https://miro.medium.com/v2/resize:fit:700/1*QuIIobvnunL2CYPYG-aZBg.png" alt="" height="318" width="700"><figcaption></figcaption></figure>

#### Question 2 <a href="#id-8a7b" id="id-8a7b"></a>

There is a command containing a strange message in the bash history. Will you be able to read it?

#### Answer 2 <a href="#ccf9" id="ccf9"></a>

So getting different profiles loaded into Volatility2 has always been a pain for me, for whatever reason. So I am going to note down how I do it.

First of all, with the profile zip file, go to the following directory:

```
/volatility2/volatility/plugins/overlays/linux/
```

Second unzip the file.

<figure><img src="https://miro.medium.com/v2/resize:fit:682/1*J1oN83VJxzVk03nXzNyloA.png" alt="" height="260" width="682"><figcaption></figcaption></figure>

Third, check if the profile in loaded into Volatility.

```
└─$ python2 vol.py --info

Profiles
--------
LinuxCentos7_3_10_1062x64 - A Profile for Linux Centos7.3.10.1062 x64
VistaSP0x64               - A Profile for Windows Vista SP0 x64
VistaSP0x86               - A Profile for Windows Vista SP0 x86
VistaSP1x64               - A Profile for Windows Vista SP1 x64
VistaSP1x86               - A Profile for Windows Vista SP1 x86
VistaSP2x64               - A Profile for Windows Vista SP2 x64
VistaSP2x86               - A Profile for Windows Vista SP2 x86
Win10x64                  - A Profile for Windows 10 x64
```

When specifying a profile, you have to use the entire string.

```
LinuxCentos7_3_10_1062x64
```

So as an example, I use the following to find bash commands:

```
└─$ python2 vol.py -f dump/dump.mem --profile=LinuxCentos7_3_10_1062x64 linux_bash
```

I hope this helps anyone that is struggling a little bit. It can be a pain to get it working. If you ever find that the profile has not loaded, my fix was to delete the file and make sure I UNZIP the profile while in the folder. Don’t copy and paste a unzipped version. Just unzip it in the location its supposed to be in.

Now on with the question at hand.

```
2622 bash 2020-05-07 14:56:17 UTC+0000 echo "c2hrQ1RGe2wzdHNfc3Q0cnRfdGgzXzFudjNzdF83NWNjNTU0NzZmM2RmZTE2MjlhYzYwfQo=" > y0ush0uldr34dth1s.txt
```

The above string was what I found strange in the bash history. It seems to be a base64 string. So I threw it into CyberChef.

<figure><img src="https://miro.medium.com/v2/resize:fit:628/1*iN9LGocQdVXfdQVGR35o6w.png" alt="" height="451" width="628"><figcaption></figcaption></figure>

#### Question 3 <a href="#f546" id="f546"></a>

What is the PID of the suspicious process?

#### Answer 3 <a href="#id-2f02" id="id-2f02"></a>

Using the following command:

```
linux_pstree
```

I was able to see the processes that were running at the time of capture. Some of which stood out to me as strange, insmod and ncat. insmod stood out since it was something that was in the bash history, but that wasn’t correct. ncat on the other hand, otherwise known as netcat, is a suspicious command for a regular user to use.

```
.ncat                2854                           
..bash               2876                           
...python            2886                           
....bash             2887                           
.....vim             3196 
```

#### Question 4 <a href="#id-4d46" id="id-4d46"></a>

The attacker downloaded a backdoor to gain persistence. What is the hidden message in this backdoor?

#### Answer 4 <a href="#id-5dc0" id="id-5dc0"></a>

I tried a few commands that would enumerate the files within the file system, to no success. So i returned to the bash history to find some clues. There were actually 2 different git clone requests that yielded some answers.

The second, LiME, was a well known repo. But the first git clone request was for a very suspicious PythonBackup.

```
git clone https://github.com/tw0phi/PythonBackup
```

Navigating to the files on github and searching through them all was a little work, but I managed to find a pastebin link. I have known about code that is hidden in plain sight in github files before, you always have to check the scroll bar. To see if there is code that has been spaced out of clear view.

<figure><img src="https://miro.medium.com/v2/resize:fit:651/1*qajR7bIcDn6LSNcv3eP5RA.png" alt="" height="470" width="651"><figcaption></figcaption></figure>

#### Question 5 <a href="#id-65ca" id="id-65ca"></a>

What are the attacker’s IP address and the local port on the targeted machine?

#### Answer 5 <a href="#id-2659" id="id-2659"></a>

I knew I was looking for something to do with ncat, so I used the following command to narrow down any network connections that ncat was using.

```
└─$ python2 vol.py -f dump/dump.mem --profile=LinuxCentos7_3_10_1062x64 linux_netstat | grep ncat
Volatility Foundation Volatility Framework 2.6.1
TCP      192.168.49.135  :12345 192.168.49.1    :44122 ESTABLISHED                  ncat/2854
```

As per the script in the previous question, I knew the port was 12345. The second IP address in this line is the outbound connection, so that is the attackers IP address.

#### Question 6 <a href="#id-124d" id="id-124d"></a>

What is the first command that the attacker executed?

#### Answer 6 <a href="#id-731f" id="id-731f"></a>

Using the help function gave me a list of commands. The following was the most useful:

```
python2 vol.py -f dump/dump.mem --profile=LinuxCentos7_3_10_1062x64 linux_psaux 
```

It gave me a list of processes and commands that had been used alongside them. In this instance I was looking for commands that happened directly after setting up ncat. Giving me this:

```
2854   0      0      ncat -lvp 12345 -4 -e /bin/bash                                 
2876   0      0      /bin/bash                                                       
2886   0      0      python -c import pty; pty.spawn("/bin/bash")  
```

#### Question 7 <a href="#a59b" id="a59b"></a>

After changing the user password, we found that the attacker still has access. Can you find out how?

#### Answer 7 <a href="#bee4" id="bee4"></a>

Heading back to the bash history, there was a key piece of evidence that stood out. The use of vim to edit rc.local, a file that is used to run programs on start up. Not really knowing where to go from here, I needed a hint. Which led to me using the following to extract all the information from the vim usage.

```
python2 vol.py -f dump/dump.mem --profile=LinuxCentos7_3_10_1062x64 linux_dump_map -p 2887 -D dump/files
```

Then from there, I used strings to grab anything readable. From there I looked for any instances of rc.local. There were a couple of mentions, but nothing that lead anywhere. Requiring another hint I found that a base64 string was present and below that an attempt to write over ssh keys.

#### Question 8 <a href="#id-7b41" id="id-7b41"></a>

What is the name of the rootkit that the attacker used?

#### Answer 8 <a href="#id-5281" id="id-5281"></a>

I learnt something new about rootkits for this question, a rootkit uses syscall hooking which involves modifying the system call table to redirect legit functions to malicious ones.

Using this information I used the following command to look for hooked calls:

```
$ python2 vol.py -f dump/dump.mem --profile=LinuxCentos7_3_10_1062x64 linux_check_syscall
```

Giving me the following:

```
64bit 88 0xffffffffc0a12470 HOOKED: sysemptyrect/syscall_callback 
```

#### Question 9 <a href="#ffff" id="ffff"></a>

The rootkit uses crc65 encryption. What is the key?

#### Answer 9 <a href="#id-90bd" id="id-90bd"></a>

Knowing that the rootkit had loaded itself into the kernel. I used the following command to hunt down the above rootkits name.

```
$ python2 vol.py -f dump/dump.mem --profile=LinuxCentos7_3_10_1062x64 linux_lsmod -P | grep -A 10 sysemptyrect
Volatility Foundation Volatility Framework 2.6.1
ffffffffc0a14020 sysemptyrect 12904
        crc65_key=1337tibbartibbar
```

<figure><img src="https://miro.medium.com/v2/resize:fit:481/1*nq83gOSaVQZtu2ObyC_WoQ.png" alt="" height="230" width="481"><figcaption><p>Lab complete! (I skipped the first little screen by accident)</p></figcaption></figure>

This was a tough box for me, I needed a little help towards the end. Knowing a little bit more about rootkits now will help in the future. I was using -h a ton for different commands and I would advice people do the same. Also using the different parameters that volatility provides to grab the exact information needed. Example below:

```
python2 vol.py -f dump/dump.mem --profile=LinuxCentos7_3_10_1062x64 linux_lsmod -h 
```
