187,064 Instructions for One Flag: Reverse Engineering HTB Callfuscated Insane Challenge
The HackTheBox challenge Callfuscated presents a stripped 64-bit ELF binary that requests a password and prints either Correct or Incorrect flag. Inside the binary lies a heavily obfuscated verification routine built from four complementary techniques that survive static analysis but collapse under concrete execution.
The Obfuscation Arsenal
The protection consists of a custom VM whose bytecode resides in a 586-element array called program[]. A dispatcher reads the current program counter, fetches an opcode, and dispatches to handlers. Every arithmetic primitive is further expanded with Mixed Boolean-Arithmetic expressions. Opaque predicates double the control-flow graph with branches whose outcome is known at compile time. Finally, genuine instructions are wrapped inside thousands of call gadgets of the form pop r8; <insn>; call next, producing the 187,064-instruction count mentioned in the title.
Dynamic Reconnaissance
Because all four layers are execution-dependent, the author recorded a full instruction trace using ptrace with PTRACE_SINGLESTEP on a known input. The resulting log contained 187,064 lines together with register values after each instruction inside the image range 0x401000–0x40d000. A separate memory dumper extracted the VM program array and stack frames directly from the running process.
Building a Faithful Emulator
The trace was replayed inside a custom x86-64 emulator written in Python that parsed objdump output and implemented handlers for the thirty opcodes actually encountered. Two notable bugs were corrected during validation:
- rand() is invoked from four distinct call sites (0x409235, 0x40ad5b, 0x40af37, 0x40b10b) for a total of 192 calls; each return address must be calculated as call-site + 5 rather than assuming a single fixed location.
- Operand-size detection used a naïve substring check that incorrectly treated “DWORD PTR” as containing “WORD”, truncating 32- and 64-bit memory accesses.
After these fixes the emulator matched the original trace line-by-line and reached the final instruction at address 0x40b537 with eax equal to 0xffffffff, exactly as the real binary behaves on an incorrect password.
Recovering the VM Semantics
With a working emulator the author dumped the data stack after every dispatch and decoded the 586 VM instructions. The bytecode implements a simple stack machine whose relevant operations are:
- PUSH imm – push constant
- H2 – addition (used to compute input buffer address 0x40f080)
- DEREF – read input byte
- H5 – multiply accumulator by 256
- H7 – add next byte
- G8 / G3 – XOR with per-group constants
Consequently every four input characters are accumulated into a 32-bit big-endian word. Eight such words are XORed with the following constant pairs:
- (0x0915033a, 0x41414141)
- (0x427d7872, 0x11111111)
- (0x30310a00, 0x55555555)
- (0x2a052e32, 0x5a5a5a5a)
- (0xcff5ecdf, 0xaaaaaaaa)
- (0x1914031e, 0x77777777)
- (0xf6f7c6ad, 0x99999999)
- (0x6c6a524e, 0x33333333)
The resulting 32-bit values must all be zero for the password to be accepted. Solving each equation yields the flag bytes directly: HTB{******_**_***_********_*_**}.
Conclusion
The exercise demonstrates that even an extreme combination of VM-based dispatch, MBA, opaque predicates and call obfuscation remains vulnerable once execution is recorded and replayed. All four techniques ultimately depend on concrete runtime values that a faithful emulator can capture and simplify.
Related articles
Automating Malware Reverse Engineering with Local LLMs, PyGhidra and Neo4j Graphs
A researcher has developed an automated pipeline that uses local large language models to analyze decompiled malware code extracted via PyGhidra. The system loads functions, call graphs, strings and imports into a Neo4j graph database to preserve context across hundreds of functions. Each function is sent to a local Qwen3 model running in LM Studio together with its neighboring call-graph context, producing structured JSON output on purpose, IOCs, tags and evasion techniques. Aggregated capabilities and behavioral patterns such as file encryption and C2 communication are then derived through graph queries. Testing on a WannaCry sample from MalwareBazaar processed 195 functions in 126 minutes and correctly identified File Encryption, C2 Communication and Anti-Analysis behaviors with 100 percent confidence. The approach keeps all sensitive indicators inside a local environment and avoids context overflow and censorship issues common with cloud-based models.
GitHub Removes 10,000 Malware Repositories After Public Exposure but Takes No Further Action
An investigation reveals that GitHub hosts thousands of repositories distributing trojanized ZIP archives, many of which have persisted for two years despite the platform's resources. The malicious repositories follow consistent patterns in README files, including specific headings and links to versioned archives hosted on githubusercontent.com. A detailed article and accompanying script published on Hacker News identified over 10,000 such repositories, prompting GitHub to delete only those specific entries. New repositories matching the same patterns continue to appear and remain active, with no additional proactive measures taken by the security team. The situation highlights questions about Microsoft's approach to automated detection and response on its subsidiary platform.
Dolphin X Malware Adds AI Profiler to Rank and Prioritize High-Value Victims After Infection
Dolphin X is a newly identified Windows infostealer and remote access trojan that integrates an AI Profiler component designed to score infected machines and generate priority rankings for operators. The profiler analyzes telemetry from compromised systems, including application usage, browser domains visited, and installed software, to produce daily summaries that help attackers focus resources on the most valuable targets such as those with cloud access or sensitive tools. Dolphin X claims compatibility with over 300 applications, explicitly covering nine Chromium and Gecko browser families, more than 100 cryptocurrency wallet extensions, 65 desktop wallets, 10 password managers, and over 30 common cloud CLI tools. The malware targets files like .env configurations, SSH keys, cloud access tokens, browser sessions, and cryptocurrency wallet data to accelerate movement from initial credential theft to further compromises in accounts and production environments. Researchers have confirmed the AI Profiler workflow and associated scoring functions in the operator panel, although the underlying AI model itself remains unverified without full analysis of an active sample. The discovery highlights how automated prioritization can significantly shorten the time between mass infections and targeted follow-on attacks, prompting recommendations for reduced local credential storage and enhanced behavioral detection.
YARA Style Guide: Comprehensive Best Practices for Naming, Structuring and Maintaining Detection Rules
The article presents a detailed translation and adaptation of Florian Roth's YARA Style Guide, aimed at bringing consistency to large collections of YARA rules used by security teams. It explains how to construct informative rule names that include threat category, context, operating system, architecture, technology, packers and creation date, using prefixes such as MAL, HKTL, WEBSHELL, EXPL, VULN, SUSP and PUA. The guide recommends specific metadata fields including description, author, date, reference, score and hash, along with a three-tier string categorization system using $x*, $s* and $a* prefixes for high-specificity, group and preliminary strings. It also covers false-positive filters marked with $fp*, proper indentation, readable hex and string formatting, and a recommended order of conditions that begins with header checks and ends with false-positive filters. The publication highlights the benefits of this structured approach for long-term maintainability and faster triage during mass detections. Additional references point to the separate YARA-Performance-Guidelines project for deeper optimization techniques.