Tuesday, August 11, 2026
LIVEThe Unrelenting Cyber Battle: Hacking Threats and the Imperative of Robust Data Protection///Navigating the Cyber Labyrinth: Bolstering Defenses Against Evolving Hacking Threats///The Dual Front War: Battling Hacking and Bolstering Data Protection in the Digital Age///The Ever-Evolving Cyber Threat Landscape: Navigating Hacking and Fortifying Data Protection///The Unseen Battle: Fortifying Data in an Age of Relentless Hacking///The Unseen War: Hacking's Relentless Advance and the Imperative of Data Protection///The Evolving Threat Landscape: Hacking, Data Protection, and the Imperative for Proactive Security///Navigating the Digital Minefield: Bolstering Data Protection in an Era of Relentless Hacking///The Dual Fronts of Digital Defense: Combating Hacking and Fortifying Data Protection///Hacking's New Frontier: Fortifying Data Protection in the Age of Advanced Cyber Threats///The Dual Front: Navigating Hacking Threats and Fortifying Data Protection in the Digital Age///Navigating the Digital Gauntlet: The Evolving Nexus of Hacking and Data Protection///The Unrelenting Cyber Battle: Hacking Threats and the Imperative of Robust Data Protection///Navigating the Cyber Labyrinth: Bolstering Defenses Against Evolving Hacking Threats///The Dual Front War: Battling Hacking and Bolstering Data Protection in the Digital Age///The Ever-Evolving Cyber Threat Landscape: Navigating Hacking and Fortifying Data Protection///The Unseen Battle: Fortifying Data in an Age of Relentless Hacking///The Unseen War: Hacking's Relentless Advance and the Imperative of Data Protection///The Evolving Threat Landscape: Hacking, Data Protection, and the Imperative for Proactive Security///Navigating the Digital Minefield: Bolstering Data Protection in an Era of Relentless Hacking///The Dual Fronts of Digital Defense: Combating Hacking and Fortifying Data Protection///Hacking's New Frontier: Fortifying Data Protection in the Age of Advanced Cyber Threats///The Dual Front: Navigating Hacking Threats and Fortifying Data Protection in the Digital Age///Navigating the Digital Gauntlet: The Evolving Nexus of Hacking and Data Protection///
Subscribe
Cyber Security
Independent · Digital
Thehackingpost
CybersecurityAI-assisted

PDFly Variant Uses Custom PyInstaller Tweaks to Obfuscate Payload, Thwarting Analysis

## Cybersecurity: Analysis of PDFly Malware

Cybersecurity: Analysis of PDFly Malware

A newly identified malware variant, termed "PDFly," utilizes a significantly modified PyInstaller stub to conceal its Python bytecode. This modification requires analysts to reverse-engineer a custom decryption routine before conducting any substantial analysis.

A related sample, "PDFClick," exhibits similar behavior, suggesting the existence of a small group of PyInstaller-based droppers designed to disrupt standard analysis tools.

Both "PDFly" and "PDFClick" are distributed as executables packaged with PyInstaller. Typically, analysts use tools like pyinstxtractor-ng to extract the embedded Python modules. However, in these cases, the extractor does not recognize the files as PyInstaller executables due to an altered "magic" cookie in the overlay.

Upon inspection with IDA Pro, it was found that the stub's strings were partially corrupted and the cookie value was modified in memory.

To address these challenges, a researcher modified pyinstxtractor-ng by replacing the script's expected magic value with the custom cookie found in the modified stub. Furthermore, an assertion checking for the "PYZ\0" marker within the package was removed, as it was unnecessary for extraction. Despite these modifications, the contents of the PYZ archive remained encrypted.

A newly identified malware variant, termed "PDFly," utilizes a significantly modified PyInstaller stub to conceal its Python bytecode.
Benjamin Scott · Thehackingpost

Static inspection using tools like CAPA and IDAScope did not reveal any encryption routines within the stub, indicating that decryption was implemented elsewhere. The analysis shifted focus to the bootstrap and pyimod modules, which were not encrypted and could be decompiled.

Using PyLingual, the researcher processed Python 3.13 bytecode from pyimod01_archive.pyc and discovered a custom two-stage XOR scheme wrapped around zlib decompression. The disassembly showed an XOR operation with a 13-byte key followed by zlib decompression and a second XOR operation with a 7-byte key before reversing and unmarshalling.

By incorporating this sequence into pyinstxtractor-ng, the analyst successfully extracted and decrypted the embedded Python bytecode from both PDFly and PDFClick.

Given the variations in cookies and XOR keys across samples, a more generic extractor was developed. This tool scans the PE overlay to identify possible PyInstaller cookies by validating length fields and table-of-contents offsets, dynamically recovering the magic value.

Advertisement

Additionally, a routine parses pyimod01_archive.pyc with Python's marshal module, explores the ZlibArchiveReader.extract method, and automatically extracts XOR keys from <genexpr> constants.

These enhancements allow the modified script to adapt to various PyInstaller-modified samples, effectively recovering their encrypted Python payloads and facilitating further behavioral analysis of PDFly and related threats.

Based on reporting by GBHackers.

AI transparency. This article was produced with the assistance of artificial intelligence and published under human editorial oversight. AI systems can make mistakes. Read how we use AI (EU AI Act, Art. 50).
Related Stories