Payload
Payload
Platform: HackTheBox | Type: SOC/DFIR | Difficulty: Easy | Author: D3v0o0Nu11 | Date: 2026-02-10
Scenario
You’ve completed Training Day — congrats, rookie. Now the real game begins. An unmarked binary just landed on your desk. It’s acting shady, tripping a few alarms, but no one's sure what it really is. Malware? Or just a misunderstood piece of code? Your mission: reverse-engineer the program, trace its behavior, and uncover the truth. Every line of code could be a clue—or a trap. Welcome to your first real case.
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 case, we were tasked with investigating a suspicious binary that triggered multiple alarms upon execution. Ex... | |
| — | When the binary was executed, it only displayed a simple dialog box stating HTB pwned us No other immediate modif... | |
| — | Loading the binary into PEstudio allowed us to identify its hash, as well as review the imported and exported functio... | |
| — | We also identified that the binary is 64-bit, and two imports, VirtualProtect and VirtualQuery were flagged as malici... | |
| — | Upon reviewing the strings in PEstudio, we were able to clearly identify the compiler used for the binary, which is *... | |
| — | To identify information related to compilation datetime, I used radare2 with flag -I to shows for binary info (in... | |
| — | This binary was compiled as a 64-bit Windows console application. It has stack canaries enabled and NX/DEP protection... | |
| — | Based on our previous findings, the binary was compiled with ASLR (Address Space Layout Randomization) disabled. | |
| — | There are many ways to identify the image base address, you may use decompiler or debugger. However, in this case I w... | |
| — | At the top right, we can see the image base address of the binary along with its entry point address. | |
| — | Another useful tool to highlight is CFF Explorer, which is widely used for binary triage and analysis. | |
| — | Inside parsed header section, we can identify the address of the binary's entrypoint. |
Evidence Analysed
- Tools: strings, ghidra, gdb, radare2.
- Artifacts: memory, jump, dump.
Detailed Investigation
-
In this case, we were tasked with investigating a suspicious binary that triggered multiple alarms upon execution. Extracting the malware archive revealed a single file named func_pointer.exe.
-
When the binary was executed, it only displayed a simple dialog box stating HTB pwned us No other immediate modifications were visibly observed. This behavior is interesting, as it suggests that the malware may be designed to execute post-exploitation activities in a stealthy manner.
1ST QUESTION -> ANS: REDACTED
- Loading the binary into PEstudio allowed us to identify its hash, as well as review the imported and exported functions that could raise suspicion. In addition, analyzing the embedded strings provided further context, which may assist in attribution efforts or serve as a quick triage step to infer the potential objectives of the binary.
- We also identified that the binary is 64-bit, and two imports, VirtualProtect and VirtualQuery were flagged as malicious. It is important to note, however, that not all imports marked as malicious should be considered inherently suspicious. Many Windows APIs are legitimate but frequently abused by malware, which often leads automated tools or triage utilities to flag them as potentially malicious.
2ND QUESTION -> ANS: REDACTED
- Upon reviewing the strings in PEstudio, we were able to clearly identify the compiler used for the binary, which is MinGW. Numerous compiler-related strings referencing MinGW were present throughout the binary.
3RD QUESTION -> ANS: REDACTED
-
To identify information related to compilation datetime, I used
radare2with flag-Ito shows for binary info (including its protections). -
This binary was compiled as a 64-bit Windows console application. It has stack canaries enabled and NX/DEP protection, which prevent straightforward stack buffer overflows and execution of injected shellcode from data pages. However, it lacks ASLR support (no relocations, not PIC), meaning the memory layout is mostly predictable.
4TH QUESTION -> ANS: REDACTED
- Based on our previous findings, the binary was compiled with ASLR (Address Space Layout Randomization) disabled.
5TH QUESTION -> ANS: REDACTED
- There are many ways to identify the image base address, you may use decompiler or debugger. However, in this case I will use
Detect-it-Easy (DIE)which commonly used to identify a file type along with heuristic analysis. - At the top right, we can see the image base address of the binary along with its entry point address.
6TH QUESTION -> ANS: REDACTED
- Another useful tool to highlight is CFF Explorer, which is widely used for binary triage and analysis.
- Inside parsed header section, we can identify the address of the binary's entrypoint.
7TH QUESTION -> ANS: REDACTED
-
To speed up the triage, I began by searching for code that attempts to obtain a handle to a DLL and store the address of its functions. This is so could quick reveals the intent of the binary.
-
This search led to the identification of the function
FUN_140001d97. -
Long story short, after reviewing each nested functions, identified
FUN_1400017d0as the function of primary interest. -
Inside, it performs a simple bitwise operations actually. It's just a textbook XOR-based encryption / decryption.
-
However, the analysis revealed suspicious behavior when
param3was identified as a string buffer. Upon inspecting its contents, we observed the presence of encrypted strings. This indicates that, prior to obtaining the handle of a DLL and resolving its functions, the binary performs a payload decryption routine.
PAYLOAD LOCATION
PAYLOAD CONTENT
- At this stage, we were able to clearly identify the first 8 bytes of the payload. In addition, another useful tool for static binary analysis is
PE-Bear, which provides greater visibility into the encrypted payload structure and its characteristics.
PAYLOAD IS STORED AT .DATA SECTION (Global Initialized Variable)
8TH QUESTION -> ANS: REDACTED
- Reviewing the previously identified decrypt function for the payloads. Notice
param1is treated as a pointer to a buffer of bytes,param2iiis used as a modulus, means the function keeps wrappoing around inside that buffer. - It means
param1is a key material buffer, which is indexed repeatedly to generate the keystreamlocal_1dthat XORs againstparam3.
KEY BUFFER LOCATION
KEY BUFFER CONTENT
- Great! Now we also identified the key buffer used (in hex).
9TH QUESTION -> ANS: REDACTED
-
To identify the address of the decrypted payload, we should debug the binary. To debug it I used
x64Dbg. -
At first, load the binary there and press
run to user codeso we jumped to the binary's entrypoint. -
Next, right-click and follow the steps below. Since our objective is to begin debugging at the payload decoding phase, we should first locate the key buffer offset and set breakpoints there. Additional breakpoints can also be placed throughout the debugging process, as this may help us identify more accurate offsets for analysis.
RESULT AFTER JUMPED TO KEY BUFFER
-
After set breakpoint(s), just click the run button to jump there (it act like continue in GDB).
-
To identify the content, we can follow the dump by right click and follow these steps:
-
The full debugging steps are not shown here, as they would be too lengthy. The main objective is to identify where the decrypted value is stored.
-
Once this location is identified, another breakpoint can be set to track that section or register, and the dump can then be followed again in xDbg.
-
I recommend always comparing the logic with the assembly view in Ghidra, as this provides better context for identifying which instructions should be prioritized during debugging.
-
In short, we identified the actual offset where the decrypted payload is stored. Based on our findings, the encrypted payload resides in the .DATA section. Therefore, the debugging focus should be narrowed to mov instructions that interact with the data segment (ds).
-
To examine the content value and its address, it is best to begin the review at the cmp instruction. For this purpose, we set a breakpoint at offset
0x1400019A4and then followed the dumps starting at offset0x14000199B. Now we can see that the address of the decrypted payload is stored at0x5FFC40, asds:[RDX]is used to hold each decrypted payload buffer index and, in turn, points to this address. -
At this stage, we can skip the previous breakpoint and set a new one at
0x1400019B4, then follow the dumps at0x1400019AF. From there, by examining offset0xFFC40and the subsequent addresses, we can identify the entirety of the decrypted payload.
10TH QUESTION -> ANS: REDACTED
- Based on our previous findings, we can clearly identify in the dump that the first 8 bytes of the payload reside at
0x5FFC38 + 0x8, spanning up to offset0x5FFC48.
11TH QUESTION -> ANS: REDACTED
- Continuing the review of invoked functions after the DLL handle retrieval, we identified a call to
VirtualAllocEx(), which was notably absent from the Import Address Table (IAT) displayed in PEstudio.
IN PESTUDIO
- While reviewing the code in Ghidra, we found that several other Windows API functions were also not identified by PEstudio. This occurs due to the way the code is written: these functions are resolved dynamically at runtime, so they do not appear in the static Import Address Table (
.idatasection).
NOTE:
Snippet code for dynamic resolve:
// C code.
pHVar1 = GetModuleHandleA("kernel32.dll");
pHVar1 = GetProcAddress(pHVar1, "VirtualAllocEx");
- Great! We've briefly 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 — As documented in the investigation steps.
MITRE ATT&CK Mapping
| Tactic | Technique | ID |
|---|---|---|
| Exfiltration | Exfiltration Over C2 Channel | T1041 |
| Impact | Data Encrypted for Impact | T1486 |
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
Lessons Learned
- Using
PEStudio,DIE,Ghidra,CFF Explorer,PE Bear, andradare2to conduct static windows binary analysis and triage. - Using
x64dbgto conduct dynamic binary analysis.