returnreturn
Follina a silent Client-Side

By:
R&D + i Team

SHARE

Twitter Facebook linkedin

VBA Stomping

VBA Stomping is an evasion technique used by cybercriminals to hide malicious code in Microsoft Office documents, specifically in VBA (Visual Basic for Applications) macros. This technique allows attackers to avoid detection by security solutions by altering the parts of macro files that antivirus programs and other security tools normally scan.

Definition

VBA Stomping refers to the manipulation of the execution flow of a VBA macro file so that malicious code goes undetected. Basically, attackers insert the malicious code into parts of the file that are not routinely analyzed by security tools, or mask it in such a way that it appears harmless. This technique takes advantage of the structure and operation of the VBA language and the files that contain it.

Brief History and Origin of the Technique

The use of VBA macros as an attack vector is not new; it dates back to the 1990s with the emergence of macro viruses such as the notorious "Melissa" in 1999. As defenses against these threats evolved, attackers developed more sophisticated methods to evade detection.
The concept emerged as a natural evolution in the war of wits between attackers and defenders. As security solutions began to get better at detecting malicious macros, attackers devised ways to modify the metadata and internal structure of macro files. In this way, they managed to keep the malicious code hidden during standard security reviews. Although the term "VBA Stomping" is relatively recent, the technique itself has been under development and refinement for several years, driven by the attackers' need to stay one step ahead of security defenses.

Operation

It is based on the manipulation of the internal structure of macro files. Microsoft Office documents containing macros have two main components:

 • The Macro Code (VBA): This is the script that defines the automated actions. It is stored in a clear text format within the document.

 • VBA Project Metadata: This is additional data describing the VBA project, including references to libraries, project properties and digital signatures.

The process generally follows these steps:

 • Malicious Document Creation: The attacker creates an Office document with a malicious macro.

 • Malicious Code Insertion: Malicious code is inserted into sections of the macro file that are not routinely scanned by security solutions, or is masked so that it appears harmless.

 • Inserción del Código Malicioso: El código malicioso se inserta en secciones del archivo de macro que no son escaneadas rutinariamente por las soluciones de seguridad, o se enmascara de manera que parezca inofensivo..

 • Document Distribution: The malicious document is distributed to victims via phishing emails, compromised websites or other attack vectors.

 • The result is that when the document is opened, the malicious code is executed without being detected by traditional security solutions that analyze the contents of macros and metadata..

Comparison with Other Similar Avoidance Techniques

VBA Stomping is distinguished from other avoidance techniques by its focus on manipulating the internal structure of macro files. Here is a comparison with some similar techniques:

VBA Code Obfuscation

Technique: Involves modification of the VBA code to make it less readable and more difficult to analyze.
Comparison: While obfuscation focuses on making code difficult to understand, VBA Stomping manipulates metadata and file structure to hide malicious code.

DDE (Dynamic Data Exchange) Attack

Technique: Uses the DDE functionality of Microsoft Office to execute commands without the need for macros.
Comparison: DDE exploits a different feature of Office and does not involve the modification of VBA macros or metadata. VBA Stomping, on the other hand, is specific to VBA macros.

Macro Packing

Technique: Embed malicious code inside packed or compressed macros.
Comparison: Although similar in that both methods seek to hide malicious code, packaging focuses on code compression and insertion, while VBA Stomping focuses on structural manipulation.

Polyglot Files

Technique: Creates files that can be interpreted in multiple ways by different programs, allowing the malicious content to go undetected.
Comparison: Polymorphic files focus on the multi-functionality of the file, while VBA Stomping is specific to macros and their structure within Office documents.

Evolution of the technique over time

The technique has evolved significantly since its emergence, adapting and becoming more sophisticated to evade the increasing detection capabilities of security systems. Initially, these attacks were based on exploiting malicious macros embedded in Microsoft Office documents, which were distributed via phishing emails. Over time, attackers began to refine this technique to avoid detection by antivirus and other security solutions.

First Phases: In its early stages, it consisted of directly modifying the VBA code of macros to insert malicious payloads. Detection systems were relatively ineffective, allowing attackers to achieve a high degree of success.

Improvements in obfuscation: As detection mechanisms began to improve, attackers introduced advanced obfuscation techniques. These included encryption of the malicious payload and the use of complex methods to hide malicious instructions within seemingly legitimate VBA code.

Automation and Tools: The creation of automated tools to generate malicious macros and perform VBA Stomping allowed less experienced attackers to use this technique. This resulted in an increase in the number of attacks and a greater diversification of the methods used.

Dynamic Analysis Evasion: Attackers also began to develop techniques to evade dynamic analysis, such as introducing environment checks and executing malicious code only under certain conditions. This made behavior-based detection more difficult to implement.

Potential developments and improvements in the technique

The constant evolution of detection and response capabilities in cybersecurity pushes attackers to continuously innovate. In the future, we could see several improvements and developments in the VBA Stomping technique:

 • Advanced Obfuscation: Obfuscation techniques are expected to become even more sophisticated, using more complex algorithms and dynamic code variations to avoid detection by signature-based antivirus engines..

 • Use of Artificial Intelligence: Attackers could employ artificial intelligence and machine learning to create macros that dynamically adapt to a network's specific defenses, adjusting their behavior to maximize evasion.

 • Integration with Polymorphic Techniques: Integrating VBA Stomping with polymorphic techniques will allow each instance of the attack to be unique, making it difficult for pattern-based detection systems to identify and block these threats.

 • Multi-stage attacks: Future developments may include combining VBA Stomping with other attack vectors in multi-stage campaigns. For example, a malicious macro could be just the first phase of a more complex attack that includes additional exploits and lateral movements within the targeted network.

Conclusion

In summary, VBA Stomping represents an advanced evasion technique that exploits the capabilities of the Visual Basic for Applications (VBA) language to hide malicious code and evade security solutions.
The impact of this technique is significant, with threats that can affect various industries and businesses. Detecting and mitigating this technique are critical challenges that require specialized methods and a solid understanding of cybersecurity best practices. It is essential that organizations implement appropriate security solutions and foster a culture of awareness of emerging threats.

The evolution of VBA Stomping shows that evasion techniques continue to advance, underscoring the need to stay current with the latest trends and developments in cybersecurity. Looking ahead, we are likely to see new variants and improvements to this technique, making it imperative that security professionals continue to innovate and adapt.

Ultimately, awareness and ongoing cybersecurity training are critical to protect against threats such as VBA Stomping. Proactive steps need to be taken by all organizations to strengthen their defenses and be better prepared to meet these challenges in order to effectively mitigate the risks associated with these advanced evasion techniques