NtRequestWaitReplyPort
Envía una solicitud LPC síncrona y bloquea hasta la respuesta del servidor — la primitiva RPC heredada.
Prototipo
NTSTATUS NtRequestWaitReplyPort( HANDLE PortHandle, PPORT_MESSAGE Request, PPORT_MESSAGE Reply );
Argumentos
| Name | Type | Dir | Description |
|---|---|---|---|
| PortHandle | HANDLE | in | Handle a un puerto LPC conectado, devuelto previamente por NtConnectPort / NtSecureConnectPort. |
| Request | PPORT_MESSAGE | in | Cabecera PORT_MESSAGE seguida del payload en línea (≤ 256 bytes para mensajes cortos). |
| Reply | PPORT_MESSAGE | out | Búfer asignado por el llamante que recibe la respuesta del servidor; debe ser ≥ MaxMessageLength. |
IDs de syscalls por versión de Windows
| Versión de Windows | ID de syscall | 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 |
Módulo del kernel
APIs relacionadas
Stub del syscall
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
Notas no documentadas
NtRequestWaitReplyPort es la primitiva request/response síncrona del subsistema **LPC** heredado — conceptualmente equivalente a `NtAlpcSendWaitReceivePort` con `ALPC_MSGFLG_SYNC_REQUEST`. Envía un PORT_MESSAGE y bloquea el hilo llamante hasta que el servidor responda vía `NtReplyPort` o `NtReplyWaitReceivePort`. El SSN `0x22` está congelado desde Windows 10 1507, reflejando el estado legacy de LPC en la tabla. El payload en línea está limitado a PORT_MAXIMUM_MESSAGE_LENGTH (256 bytes); transferencias mayores requieren una PORT_VIEW compartida intercambiada en el connect.
Uso común por malware
En Windows contemporáneo, el uso práctico de NtRequestWaitReplyPort por malware es esencialmente *histórico*: los rootkits en user mode pre-Vista y los primeros droppers IPC-aware lo usaban como C2 sigiloso intra-host entre un loader y un payload inyectado porque no existía wrapper Win32 y el tráfico nunca tocaba la pila de red. Los atacantes modernos prefieren ALPC, named pipes o secciones compartidas — cualquier observación de tráfico LPC en crudo request/reply es por sí misma anómala y merece investigación.
Oportunidades de detección
Sin proveedor ETW dedicado a LPC heredado equivalente a `Microsoft-Windows-Kernel-ALPC`. Los EDR de kernel pueden hookear el syscall directamente; los EDR de user mode hookean `ntdll!NtRequestWaitReplyPort`. Como la línea base de llamantes legítimos en Windows 10/11 es prácticamente nula (casi nada en el SO sigue usando LPC en crudo para RPC), *cualquier* hit desde un proceso sin firmar o sandboxeado es de alta señal. La vista de puertos por proceso de SystemInformer muestra los handles LPC distintos de los ALPC.
Ejemplos de syscalls directos
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 _)
}Mapeos MITRE ATT&CK
Last verified: 2026-05-20