HabrJuly 27, 2026🇷🇺Translated from Russian

Automating Malware Reverse Engineering with Local LLMs, PyGhidra and Neo4j Graphs

A researcher has built an automated system that combines PyGhidra, Neo4j and a local large language model to speed up the initial analysis of malicious binaries. The project addresses the main drawbacks of sending decompiled code to cloud LLMs: leakage of indicators of compromise, possible censorship of sensitive modules, and rapid context overflow when a sample contains 100–200 functions.

Architecture and data flow

The pipeline begins with ghidra_extractor.py, which uses PyGhidra to disassemble and decompile a binary without launching the Ghidra GUI. For every function the extractor records its address, name, size, cyclomatic complexity, decompiled C pseudocode (truncated at 6000 characters with a 30-second timeout), call-graph neighbors, string references and imported API calls. Metadata such as PE format, architecture and all standard file hashes are also stored. All extracted entities are loaded into Neo4j as distinct node types: Sample, Function, String, Import, Analysis, Capability and Behavior.

Next, worker.py and mcp.py iterate over functions and send each one to a locally hosted Qwen3 model running inside LM Studio. The prompt includes both the decompiled code and the function’s position in the call graph, allowing the model to understand caller-callee relationships. The model returns structured JSON describing the function’s purpose, extracted IOCs, tags, network indicators, command-line usage and anti-analysis techniques.

aggregator.py then aggregates tags across all functions into Capability nodes that carry a strength weight reflecting how often each capability appears. builder.py combines these capabilities with the call graph to detect higher-level behavioral patterns such as file encryption combined with network activity. Finally, generator.py produces a human-readable report by querying the enriched graph.

Graph data model

Storing functions in a flat table makes it difficult to answer questions such as whether five anti-debug functions call one another. In the Neo4j model a Function node is connected to other Function nodes via CALLS edges, to String nodes via REFERENCES edges, and to Import nodes via USES edges. Capability and Behavior nodes sit above the function level and are linked through weighted relationships, enabling concise Cypher queries instead of recursive joins.

Validation on WannaCry

The pipeline was tested on a WannaCry sample obtained from MalwareBazaar. Processing 195 functions took 126 minutes on a machine with 60 GB RAM and an Nvidia 5070 Ti. The generated report identified three behavioral patterns with 100 percent confidence: File Encryption (supported by 40 functions), C2 Communication and Anti-Analysis. A publicly available YARA rule confirmed the anti-debug findings discovered by the system.

The complete source code is available in the repository Dvoranchik/MLMalwareAnalyzer. Future work will focus on refining call-graph traversal and prompt engineering to surface additional indicators.

Related articles

HabrMalware & Botnets

TRON, Aptos and BSC in One Infection Chain: JavaScript Loader Linked to ChainVeil Campaign

Researchers at Checkmarx examined the ChainVeil campaign that used npm packages to distribute multi-stage JavaScript loaders. A newly discovered sample appeared in a GitHub repository recommended by an AI agent, where the file navigation.js contained an obfuscated loader that matched the campaign's techniques. The loader retrieves encrypted payloads from TRON, falls back to Aptos, and then uses the extracted data as a BSC transaction identifier to fetch the next stage. C2 infrastructure and final RAT functionality aligned exactly with previously published indicators, except for the campaign identifier A9-0554-3 instead of the A6-* markers seen in npm samples. Git history showed the malicious code was inserted via a merge commit on 29 March 2026, months before the first known npm packages appeared in May. The findings indicate that npm was never the only distribution channel for ChainVeil and that the campaign's blockchain-based delivery mechanism has been active since at least early 2025.

HabrMalware & Botnets

Malinsure Cybercrime Group Deploys SafeMostSSH Backdoor via Phishing Lures Mimicking Russian Insurance Updates

Researchers from F6 identified a previously unknown cybercrime cluster named Malinsure that has been active since at least July 2026. The group distributes phishing emails containing PDF lures themed around voluntary medical insurance (DMS) discounts and updates from Russian insurance companies. Victims are tricked into downloading RAR or ZIP archives that abuse legitimate Microsoft binaries such as winword.exe and powerpnt.exe through DLL side-loading to execute the custom SafeMostSSH backdoor. The malware establishes a persistent reverse SSH tunnel to attacker-controlled servers and retrieves fresh C2 addresses from public posts on vc.ru by decoding fake PNG links. Additional delivery vectors include HTML and SHTML files that decode and drop archives containing the same payload components. Targets appear to include insurance, finance, and fuel-energy sector organizations, with infrastructure also referencing gosuslugi.email and minfin.support domains.

AntiMalwareMalware & Botnets

Compromised Chromium Extensions Push Malware Through Fake Critical Update Alerts

Users of Chromium-based browsers including Chrome, Brave, and Opera have encountered persistent pop-up windows demanding immediate browser updates. These alerts originate from compromised extensions that dynamically load malicious VBS scripts or EXE files instead of delivering legitimate updates. The deceptive messages appear during normal browsing and instruct users to download and manually execute suspicious files. Earlier incidents were traced to the QuickLens extension, while current reports implicate Enable Right Click & Copy Smart Unlock + OCR and similar utilities still available in the Chrome Web Store. Attackers achieve persistence by purchasing popular extensions or hijacking developer accounts to push malicious updates. Full system scans often fail to detect the threat because the browser itself remains clean until the user triggers the payload. Security experts recommend verifying updates exclusively through the browser's built-in menu rather than clicking any on-screen prompts.

AntiMalwareMalware & Botnets

Palo Alto Networks Unit 42 Uncovers Kimwolf v7 Botnet Infecting Android Set-Top Boxes via Open ADB

Researchers at Palo Alto Networks Unit 42 have identified Kimwolf v7, an updated botnet that compromises Android set-top boxes and other IoT devices to conduct DDoS attacks. The malware now employs HTTP/2 flooding with realistic browser fingerprints to blend malicious traffic with legitimate user activity. Command-and-control infrastructure is hardened through Ethereum Name Service lookups and public Ethereum RPC services, with a Tor fallback address embedded in the binary. Operators have removed scanning, exploitation, and brute-force capabilities from this version, indicating a division of labor where a separate loader handles initial infection. The botnet uses 15 numbered methods focused on high-performance UDP floods optimized for ARM processors. Infections typically occur through residential proxies targeting devices with open Android Debug Bridge on port 5555, after which the malware masquerades as system processes. Unit 42 advises treating Android set-top boxes as untrusted devices and disabling ADB or restricting it to USB access only.