HabrJuly 22, 2026🇷🇺Translated from Russian

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

BoletimSecMalware & Botnets

Google Play Apps Hide Anatsa Banking Trojan Using Stealthy Loaders

Malicious applications distributed through Google Play are employing stealthy loaders to install the Anatsa banking trojan for Android, putting victims' financial accounts at risk. The campaign relies on seemingly legitimate programs to conceal the initial infection stage, with one identified case involving a modified PDF reader that displays a fake update prompt to trick users into installing an additional component. Another loader discovered in the Cleanova application collects data from analytics SDKs, including installation source details, and forwards this information to a command-and-control server. The server then decides whether to deliver the malicious payload based on predefined criteria, leaving the code inactive for non-targeted victims to evade automated analysis. Once Anatsa is installed, the threat can facilitate theft of credentials used for financial services and enable fraudulent transactions. Banking trojans represented 30.77 percent of detected malicious mobile applications in the second quarter of 2026, during which more than 1.99 million attacks involving malware, adware, or unwanted programs were blocked and 93,574 banking trojan installation packages were identified.

AntiMalwareMalware & Botnets

Android Banking Trojans Hide in Droppers to Bypass Google Play Checks

Kaspersky solutions blocked 1.99 million attacks involving Android malware, adware and potentially unwanted programs in the second quarter of 2026, down from 2.68 million the previous quarter. Researchers still recorded 304,000 malicious installation packages, among them 93,600 banking trojans that retained the largest share at 30.77 percent. Operators increasingly rely on droppers that pass initial store review and later download the real payload. One PDF reader application distributed through Google Play displayed a fake update prompt that installed the Anatsa banking trojan. The Cleanova dropper collected installation-source data and delivered its payload only under attacker-chosen conditions, avoiding analysis environments. The share of users hit by Trojan-Dropper.AndroidOS.Banker.dd rose sharply from 0.01 percent to 2.16 percent, while the Mamont and Creduz families continued to expand with new variants.

HabrMalware & Botnets

Reverse Engineering Tutorial Explores Hybrid Analysis of Linux x86-64 Crackme Using Ghidra and GDB

A detailed three-part tutorial series examines the crackme binary Getting started keygen by Mazzotti on Linux x86-64. The first installment covers initial file inspection with file and strings utilities, identification of the ELF format and PIE properties, and loading the stripped binary into Ghidra to locate the entry point and main function. Analysts reconstruct stack frames, resolve optimized prologues, and correct Ghidra's variable sizing errors through dynamic confirmation in GDB. The series emphasizes hybrid static-dynamic methodology: decompiler hypotheses are tested with breakpoints and memory examination, then fed back to refine types and structures. Future parts will cover mutation testing, hidden C++ structures, and full Python reconstruction of the validation algorithm without patching branches.

HabrMalware & Botnets

DDoS-Guard Reports Record 540,000 L7 Attacks in June 2026 Amid Botnet Fragmentation

DDoS-Guard recorded a sharp 70% increase in L7 attacks during Q2 2026, with June alone seeing 540,000 incidents. Global volumetric attacks doubled compared to all of 2025, including peaks of 1.64 Tbps and 1.58 Tbps. Law enforcement dismantled four major IoT botnets—Aisuru, KimWolf, JackSkid and Mossad—in March, yet long-duration L7 campaigns surged 380%. Attackers shifted focus to application-layer exhaustion using browser automation and AI agents while targeting HR platforms and news sites. Europol’s Operation PowerOFF led to 75,000 warnings and 53 domain takedowns across 21 countries. Experts attribute the June spike to attacks aimed at protection providers themselves rather than single domains.