---
description: Guide on how to successfully hunt down a Pay2Key infected Windows machine.
---

# Hunting Pay2Key

Like lesson 1, search for encrypted files in any of the Users directories by using common encrypted extensions for Pay2Key. ".Pay2Key" or ".enc" are the most common extensions to look for when it comes to Pay2Key ransomware.

```
SELECT * FROM file WHERE path LIKE "C:\Users\%%" AND filename LIKE "%.enc"
```

![Successful .enc Extension Query](https://776002387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbJAvxfpcYDlqBJLNIwwX%2Fuploads%2F66GiC7RYO6AZXIBdr94P%2Fenc%20files.jpg?alt=media\&token=4c0eb764-df34-4e5b-b217-85c2f950c4f7)

Check champuser's user directory for any ransomware messages that include "MESSAGE.TXT" as that will be included in the filename of any ransom message dropped on a Pay2Key infected Windows machine.

```
SELECT * FROM file WHERE path LIKE "C:\Users\champuser\%%" AND filename LIKE "%MESSAGE.TXT"
```

!["SALAM\_MESSAGE.txt" on champuser Desktop](https://776002387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbJAvxfpcYDlqBJLNIwwX%2Fuploads%2FZ4PyvrF08Dv3gc3lafIX%2FP2K%20Ransom%20Message.jpg?alt=media\&token=327a5209-688f-4a71-8986-a9a786e52953)

Next, look for any files in either the Windows Temp directory, IME directory, or users directory for anything pertaining to the word "cobalt". The Pay2Key ransomware launches from an executable that contains the word "cobalt" and can leave logs with that word in it as well.

```
SELECT * FROM file WHERE path LIKE "C:\Users\champuser\%%" AND filename LIKE "cobalt%%" 
```

![Pay2Key Logs Found at "Cobalt.Client.exe.log"](https://776002387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbJAvxfpcYDlqBJLNIwwX%2Fuploads%2FWM9hJ7LzpaI85I2S17ww%2Fp2k%20cobalt%20log.jpg?alt=media\&token=1bc1d79f-3f02-4c14-bdf1-f3f464c5f882)

From these files, find out the time they were modified and pull logs from that time to see suspicious logs (April 19, 2022, around 12:46 AM GMT).

```
SELECT * FROM windows_eventlog WHERE channel="Security" AND datetime LIKE "2022-04-19T00:46%%";
SELECT * FROM windows_eventlog WHERE channel="Application" AND datetime LIKE "2022-04-19T00:46%%";
SELECT * FROM windows_eventlog WHERE channel="System" AND datetime LIKE "2022-04-19T00:46%%"
```

![Windows Logs Showing Login of Champuser and Windows Defender Being Turned Off During Attack](https://776002387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbJAvxfpcYDlqBJLNIwwX%2Fuploads%2FuLfDW5z6uV7URjvODecf%2FLogs%20From%20P2K%20Attack.jpg?alt=media\&token=7158b535-8549-4879-a086-b48999ee86a4)

From these logs, it can be seen "champuser" was logged into and Windows Defender was turned off during that time period. The status of Windows Firewall may also be in question if it was turned off, check the status of it with the following query.

```
SELECT * FROM windows_security_products WHERE name="Windows Firewall"
```

![Windows Firewall State Set to "Off"](https://776002387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbJAvxfpcYDlqBJLNIwwX%2Fuploads%2F1nZSGlsCWxD3sQsuSsAh%2FWindows-Firewall-Check.jpg?alt=media\&token=2b980173-bc83-40ef-a202-ecc6a14c791e)

Lastly, search for prefect files, as it is possible that some executables that were ran on this compromised system were deleted after execution. Use the following query to search for Pay2Key files in the Windows prefetch directory.

```
SELECT * FROM file WHERE path LIKE "C:\Windows\Prefetch\cobalt%%" or path LIKE "C:\Windows\Prefetch\psexe%%"
```

!["COBALT.CLIENT.EXE" and "PSEXESVC.EXE" Prefetch Files Found](https://776002387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbJAvxfpcYDlqBJLNIwwX%2Fuploads%2FprO1HHql5anRpNJ5c3mj%2Fprefetch-files.jpg?alt=media\&token=dde313e9-eacd-4744-a68b-fde51ed99e19)
