Cyber security

AMSI Bypass via VEH – Technique Using Vectored Exception Handling

A PowerShell AMSI Bypass technique via Vectored Exception Handler (VEH). This technique does not perform assembly instruction patching, function hooking or Import Address Table (IAT) modification.


How It Works:

For this technique to work, you must first inject the VEH DLL into the PowerShell process. This can be done either by injecting the DLL or via DLL hijacking .

This technique works by setting up a hardware breakpoint on the function AmsiScanBuffer on all PowerShell process threads, then installing a VEH to handle the trigger of this breakpoint.

When a thread calls AmsiScanBuffer, the VEH will make the thread to exit the function without executing anything and setting the result of the function to AMSI_RESULT_CLEAN.

This is all done inside the VEH, without modifying the code of the process or without any PE modifications.


Usage:

For demonstration purposes, this repository contains a very basic DLL injector. Use it this way:

  • 1.) Compile the DLL Injector and VEH DLL.
  • 2.) Open an instance of PowerShell.
  • 3.) Run the DLL injector by providing the FULL PATH to the DLL. Example:
./DLL_Injector.exe C:\Windows\Temp\AMSI_VEH.DLL
Varshini

Varshini is a Cyber Security expert in Threat Analysis, Vulnerability Assessment, and Research. Passionate about staying ahead of emerging Threats and Technologies.

Recent Posts

Install Laravel on Ubuntu 18.04 with Composer: Setup Guide

Laravel is an open-source PHP web application framework built around an expressive, developer-friendly syntax. It is…

4 hours ago

Install Kodi on Ubuntu 18.04: Add the Official PPA and Set Up

Kodi (formerly XBMC, short for Xbox Media Center) is a free, open-source, cross-platform media player and…

4 hours ago

Install Tomcat 8.5 on Ubuntu 18.04: Java Servlet Container Setup

Apache Tomcat is an open-source Java servlet container that implements Java Servlet, JavaServer Pages (JSP), Java…

4 hours ago

Install Sublime Text 3 on Ubuntu 18.04: APT Repository Setup

Sublime Text is one of the most widely used source code editors in the world, known…

4 hours ago

Install Spotify on Ubuntu 18.04: APT Repository Setup Guide

Spotify is one of the world's most popular digital music streaming platforms, giving you on-demand access…

4 hours ago

Install Nextcloud on Ubuntu 18.04 with Apache and MySQL

Nextcloud is a free, open-source, self-hosted file sharing and collaboration platform. It gives you a private…

1 day ago