NtPrivilegedServiceAuditAlarm
Emite una entrada del log de Seguridad reportando una operación de servicio privilegiada (evento 4673).
Prototipo
NTSTATUS NtPrivilegedServiceAuditAlarm( PUNICODE_STRING SubsystemName, PUNICODE_STRING ServiceName, HANDLE ClientToken, PPRIVILEGE_SET Privileges, BOOLEAN AccessGranted );
Argumentos
| Name | Type | Dir | Description |
|---|---|---|---|
| SubsystemName | PUNICODE_STRING | in | Nombre de subsistema mostrado en el evento resultante, típicamente L"Security". |
| ServiceName | PUNICODE_STRING | in | Nombre libre de servicio (p. ej. L"DRIVERS", L"BackupService") adjuntado al evento. |
| ClientToken | HANDLE | in | Token de impersonación del cliente cuyo uso de privilegio se registra. |
| Privileges | PPRIVILEGE_SET | in | Conjunto de privilegios ejercidos (p. ej. {SeLoadDriverPrivilege}). |
| AccessGranted | BOOLEAN | in | TRUE para operación privilegiada exitosa, FALSE para intentada-pero-denegada. |
IDs de syscalls por versión de Windows
| Versión de Windows | ID de syscall | Build |
|---|---|---|
| Win10 1507 | 0x124 | win10-1507 |
| Win10 1607 | 0x12A | win10-1607 |
| Win10 1703 | 0x12E | win10-1703 |
| Win10 1709 | 0x130 | win10-1709 |
| Win10 1803 | 0x132 | win10-1803 |
| Win10 1809 | 0x133 | win10-1809 |
| Win10 1903 | 0x134 | win10-1903 |
| Win10 1909 | 0x134 | win10-1909 |
| Win10 2004 | 0x139 | win10-2004 |
| Win10 20H2 | 0x139 | win10-20h2 |
| Win10 21H1 | 0x139 | win10-21h1 |
| Win10 21H2 | 0x13A | win10-21h2 |
| Win10 22H2 | 0x13A | win10-22h2 |
| Win11 21H2 | 0x140 | win11-21h2 |
| Win11 22H2 | 0x142 | win11-22h2 |
| Win11 23H2 | 0x142 | win11-23h2 |
| Win11 24H2 | 0x144 | win11-24h2 |
| Server 2016 | 0x12A | winserver-2016 |
| Server 2019 | 0x133 | winserver-2019 |
| Server 2022 | 0x13F | winserver-2022 |
| Server 2025 | 0x144 | winserver-2025 |
Módulo del kernel
APIs relacionadas
Stub del syscall
4C 8B D1 mov r10, rcx B8 44 01 00 00 mov eax, 0x144 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
Hermano de NtPrivilegeObjectAuditAlarm — misma forma, pero para operaciones privilegiadas a nivel de servicio (sin handle de objeto). Genera el evento de Seguridad 4673 ("Se llamó a un servicio privilegiado"). Patrón de llamante canónico: un componente en modo servicio (p. ej. el Service Control Manager cargando un driver kernel vía SeLoadDriverPrivilege, o el subsistema Plug and Play invocando SeUndockPrivilege) quiere que la acción quede registrada bajo su propia identidad de servicio. El evento 4673 incluye el nombre de servicio aportado aquí, los privilegios ejercidos y el SID de usuario del token cliente.
Uso común por malware
Prácticamente nulo en malware commodity. La razón de ser del syscall es dejar rastro escrito, lo opuesto al objetivo del operador malicioso. Las pocas observaciones in-the-wild son componentes firmados por MS haciendo su trabajo normal. Herramientas como Mimikatz que esgrimen SeDebugPrivilege nunca llaman a este syscall — ejercen el privilegio en silencio porque el Object Manager no audita automáticamente el uso de privilegios.
Oportunidades de detección
El volumen del evento 4673 en una estación limpia está dominado por un pequeño conjunto de operaciones legítimas (cargas de driver, ejecuciones de tareas programadas como SYSTEM, arranques de proveedores WMI). Los defensores deben establecer baseline de 4673 por (ServiceName, PrivilegeList, ClientUserSid) y alertar ante tuplas inéditas. Nota: la *ausencia* de 4673 alrededor de un uso de SeLoadDriverPrivilege (verificable vía el evento 7045 del SCM) es mucho más interesante que su presencia — señala o bien una carga de driver no-SCM (T1547.006), o bien manipulación de logs (T1562.002). Defender for Endpoint expone telemetría equivalente vía las tablas DeviceProcessEvents y DeviceEvents.
Ejemplos de syscalls directos
asmx64 direct stub (Win11 24H2)
; Direct syscall stub for NtPrivilegedServiceAuditAlarm (SSN 0x144, Win11 24H2)
NtPrivilegedServiceAuditAlarm PROC
mov r10, rcx ; syscall convention
mov eax, 144h ; SSN
syscall
ret
NtPrivilegedServiceAuditAlarm ENDPcManual 4673 emission from a privileged backup service
// A backup component holding SeBackupPrivilege wants to explicitly record
// a 4673 every time it begins a privileged enumeration pass.
LUID seBackupLuid;
LookupPrivilegeValueW(NULL, SE_BACKUP_NAME, &seBackupLuid);
struct {
PRIVILEGE_SET ps;
} pset = {
.ps = { .PrivilegeCount = 1, .Control = PRIVILEGE_SET_ALL_NECESSARY,
.Privilege = {{ .Luid = seBackupLuid, .Attributes = SE_PRIVILEGE_USED_FOR_ACCESS }} }
};
UNICODE_STRING sub = RTL_CONSTANT_STRING(L"Security");
UNICODE_STRING svc = RTL_CONSTANT_STRING(L"ContosoBackupService");
NTSTATUS s = NtPrivilegedServiceAuditAlarm(
&sub, &svc,
hClientToken,
&pset.ps,
TRUE); // success
// Resulting Security event 4673 records:
// Subject : NT AUTHORITY\SYSTEM (the service)
// Service : ContosoBackupService
// Privilege: SeBackupPrivilegerustWin32 PrivilegedServiceAuditAlarmW wrapper
use windows_sys::Win32::Security::Authorization::PrivilegedServiceAuditAlarmW;
use windows_sys::Win32::Security::*;
unsafe {
let ok = PrivilegedServiceAuditAlarmW(
windows_sys::w!("Security"),
windows_sys::w!("ContosoBackupService"),
client_token,
&priv_set as *const _ as *mut _,
1, // access_granted
);
// ok != 0 -> Security 4673 emitted (subject to "Audit Privilege Use" policy).
}Mapeos MITRE ATT&CK
Last verified: 2026-05-20