NtCompareSigningLevels
Compares two SE_SIGNING_LEVEL values using Code Integrity's policy ordering and returns whether the first dominates the second.
Prototype
NTSTATUS NtCompareSigningLevels( SE_SIGNING_LEVEL FirstSigningLevel, SE_SIGNING_LEVEL SecondSigningLevel );
Arguments
| Name | Type | Dir | Description |
|---|---|---|---|
| FirstSigningLevel | SE_SIGNING_LEVEL | in | First signing level to compare (0 Unchecked, 4 Authenticode, 6 Store, 8 Antimalware, 12 Microsoft, 14 Windows). |
| SecondSigningLevel | SE_SIGNING_LEVEL | in | Second signing level to compare against the first. |
Syscall IDs by Windows version
| Windows version | Syscall ID | Build |
|---|---|---|
| Win10 1703 | 0x98 | win10-1703 |
| Win10 1709 | 0x99 | win10-1709 |
| Win10 1803 | 0x9A | win10-1803 |
| Win10 1809 | 0x9A | win10-1809 |
| Win10 1903 | 0x9A | win10-1903 |
| Win10 1909 | 0x9A | win10-1909 |
| Win10 2004 | 0x9C | win10-2004 |
| Win10 20H2 | 0x9C | win10-20h2 |
| Win10 21H1 | 0x9C | win10-21h1 |
| Win10 21H2 | 0x9C | win10-21h2 |
| Win10 22H2 | 0x9C | win10-22h2 |
| Win11 21H2 | 0x9E | win11-21h2 |
| Win11 22H2 | 0x9E | win11-22h2 |
| Win11 23H2 | 0x9E | win11-23h2 |
| Win11 24H2 | 0xA0 | win11-24h2 |
| Server 2019 | 0x9A | winserver-2019 |
| Server 2022 | 0x9E | winserver-2022 |
| Server 2025 | 0xA0 | winserver-2025 |
Kernel module
Related APIs
Syscall stub
4C 8B D1 mov r10, rcx B8 A0 00 00 00 mov eax, 0xA0 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
A pure comparison helper exposed as a syscall purely so Code Integrity's ordering policy lives in *one* place — the kernel — rather than being re-implemented in every user-mode component that needs it. Returns `STATUS_SUCCESS` (0) when `FirstSigningLevel` is greater than or equal to `SecondSigningLevel` in CI's lattice, and `STATUS_NOT_FOUND` (0xC0000225) otherwise. Importantly, the ordering is *not* numerical: although the constants happen to be monotonic (`0 < 4 < 6 < 8 < 12 < 14`), the kernel routes through `CiCompareSigningLevels` in `ci.dll`, which applies policy-defined equivalence (for example `SE_SIGNING_LEVEL_STORE` and `SE_SIGNING_LEVEL_ANTIMALWARE` may be treated as equivalent under specific WHQL policy flags). Hence the syscall — to centralise that policy. Introduced in Windows 10 1703 alongside the rest of the modern Code-Integrity API surface; not present on Windows 10 1507 / 1607.
Common malware usage
Almost zero offensive value. It is a *pure* function (no side effects, no privileges, no resource access) that takes two integers and returns a status — there is nothing to abuse. The only real-world reason an attacker would call it is bookkeeping: red-team loaders that have constructed a CIG-bypass primitive may call it to double-check that the level they have forged dominates the level the target requires, before committing to the injection. Otherwise no malware family is documented as using it, and EDRs ignore it.
Detection opportunities
Not a meaningful detection point. The function has no observable side effect, ETW does not log per-call events for it, and the volume from legitimate `ci.dll` self-use is high enough that ratio-based hunting is impractical. Detection effort is better spent on its *callers* — anyone calling `NtCompareSigningLevels` from outside `ci.dll`, `wldp.dll`, `lsass.exe`, and a handful of Defender components is unusual but not necessarily malicious. If you have user-mode syscall telemetry, joining `NtCompareSigningLevels` calls with adjacent `NtSetCachedSigningLevel` / `NtGetCachedSigningLevel` calls from the same thread is a much stronger signal than this call in isolation.
Direct syscall examples
cDoes the cached level satisfy the target's CIG requirement?
// Used internally by ci.dll and by some EDRs to short-circuit policy decisions.
// Returns STATUS_SUCCESS if `have` dominates `need`, STATUS_NOT_FOUND otherwise.
#include <windows.h>
#include <winternl.h>
typedef NTSTATUS (NTAPI* pNtCompareSigningLevels)(UCHAR, UCHAR);
BOOL satisfies(UCHAR have, UCHAR need) {
pNtCompareSigningLevels f = (pNtCompareSigningLevels)GetProcAddress(
GetModuleHandleA("ntdll.dll"), "NtCompareSigningLevels");
return NT_SUCCESS(f(have, need));
}
// Example: do we meet ProcessSignaturePolicy.MicrosoftSignedOnly = 1?
// satisfies(SE_SIGNING_LEVEL_MICROSOFT, SE_SIGNING_LEVEL_MICROSOFT) == TRUE
// satisfies(SE_SIGNING_LEVEL_AUTHENTICODE, SE_SIGNING_LEVEL_MICROSOFT) == FALSEasmx64 direct stub (Win11 24H2 / Server 2025, SSN 0xA0)
NtCompareSigningLevels PROC
mov r10, rcx
mov eax, 0A0h
syscall
ret
NtCompareSigningLevels ENDPMITRE ATT&CK mappings
Last verified: 2026-05-20