NtRequestWaitReplyPort
Sends a synchronous LPC request and blocks until the server replies — the legacy RPC primitive.
Prototype
NTSTATUS NtRequestWaitReplyPort( HANDLE PortHandle, PPORT_MESSAGE Request, PPORT_MESSAGE Reply );
Arguments
| Name | Type | Dir | Description |
|---|---|---|---|
| PortHandle | HANDLE | in | Handle to a connected LPC port previously returned by NtConnectPort / NtSecureConnectPort. |
| Request | PPORT_MESSAGE | in | PORT_MESSAGE header followed by inline payload (≤ 256 bytes for short messages). |
| Reply | PPORT_MESSAGE | out | Caller-allocated buffer that receives the server's reply message; must be ≥ MaxMessageLength. |
Syscall IDs by Windows version
| Windows version | Syscall ID | Build |
|---|---|---|
| Win10 1507 | 0x22 | win10-1507 |
| Win10 1607 | 0x22 | win10-1607 |
| Win10 1703 | 0x22 | win10-1703 |
| Win10 1709 | 0x22 | win10-1709 |
| Win10 1803 | 0x22 | win10-1803 |
| Win10 1809 | 0x22 | win10-1809 |
| Win10 1903 | 0x22 | win10-1903 |
| Win10 1909 | 0x22 | win10-1909 |
| Win10 2004 | 0x22 | win10-2004 |
| Win10 20H2 | 0x22 | win10-20h2 |
| Win10 21H1 | 0x22 | win10-21h1 |
| Win10 21H2 | 0x22 | win10-21h2 |
| Win10 22H2 | 0x22 | win10-22h2 |
| Win11 21H2 | 0x22 | win11-21h2 |
| Win11 22H2 | 0x22 | win11-22h2 |
| Win11 23H2 | 0x22 | win11-23h2 |
| Win11 24H2 | 0x22 | win11-24h2 |
| Server 2016 | 0x22 | winserver-2016 |
| Server 2019 | 0x22 | winserver-2019 |
| Server 2022 | 0x22 | winserver-2022 |
| Server 2025 | 0x22 | winserver-2025 |
Kernel module
Related APIs
Syscall stub
4C 8B D1 mov r10, rcx B8 22 00 00 00 mov eax, 0x22 F6 04 25 08 03 FE 7F 01 test byte ptr [0x7FFE0308], 1 75 03 jne short +3 0F 05 syscall C3 ret CD 2E int 2Eh C3 ret
Undocumented notes
NtRequestWaitReplyPort is the synchronous request/response primitive of the legacy **LPC** subsystem — conceptually equivalent to `NtAlpcSendWaitReceivePort` with `ALPC_MSGFLG_SYNC_REQUEST`. It sends one PORT_MESSAGE and blocks the calling thread until the server replies through `NtReplyPort` or `NtReplyWaitReceivePort`. The SSN `0x22` has been frozen since Windows 10 1507, reflecting LPC's status as a legacy table-prefix component. Inline payload is capped at PORT_MAXIMUM_MESSAGE_LENGTH (256 bytes); larger transfers require a shared PORT_VIEW exchanged at connect time.
Common malware usage
On contemporary Windows the practical use of NtRequestWaitReplyPort by malware is largely *historical*: pre-Vista user-mode rootkits and early IPC-aware droppers used it as a stealthy in-host C2 between a loader and an injected payload because no Win32 wrapper existed and the traffic never touched the network stack. Modern attackers overwhelmingly prefer ALPC, named pipes, or shared sections — so any observation of raw LPC request/reply traffic is itself anomalous and worth investigating.
Detection opportunities
There is no dedicated ETW provider for legacy LPC equivalent to `Microsoft-Windows-Kernel-ALPC`. Kernel-mode EDRs can hook the syscall directly; user-mode EDRs hook `ntdll!NtRequestWaitReplyPort`. Because the legitimate-caller baseline on Windows 10/11 is essentially zero (almost nothing in the OS still uses raw LPC for RPC), *any* hit from an unsigned or sandboxed process is high-signal. SystemInformer's per-process port view shows LPC handles distinctly from ALPC handles.
Direct syscall examples
asmx64 direct stub
; Direct syscall stub for NtRequestWaitReplyPort (SSN 0x22, stable Win10 1507+)
NtRequestWaitReplyPort PROC
mov r10, rcx ; PortHandle
mov eax, 22h ; SSN
syscall
ret
NtRequestWaitReplyPort ENDPcSynchronous LPC request
// Send a request and wait for the reply on a connected LPC port.
#include <windows.h>
#include <winternl.h>
#define PORT_MAXIMUM_MESSAGE_LENGTH 256
typedef NTSTATUS (NTAPI *pNtRequestWaitReplyPort)(
HANDLE, PVOID /*PPORT_MESSAGE*/, PVOID /*PPORT_MESSAGE*/);
NTSTATUS LpcCall(HANDLE hPort, void *reqBuf, void *replyBuf) {
pNtRequestWaitReplyPort fn = (pNtRequestWaitReplyPort)GetProcAddress(
GetModuleHandleA("ntdll.dll"), "NtRequestWaitReplyPort");
return fn(hPort, reqBuf, replyBuf);
}rustFFI declaration via ntapi
// Cargo: ntapi = "0.4"
use ntapi::ntlpcapi::NtRequestWaitReplyPort;
use winapi::shared::ntdef::{HANDLE, NTSTATUS};
unsafe fn lpc_call(port: HANDLE, req: *mut u8, reply: *mut u8) -> NTSTATUS {
NtRequestWaitReplyPort(port, req as *mut _, reply as *mut _)
}MITRE ATT&CK mappings
Last verified: 2026-05-20