Skip to content

Repository files navigation

nightfall

windows security research framework. built on Win11 25H2 (Build 26200.5603, Defender 4.18.26060). pure Python stdlib + ctypes, no pip installs.

research

the interesting part of this project is the research, not the framework. detailed writeups are in research/.

dam.sys kernel driver (K1-K4)

four bugs in the Desktop Activity Moderator kernel driver, all reachable from medium integrity level with no special privileges:

IDbugimpactvalidation
K1confused deputy -- enroll any process into DAM jobDoS on arbitrary processesTRIGGER
K2session freeze via state IOCTL~10x slowdown on enrolled processesmanual
K3NULL deref via crafted IOCTLBugCheck 0x3B (instant BSOD)manual (destructive)
K4PsQueryProcessCommandLine for arbitrary PIDscredential/token leak from privileged processesIMPACT

see research/dam-sys.md for IOCTL details, access requirements, and reverse engineering notes.

defender primitives (D1-D5)

IDtechniqueneedsvalidation
D1signature freeze from medium ILuserIMPACT
D2oplock quarantine bypassuserSTATE
D3NTLM coercion via scan pathadmin + listenermanual
D4ETW surveillance on engine provideradminTRIGGER
D5scan pauseadminTRIGGER

see research/defender-primitives.md.

other findings

IDtechniquevalidationnotes
E1UAC bypass (mock trusted directory)TRIGGERknown technique -- see research/uac-bypass-e1.md
W1WER report stagingSTATEstaging primitive, no code exec chain yet
W2WER triggermanual
N1WNF cross-privilege triggerTRIGGERstate names may vary between builds

validation

python nightfall.py validate
python nightfall.py validate --target D1

three result tiers:

  • IMPACT -- test proves the end-to-end security consequence
  • STATE -- test verifies the mutation but not the downstream effect
  • TRIGGER -- API call succeeded, no further verification

also SKIP (missing prereqs) and FAIL. AMSI and ETW tests restore original bytes after verification. K3 is excluded (destructive).

the validation suite covers: D1, D2, D4, D5, E1, K1, K4, W1, N1, AMSI, ETW.

not covered: D3 (needs external listener), K2/K3 (destructive), W2, and all experimental features. this is the biggest gap in the project.

framework capabilities

the framework implements ~60 standard post-exploitation techniques. these are not original research -- they are public tradecraft implemented from documentation and prior work.

evasion: AMSI/ETW patching (byte mod and hardware breakpoint variants), ntdll unhook, indirect syscalls, module stomping, sleep obfuscation, PEB masquerade

injection: CRT, APC, early bird, thread hijack, module stomping

credentials: SAM dump, LSASS dump, browser creds (DPAPI+AES-GCM), registry creds, wifi passwords

persistence: Run key, scheduled task, time provider DLL, WER handler, SSP/AP package

C2: HTTPS beacon (WinHTTP), named pipe, WNF state, kernel pool dead drop, clipboard

lateral: SCM service create, WMI exec, WinRM exec

kernel (BYOVD): RTCore64.sys loader, DKOM process/thread hiding, ETW-TI kill, callback removal, minifilter blinding

anti-forensics: event log clear, timestomp (API and raw MFT), artifact wipe, shadow delete

see the interactive help (python nightfall.py interactive, then help) for the full command list.

maturity levels

each feature is marked with its validation status:

levelmeaning
VALIDATED (IMPACT)test proves end-to-end security consequence
VALIDATED (STATE)test verifies mutation, not downstream effect
VALIDATED (TRIGGER)API call accepted, no further verification
FUNCTIONALmanually tested, no automated validation
EXPERIMENTALknown limitations, hardcoded offsets, or incomplete
SCAFFOLDsetup/registration works, core mechanism not implemented

experimental features are documented honestly -- limitations, failure modes, and what would break are called out in the code and in the README sections below.

known gaps

  1. experimental features have no automated validation tests
  2. kernel DKOM operations (process hide, thread hide, handle hide, callback nuke, minifilter blind) use heuristic offset scanning with no build-matrix verification
  3. ProjFS callbacks don't serve file data (scaffold only)
  4. kernel pool dead drop writes to unowned memory (corruption risk)
  5. process hollowing has no relocation support
  6. process doppelganging does not initialize process parameters

project structure

nightfall.py # legacy entry point (also works standalone)
nightfall/
__init__.py # package exports
__main__.py # python -m nightfall support
constants.py # ctypes definitions, WIN32 constants, API signatures
core.py # Nightfall class (all methods)
cli.py # argparse, interactive mode, command dispatch
research/ # detailed findings documentation
docs/ # validation model, technique reference
uac_poc/ # Rust DLL for E1 UAC bypass

usage

python nightfall.py interactive
python -m nightfall interactive

or run commands directly:

python nightfall.py validate
python nightfall.py freeze
python nightfall.py elevate
python nightfall.py ghost

further reading

building the UAC DLL

cd uac_poc
cargo build --release

requirements

  • Python 3.8+
  • Windows 11 25H2
  • Rust toolchain (for uac_poc only)
  • no external Python dependencies

license

MIT. see LICENSE.

disclaimer

authorized security research only. do not use on systems you do not own or have written permission to test.

About

Windows security research framework built around Defender and kernel vulnerability research.

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages