This project implements a remote shell using the Windows AFD (Ancillary Function Driver) interface through direct NT syscalls, without WinSock, without imports, and without any high‑level networking APIs. All socket operations—endpoint creation, binding, connecting, and data exchange—are performed through explicit NtCreateFile and NtDeviceIoControlFile interactions with the AFD driver.
The objective is to demonstrate low‑level TCP communication and remote command execution.
-
No WinSock, no CRT, no imports
-
AFD endpoint creation via
NtCreateFile -
Networking performed through AFD IOCTLs
-
Dynamic API lookup using a ROR13 hash resolver
-
Remote shell launched through
CreateProcessAwith inherited std handles- STDIN → socket
- STDOUT → socket
- STDERR → socket
├── main.asm # Entry point and control flow
├── utils.inc # inet_addr, strcmp, unicode length, etc.
├── ntsyscalls.inc # NT syscall identifiers
├── afd.inc # AFD IOCTL definitions
├── system.inc # PE64 structures and system helpers
NtCreateFile is used to open an AFD endpoint located at:
\Device\Afd\Endpoint
AFD network operations are performed through specific IOCTLs:
IOCTL_AFD_BIND(0x12003)IOCTL_AFD_CONNECT(0x12007)
The code constructs the expected data structures and passes them directly to the driver.
Socket I/O relies on:
NtDeviceIoControlFile
NtWaitForSingleObject
NtClearEvent
These calls manage request submission, pending states, and event signaling.
CreateProcessA is resolved dynamically using the ROR13 hashing routine. The created process inherits the socket as its standard handles, resulting in an interactive remote session with cmd.exe.
Requires FASM.
Example:
fasm main.asm shell.exe- Start a listener using
ncat -l <port>. - Update the IP and port inside the assembly code (default: 127.0.0.1:80).
- Execute the compiled binary.
- Interact with the remote CMD session.
This project is intended strictly for research and educational purposes, including:
- Windows internal architecture
- Low-level networking
- Syscall-level communication
- Detection and anti-detection research
Unauthorized use on systems without permission is illegal.
MIT License — use, modify, and experiment freely for research or learning.