top of page

šŸ” Sherlock Scenario: Investigating a Malware Intrusion

  • BlueDolphin
  • Aug 20
  • 4 min read

🧩 Attack Summary

In this Sherlock Scenario, you step into the role of a SOC analyst investigating a suspected intrusion. By analyzing suspicious network activity and file artifacts, we’ll uncover how attackers weaponized a document, staged malware, and achieved command-and-control (C2).


The investigation revealed the following attack chain:


Weaponized Document (SMB)

↓

Suspicious VBS Download

↓

Malware Resource Development

↓

Multiple File Downloads

↓

De-obfuscation & Reverse Shell

↓

C2 Communications

Attack Steps

  1. Weaponized document retrieved via SMB

  2. Malware stages resources & downloads four filesĀ (nrwncpwo, test2, jvtobaqj, ozkpfzu)

  3. Files unpack & de-obfuscate, establishing a reverse shell

  4. C2 communications initiatedĀ back to the attacker infrastructure

ree



🧩 Clue 1 — Suspicious VBS File

  • Observed

    Investigation

    • The first 20 packets show an admin user authenticatingĀ and establishing an SMB connection.

    • Immediately after, the file AZURE_DOC_OPEN.vbsĀ was downloaded.

    Why It’s Suspicious

    • External SMB connections are rare in legitimate workflows.

    • Downloading a VBS scriptĀ from an unknown host is a strong indicator of malicious activity.


A VBS script AZURE_DOC_OPEN.vbs was download from domain escuelademarina.com | 165.22.16.55.

ree

Looking at the first 20 packets reveals allot of information. First, we see that a user authenticates as admin. From here the user establishes a file share or SMB connection to escuelademarina and attempts to download files. The file "Azure_Doc_open.vbs is downloaded.


🧩 Clue 2 — Suspicious Downloads

Looking deeper into downloads:

  • SMB filterĀ showed little else.

  • HTTP filterĀ revealed multiple downloads from domain badbutperfect[.]com.

  • The URIs were arbitrary strings (/nrwncpwo, /ozkpfzu), except test2.


File

Behavior

Notes

nrwncpwo

Script that downloads additional files

Initial stage downloader

test2.exe

Binary searching for AHK script

Executes payload

jvtobaqj

Appears as nonsense text

Obfuscation, contains DLL calls

ozkpfzu

Hex-encoded data

Decodes to strings, possible payload

ree

Here I wanted to look for other downloads so I decided to filter for SMB downloads which revealed little. However when I filtered for HTTP downloads I found several interesting files warranting further investigation.


This only shows me client requests to the badbutperfect domain. The URI paths were odd and seemed arbitrary except for "test2".


/nrwcpwo appears to be a script that downloads the other files.
/nrwcpwo appears to be a script that downloads the other files.

test2.exe
test2.exe

filename="jvtobaqj" - at first appeared to be non sense. Just words mashed together. However I noticed that all the non sense had been commented out and in between were commands to allocate memory or parts of a command such as DLL calls as seen below.

ree

Filename ozkpfzu appeared to be hex data and when running through cyberchef with Hex decoding there were a few readable strings.

ree


🧩 Clue 3 — Script Analysis

The attackers used a multi-stage process to obfuscate and execute their payload.


Step 1: Downloader (nrwncpwo)

  • Beautified using CyberChef → revealed it staged the other downloads.


Step 2: Executable (test2.exe)

  • Renaming to .exeĀ and running showed it looked for an AHK script.

  • The AHK script had filler text, but when stripped out revealed shellcode loading logic.


Step 3: AHK Script Execution Flow

Script Behavior (Simplified)

  1. Reads payload from test.txtĀ (hex-encoded shellcode).

  2. Allocates executable memoryĀ with VirtualAlloc.

  3. Copies payload byte-by-byteĀ into allocated memory.

  4. Executes the payload directly.


These files are all related and we need to figure out how they work together.

ree

This is the nrwncpwo file from earlier. I have put the code through Cyber chef's beautifier and syntax highlighter to clean it up.

Renaming the file test2 to test2.exe and running the program reveals it is looking for the ahk script. We observed this script earlier when looking through the wireshark capture and following the stream specific to the GET requests.

ree

From here the binary calls the ahk script. Remember how the ahk script had all that non sense filler? If we parse out the nonsense this is what we are left with.


šŸ” Script Overview


The script:

  1. Reads a fileĀ (test.txt) containing the attackers payload in hex.

  2. Allocates memoryĀ with execute permissions.

  3. Copies the payload byte-by-byteĀ into the allocated memory.

  4. Executes the payloadĀ by calling the memory address directly.





Why It’s Dangerous

  • Allocating memory with PAGE_EXECUTE_READWRITEĀ bypasses typical OS protections.

  • This is a classic fileless execution techniqueĀ used to inject shellcode directly.

ree

🧩 Clue 4 — Command & Control


Finally, traffic analysis revealed DarkRAT malware beaconing out:

  • Protocol:Ā HTTP POST

  • Destination:Ā badbutperfect[.]com

  • Behavior:Ā Remote access & persistence via RAT infrastructure


This confirms that the intrusion led to successful C2 communication.


ree

šŸ“Œ Analyst Lessons Learned

  1. Suspicious SMB activityĀ (file shares + VBS downloads) should be treated as high-priority alerts.

  2. Nonsense or filler textĀ in scripts often hides real payloads — strip and re-analyze.

  3. AutoHotkey scriptsĀ can be abused for memory injection and shellcode execution.

  4. HTTP POST traffic to unknown domainsĀ can indicate RAT beaconing.

  5. Build detection rules for:

    • VirtualAllocĀ with PAGE_EXECUTE_READWRITE

    • SMB downloads of script files

    • Arbitrary URI requests to external domains


šŸ Conclusion

  1. By piecing together network clues and unpacking scripts, we traced the attack from a weaponized SMB documentĀ to a DarkRAT C2 connection. This scenario highlights the importance of structured analysis: start with the network, pivot to files, dissect scripts, and always correlate with outbound traffic.

    In real-world operations, this methodology helps analysts move from initial detection to confirmed attribution quickly and confidently.



THE END

Ā 
Ā 
Ā 

Comments


bottom of page