Within the second installment of the “Creation of Configuration Extraction” sequence, safety researchers have unwrapped QuasarRAT, a widely-deployed .NET distant entry trojan (RAT), revealing subtle strategies for extracting its encrypted configuration from each clear and obfuscated binary samples.
The evaluation demonstrates a reproducible methodology utilizing Jupyter Pocket book, pythonnet, and dnSpy, offering cybersecurity professionals with sensible instruments to fight this persistent menace.
QuasarRAT, initially launched in 2014 beneath the title xRAT, represents a major problem within the cybersecurity panorama.
Revealed on GitHub as an ostensibly legit Home windows distant administration instrument, the open-source RAT has been systematically weaponized by cybercriminals and nation-state actors alike.
JPCERT’s complete presentation at Botconf 2020 documented the malware’s evolution, cataloging quite a few variants and their increasing capabilities throughout a number of assault campaigns.
Carried out in C# on the .NET Framework, QuasarRAT’s accessibility has made it a favourite amongst menace actors.
The malware helps an in depth array of distant administration features, together with system reconnaissance, file manipulation, distant desktop viewing, keylogging, and arbitrary command execution.
Whereas these capabilities theoretically serve legit administrative functions, researchers have noticed QuasarRAT deployed in cyber espionage operations, unauthorized surveillance campaigns, and intrusions orchestrated by each impartial menace actors and state-aligned teams.
Technical Structure
The configuration extraction methodology depends on a complicated evaluation atmosphere combining a number of specialised instruments.
At its basis, the framework employs dnlib, an open-source .NET library designed for deep inspection and modification of .NET assemblies.
This library exposes metadata, varieties, strategies, attributes, and Intermediate Language (IL) directions programmatically, enabling granular malware evaluation.
The evaluation atmosphere integrates pythonnet as a vital bridge, permitting Python code to invoke dnlib’s APIs seamlessly.
This mixture allows researchers to decompile particular person features, traverse meeting buildings together with namespaces, courses and strategies, and extract customized varieties, metadata entries, and embedded strings.
Your entire configuration has been containerized with Docker, guaranteeing portability and reproducibility throughout totally different evaluation environments.
IL, often known as Microsoft IL (MSIL) or Frequent IL (CIL), operates as a stack-based intermediate bytecode.
The stack machine structure means directions push values onto a stack whereas different operations pop values for processing.
Every IL instruction consists of an opcode (the operation resembling ldstr, stloc, or name) and an elective operand offering further knowledge like strings, class references, integers, or department targets.
For unobfuscated QuasarRAT samples compiled with DEBUG disabled, the extraction technique targets the Config namespace throughout the Settings class.
This class comprises vital configuration keys together with model, hosts, reconnect delay, set up parameters, encryption keys, and server certificates. The configuration resides in static fields initialized by the category’s static constructor (.cctor technique).
The extraction course of begins by finding the goal namespace and sophistication by iterative traversal of the module’s varieties.
As soon as recognized, the extractor analyzes the static constructor’s IL directions, trying to find paired operations the place ldstr masses a literal string instantly adopted by an instruction referencing the corresponding class area.
This pattern-matching method efficiently retrieves plaintext configuration values from clear samples.
The superior extraction technique leverages QuasarRAT’s runtime decryption mechanisms. Supply code evaluation reveals the malware makes use of AES-256 in CBC mode, with key derivation carried out through PBKDF2.
The Aes256 cryptography module makes use of the default system implementation of AES, with the encryption key saved as a category member and initialized within the static constructor.
Important to this method is figuring out the Aes256 class by scanning for instantiations of System.Safety.Cryptography.AesCryptoServiceProvider.
In .NET IL, static fields are initialised by the category’s static constructor, generally known as .cctor (standing as Class ConsTOR).

The salt worth, saved as a personal static byte array, is recovered by resolving the metadata token loaded through ldtoken instruction within the static constructor.
Cross-reference evaluation then pinpoints the Settings Initialize technique as the only real caller of the decryption routine.
Implications and Future Purposes
This systematic method to configuration extraction demonstrates the viability of automated evaluation for .NET-based malware.
Whereas particularly tailor-made to QuasarRAT, the modular workflow emphasizing namespace traversal, cross-reference decision, and opcode comparability adapts readily to different .NET threats using comparable initialization patterns and cryptography APIs.
The whole QuasarRAT extractor code has been revealed within the Sekoia.io Neighborhood Git repository, offering the cybersecurity group with sensible instruments for menace intelligence and incident response.
By combining reproducible lab environments with thorough understanding of .NET Intermediate Language, safety professionals can systematically find vital courses, get better cryptographic parameters, and assemble totally automated extractors able to harvesting command-and-control settings.
Though this technique doesn’t universally cowl packed samples or QuasarRAT variants substituting different ciphers, it delivers correct outcomes for almost all of real-world deployment situations.
Comply with us on Google Information, LinkedIn, and X to Get Prompt Updates and Set GBH as a Most well-liked Supply in Google.

