Disable or Modify Tools
Sub-technique of T1562 Impair Defenses ↗
Neutralising antivirus, AMSI or ETW so they do not detect your tools.
How it shows up on Hack The Box
On recent Windows boxes Defender is on: understand how AMSI works and why your script fails before looking for a bypass. We explain it without ready-to-use kits.
Techniques in our catalog that match this one (the number is their machines):
Machines to practice it
Sorted from easiest to hardest. The ▶ link takes you to the minute of the IppSec video where it is used.
Guides
- How antivirus and EDR detect you on Windows: AMSI, ETW, hooks, AppLocker and CLM explained 5 min read What Defender or an EDR checks when you run a tool (signatures, AMSI, ETW, hooks, kernel callbacks), how to tell what protects a box, and AppLocker and CLM.
Commands
Taken from our cheatsheets and tool pages. Type your details and they are filled into every command.
Evasion explained: AMSI, ETW and AppLocker › AMSI
The flow, in one sentence
Keys
# amsi.dll -> AmsiScanBuffer() -> antivirus. Si devuelve AMSI_RESULT_DETECTED, el host corta la ejecución.
Check AMSI is active (harmless test string)
Target
'AMSI Test Sample: 7e72c3ce-861b-4339-8740-0ac1484c1386'
This is Microsoft's official test string (like EICAR). If PowerShell blocks it, AMSI is working. It does nothing.
1. Force an initialisation error
Keys
# Poner a valor no nulo el campo 'amsiInitFailed' por reflexión hace que AMSI se dé por roto y no escanee esa sesión. La firma literal lleva años detectada: hay que ofuscarla.
2. Patch AmsiScanBuffer in memory
Keys
# Sobrescribir el principio de AmsiScanBuffer para que siempre devuelva 'limpio'. Es lo que hace la mayoría de loaders; el EDR vigila justo esa escritura.
3. Avoid PowerShell
Keys
# AMSI está en el host del script. Ejecutar un binario .NET propio, C o un lenguaje sin integración con AMSI esquiva el problema de raíz.
Script Block Logging (event 4104)
Keys
# Aunque saltes AMSI, PowerShell puede registrar el script ya decodificado en el visor de eventos. La evasión real tiene que apagar también ETW (pestaña siguiente).
Evasion explained: AMSI, ETW and AppLocker › ETW
Neutralise EtwEventWrite
Keys
# La técnica pública parchea EtwEventWrite en ntdll para que retorne de inmediato: deja de emitirse telemetría de ese proceso. Como con AMSI, el parche en caliente de ntdll es justo lo que un buen EDR vigila.
Phishing explained: macros, HTA and LNK › Office macros
Defender ASR rules
Keys
# "Block all Office applications from creating child processes" impide que WINWORD.EXE lance cmd/powershell, que es justo lo que hace la macro.
No command matches.