Skip to content

feat: add ETW patching support for self-injection indirect syscall te… - #72

Merged
Nariod merged 1 commit into
mainfrom
feature/etw-patch
Aug 26, 2026
Merged

feat: add ETW patching support for self-injection indirect syscall te…#72
Nariod merged 1 commit into
mainfrom
feature/etw-patch

Conversation

@Nariod

@Nariod Nariod commented Aug 26, 2026

Copy link
Copy Markdown
Owner

…mplates

  • Add --etw-patch CLI flag for ETW function patching (EDR evasion)
  • Add uses_indirect_syscalls() and supports_etw_patch() methods to Execution enum
  • Implement add_etw_patch_replacements() in replacements.rs using rust_syscalls
  • Integrate ETW patch placeholders into sysFIBER template
  • Add validation to restrict ETW patch to eligible templates only
  • Update tests for new functionality

ETW patching is only available for templates that combine:

  • Self-injection (executes in current process)
  • Indirect syscalls (uses rust_syscalls for NtProtectVirtualMemory)

Current eligible template: sysFIBER

The patch works by:

  1. Parsing PEB to find ntdll.dll base address
  2. Parsing export directory to find ETW functions
  3. Using NtProtectVirtualMemory (via rust_syscalls) to change permissions
  4. Patching function prologues with RET (0xC3) + NOPs
  5. Restoring original permissions

This avoids hardware breakpoints and uses only indirect syscalls.

…mplates

- Add --etw-patch CLI flag for ETW function patching (EDR evasion)
- Add uses_indirect_syscalls() and supports_etw_patch() methods to Execution enum
- Implement add_etw_patch_replacements() in replacements.rs using rust_syscalls
- Integrate ETW patch placeholders into sysFIBER template
- Add validation to restrict ETW patch to eligible templates only
- Update tests for new functionality

ETW patching is only available for templates that combine:
- Self-injection (executes in current process)
- Indirect syscalls (uses rust_syscalls for NtProtectVirtualMemory)

Current eligible template: sysFIBER

The patch works by:
1. Parsing PEB to find ntdll.dll base address
2. Parsing export directory to find ETW functions
3. Using NtProtectVirtualMemory (via rust_syscalls) to change permissions
4. Patching function prologues with RET (0xC3) + NOPs
5. Restoring original permissions

This avoids hardware breakpoints and uses only indirect syscalls.

Co-authored-by: Nariod <Nariod@users.noreply.github.com>
@Nariod
Nariod merged commit bce004a into main Aug 26, 2026
3 checks passed
@Nariod
Nariod deleted the feature/etw-patch branch August 26, 2026 09:20
Nariod added a commit that referenced this pull request Aug 26, 2026
- Add --etw-patch flag to Command Line Options (container and native modes)
- Add 'ETW patching compatible' column to Self-Execution Templates table
- Add ETW Patching description to Detection Evasion section
- Add usage example with --etw-patch for sysfiber template

Closes documentation gap for ETW patching feature (PR #72)

Co-authored-by: Nariod <Nariod@users.noreply.github.com>
Nariod added a commit that referenced this pull request Aug 26, 2026
- Add --etw-patch flag to Command Line Options (container and native modes)
- Add 'ETW patching compatible' column to Self-Execution Templates table
- Add ETW Patching description to Detection Evasion section
- Add usage example with --etw-patch for sysfiber template

Closes documentation gap for ETW patching feature (PR #72)

Co-authored-by: Nariod <Nariod@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants