NtAlpcQueryInformation
Interroge les métadonnées d'un port ALPC — processus propriétaire, statistiques de message, SID serveur, attributs de port.
Prototype
NTSTATUS NtAlpcQueryInformation( HANDLE PortHandle, ALPC_PORT_INFORMATION_CLASS PortInformationClass, PVOID PortInformation, ULONG Length, PULONG ReturnLength );
Arguments
| Name | Type | Dir | Description |
|---|---|---|---|
| PortHandle | HANDLE | in | Handle vers un port ALPC de connexion, communication ou serveur. NULL pour les requêtes AlpcBasicInformation sur la table de ports du processus appelant. |
| PortInformationClass | ALPC_PORT_INFORMATION_CLASS | in | AlpcBasicInformation (0), AlpcPortInformation (1), AlpcAssociateCompletionPortInformation (2), AlpcConnectedSIDInformation (3), AlpcServerInformation (4), AlpcMessageZoneInformation (5), AlpcRegisterCompletionListInformation (6), AlpcUnregisterCompletionListInformation (7), AlpcAdjustCompletionListConcurrencyCount (8), AlpcRegisterCallbackInformation (9), AlpcCompletionListRundownInformation (10), AlpcWaitForPortReferences (11). |
| PortInformation | PVOID | in/out | Tampon pour la structure spécifique à la classe d'information (ex. ALPC_BASIC_INFORMATION, ALPC_SERVER_INFORMATION). |
| Length | ULONG | in | Taille de PortInformation en octets. |
| ReturnLength | PULONG | out | Reçoit le nombre d'octets écrits ; sur STATUS_INFO_LENGTH_MISMATCH, reçoit la taille requise. |
IDs de syscalls par version de Windows
| Version de Windows | ID de syscall | Build |
|---|---|---|
| Win10 1507 | 0x85 | win10-1507 |
| Win10 1607 | 0x85 | win10-1607 |
| Win10 1703 | 0x86 | win10-1703 |
| Win10 1709 | 0x86 | win10-1709 |
| Win10 1803 | 0x87 | win10-1803 |
| Win10 1809 | 0x87 | win10-1809 |
| Win10 1903 | 0x87 | win10-1903 |
| Win10 1909 | 0x87 | win10-1909 |
| Win10 2004 | 0x89 | win10-2004 |
| Win10 20H2 | 0x89 | win10-20h2 |
| Win10 21H1 | 0x89 | win10-21h1 |
| Win10 21H2 | 0x89 | win10-21h2 |
| Win10 22H2 | 0x89 | win10-22h2 |
| Win11 21H2 | 0x89 | win11-21h2 |
| Win11 22H2 | 0x89 | win11-22h2 |
| Win11 23H2 | 0x89 | win11-23h2 |
| Win11 24H2 | 0x8B | win11-24h2 |
| Server 2016 | 0x85 | winserver-2016 |
| Server 2019 | 0x87 | winserver-2019 |
| Server 2022 | 0x89 | winserver-2022 |
| Server 2025 | 0x8B | winserver-2025 |
Module noyau
APIs liées
Stub du syscall
4C 8B D1 mov r10, rcx B8 8B 00 00 00 mov eax, 0x8B 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
Notes non documentées
Le pendant introspectif de `NtAlpcSetInformation`. Les classes les plus utilisées sont `AlpcBasicInformation` (drapeaux, attributs, compteurs de réf), `AlpcServerInformation` (résout un handle de port en processus *serveur* — à partir d'un port client, renvoie le PID hébergeant le port de connexion) et `AlpcConnectedSIDInformation` (renvoie le SID à l'autre bout). La classe `AlpcServerInformation` est particulière : elle accepte un `ProcessId` en entrée et renvoie des infos de port serveur — historiquement une astuce de fingerprinting / énumération. Aucun wrapper Win32 public ; SystemInformer et ProcessHacker l'appellent directement pour peupler leurs listes de ports ALPC.
Usage courant par les malwares
Utilisé par les outils de reconnaissance ALPC-aware : étant donné un endpoint `ncalrpc`, `AlpcServerInformation` le résout en PID hébergeant — utile pour vérifier que l'on parle bien à (ex.) `services.exe` et non à un endpoint factice, ou inversement pour identifier quel processus possède un port LRPC de forte valeur avant de lancer une LPE. Des vérifications anti-sandbox énumèrent occasionnellement les ports ALPC pour repérer des endpoints d'agents Cuckoo / Joe Sandbox (les versions anciennes exposaient des noms LRPC identifiables). À part cela, syscall de requête passif au signal d'abus direct minimal.
Opportunités de détection
Faible valeur comme détection primaire. L'introspection ALPC est effectuée par la moitié des outils de diagnostic livrés avec Windows (`tasklist /svc`, `wmic`, les nouveaux cmdlets PowerShell `Get-Process`, la suite `sysinternals`). Le provider ETW `Microsoft-Windows-Kernel-ALPC` émet bien des événements query mais ils sont extrêmement bruyants. La stratégie blue-team est d'ignorer ce syscall et d'alerter plutôt sur ce qui suit : un `NtAlpcConnectPort` depuis un binaire non système vers un port LRPC de forte valeur dont le propriétaire vient d'être interrogé.
Exemples de syscalls directs
asmx64 direct stub (Win11 24H2)
; Direct syscall stub for NtAlpcQueryInformation (SSN 0x8B on Win11 24H2)
NtAlpcQueryInformation PROC
mov r10, rcx ; PortHandle
mov eax, 8Bh ; SSN — drifts per build
syscall
ret
NtAlpcQueryInformation ENDPcResolve an ALPC client port to its server PID
// AlpcServerInformation (class 4) accepts a ProcessId in the IN side of the
// ALPC_SERVER_INFORMATION struct and returns the server-port name & flags.
#include <windows.h>
#include <winternl.h>
typedef enum _ALPC_PORT_INFORMATION_CLASS {
AlpcBasicInformation = 0,
AlpcServerInformation = 4,
AlpcConnectedSIDInformation = 3,
} ALPC_PORT_INFORMATION_CLASS;
typedef struct _ALPC_SERVER_INFORMATION_IN {
HANDLE ProcessId;
} ALPC_SERVER_INFORMATION_IN;
typedef struct _ALPC_SERVER_INFORMATION_OUT {
BOOLEAN ThreadBlocked;
HANDLE ConnectedProcessId;
UNICODE_STRING ConnectionPortName;
} ALPC_SERVER_INFORMATION_OUT;
typedef union _ALPC_SERVER_INFORMATION {
ALPC_SERVER_INFORMATION_IN In;
ALPC_SERVER_INFORMATION_OUT Out;
} ALPC_SERVER_INFORMATION;
typedef NTSTATUS (NTAPI *pNtAlpcQueryInformation)(
HANDLE, ALPC_PORT_INFORMATION_CLASS, PVOID, ULONG, PULONG);
NTSTATUS WhoOwnsPort(HANDLE hClientPort, ALPC_SERVER_INFORMATION_OUT *out) {
ALPC_SERVER_INFORMATION info = {0};
ULONG ret = 0;
pNtAlpcQueryInformation fn = (pNtAlpcQueryInformation)GetProcAddress(
GetModuleHandleA("ntdll.dll"), "NtAlpcQueryInformation");
NTSTATUS st = fn(hClientPort, AlpcServerInformation,
&info, sizeof(info), &ret);
if (NT_SUCCESS(st)) *out = info.Out;
return st;
}Mappings MITRE ATT&CK
Last verified: 2026-05-20