pwn3d.es

Visual guide

AMSI-Bypass-Generator

A defensive guide to AMSI: how a script travels through Windows’ antimalware interface and what telemetry any attempt to evade it leaves behind.

5
scan stages
4
documented families
4104
key PowerShell event
0
evasion snippets published
>_ pwn3d.esRED TEAMAMSI-Bypass-Generator
  1. 01 Flow
  2. 02 Detection

2 screens · 7 parts explained

How a script flows through AMSI

AMSI receives the content already deobfuscated just before it runs and hands it to the registered antivirus, which decides whether it proceeds.

  1. Process start
  2. amsi.dll
  3. AmsiScanBuffer
  4. Antimalware provider
  5. Verdict

Who requests the scan

PowerShellWindows Script HostJScript / VBScriptOffice VBA macros.NET (Assembly.Load)

Registered providers

  • Microsoft Defender Antivirusdefault
  • Microsoft Defender for EndpointEDR
  • Third-party antivirusoptional
AMSI_RESULT_DETECTED

The host blocks execution and Defender logs the detection. If the result is clean, the script carries on.

CSS mock-up: a recreation of the interface to explain it, not the running tool. Hover a note to see its area.
  1. The five stages

    The process loads amsi.dll, the host sends content with AmsiScanBuffer, the provider analyses it and returns a verdict.

  2. Why it sees through obfuscation

    Script hosts send the code at the last moment, after obfuscation is resolved. That is why it works so well.

  3. Providers

    Any antivirus can register as a provider; on Windows the default is Defender.

  4. The verdict

    On detection the host refuses to run it and an event is logged. It is the last barrier before execution.

How it is used

  1. Understand the flow

    Where AMSI steps in and who decides.

  2. Enable logging

    Script Block Logging and Defender telemetry.

  3. Watch the signals

    Build alerts for each technique family.

  4. Harden

    Reduce the surface with CLM and application control.

Key concepts

AMSI
Antimalware Scan Interface: a Windows API letting antivirus inspect scripts at run time.
Script Block Logging
PowerShell logging that stores executed code, already deobfuscated (event 4104).
ETW
Event Tracing for Windows: low-level telemetry consumed by EDRs.
CLM
Constrained Language Mode: limits what PowerShell can do.

Want to use it for real?

pwn3d.es only publishes the defensive side: neither the generator nor evasion snippets. The original educational project is on its official site.