> Windows Syscalls
ntoskrnl.exeT1106T1553

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

NameTypeDirDescription
FirstSigningLevelSE_SIGNING_LEVELinFirst signing level to compare (0 Unchecked, 4 Authenticode, 6 Store, 8 Antimalware, 12 Microsoft, 14 Windows).
SecondSigningLevelSE_SIGNING_LEVELinSecond signing level to compare against the first.

Syscall IDs by Windows version

Windows versionSyscall IDBuild
Win10 17030x98win10-1703
Win10 17090x99win10-1709
Win10 18030x9Awin10-1803
Win10 18090x9Awin10-1809
Win10 19030x9Awin10-1903
Win10 19090x9Awin10-1909
Win10 20040x9Cwin10-2004
Win10 20H20x9Cwin10-20h2
Win10 21H10x9Cwin10-21h1
Win10 21H20x9Cwin10-21h2
Win10 22H20x9Cwin10-22h2
Win11 21H20x9Ewin11-21h2
Win11 22H20x9Ewin11-22h2
Win11 23H20x9Ewin11-23h2
Win11 24H20xA0win11-24h2
Server 20190x9Awinserver-2019
Server 20220x9Ewinserver-2022
Server 20250xA0winserver-2025

Kernel module

ntoskrnl.exeNtCompareSigningLevels

Related APIs

NtGetCachedSigningLevelNtSetCachedSigningLevelWldpQueryDynamicCodeTrustCiCompareSigningLevels

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) == FALSE

asmx64 direct stub (Win11 24H2 / Server 2025, SSN 0xA0)

NtCompareSigningLevels PROC
    mov  r10, rcx
    mov  eax, 0A0h
    syscall
    ret
NtCompareSigningLevels ENDP

MITRE ATT&CK mappings

Last verified: 2026-05-20