NtQueryInformationAtom
Liefert Metadaten zu einem einzelnen Atom oder zur gesamten globalen Atom-Tabelle — Name, Refcount, Pin-Count, Nutzungszähler.
Prototyp
NTSTATUS NtQueryInformationAtom( RTL_ATOM Atom, ATOM_INFORMATION_CLASS InformationClass, PVOID AtomInformation, ULONG AtomInformationLength, PULONG ReturnLength );
Argumente
| Name | Type | Dir | Description |
|---|---|---|---|
| Atom | RTL_ATOM | in | Abzufragende Atom-ID. Ignoriert wenn InformationClass = AtomTableInformation (Komplett-Dump). |
| InformationClass | ATOM_INFORMATION_CLASS | in | AtomBasicInformation (pro Atom: Name + Refcount + Pin) oder AtomTableInformation (Anzahl + ID-Liste). |
| AtomInformation | PVOID | out | Aufrufer-Puffer, der eine ATOM_BASIC_INFORMATION- oder ATOM_TABLE_INFORMATION-Struktur empfängt. |
| AtomInformationLength | ULONG | in | Größe von AtomInformation in Bytes. |
| ReturnLength | PULONG | out | Empfängt die tatsächlich geschriebenen Bytes. Wird zur Dimensionierung eines Folgeaufrufs bei STATUS_BUFFER_TOO_SMALL genutzt. |
Syscall-IDs pro Windows-Version
| Windows-Version | Syscall-ID | Build |
|---|---|---|
| Win10 1507 | 0x12F | win10-1507 |
| Win10 1607 | 0x135 | win10-1607 |
| Win10 1703 | 0x13A | win10-1703 |
| Win10 1709 | 0x13D | win10-1709 |
| Win10 1803 | 0x13F | win10-1803 |
| Win10 1809 | 0x140 | win10-1809 |
| Win10 1903 | 0x141 | win10-1903 |
| Win10 1909 | 0x141 | win10-1909 |
| Win10 2004 | 0x147 | win10-2004 |
| Win10 20H2 | 0x147 | win10-20h2 |
| Win10 21H1 | 0x147 | win10-21h1 |
| Win10 21H2 | 0x148 | win10-21h2 |
| Win10 22H2 | 0x148 | win10-22h2 |
| Win11 21H2 | 0x14E | win11-21h2 |
| Win11 22H2 | 0x150 | win11-22h2 |
| Win11 23H2 | 0x150 | win11-23h2 |
| Win11 24H2 | 0x152 | win11-24h2 |
| Server 2016 | 0x135 | winserver-2016 |
| Server 2019 | 0x140 | winserver-2019 |
| Server 2022 | 0x14D | winserver-2022 |
| Server 2025 | 0x152 | winserver-2025 |
Kernel-Modul
Verwandte APIs
Syscall-Stub
4C 8B D1 mov r10, rcx B8 52 01 00 00 mov eax, 0x152 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
Undokumentierte Hinweise
Das Lese-Gegenstück zu NtAddAtom. Die Klasse `AtomBasicInformation` liefert eine `ATOM_BASIC_INFORMATION` mit UsageCount (Refcount), Flags (pinned vs. ordinary), NameLength (in Bytes) und den eigentlichen Name-Bytes — und wie bei NtAddAtom gibt der Kernel die rohen gespeicherten Bytes zurück, unabhängig von UTF-16-Gültigkeit. Die Klasse `AtomTableInformation` liefert den Atom-Count gefolgt von einem Array aller RTL_ATOM-IDs — effektiv eine Voll-Enumerationsprimitive. Die Win32-Wrapper `GlobalGetAtomNameW` und `GetAtomNameW` sind der häufigste Pfad; Stealth-Tools und die WinDbg-Extension !atom verwenden den rohen Syscall.
Häufige Malware-Nutzung
**Atom-Bombing-Stage-2**: dieser Syscall führt den Cross-Process-Speicher-Write durch — die Malware queued eine APC ins Ziel, die `GlobalGetAtomNameA` aufruft, was intern NtQueryInformationAtom ruft; der Kernel selbst schreibt die Atom-'Namens'-Bytes (den geschmuggelten Shellcode) in den Puffer im Adressraum des Ziels. Da der Write vom Kernel im Auftrag des Ziels erfolgt, sehen NtWriteVirtualMemory-Hooks im User-Mode nichts. **Stealth-IPC-Inspektion**: Red-Team- und Persistenz-Monitoring-Tools rufen AtomTableInformation auf, um die gesamte globale Atom-Tabelle zu dumpen und nach binären Resten, übergroßen Einträgen oder bekannten schlechten Namen zu suchen — dieselbe Primitive, die defensiv Atom-Bomb-Reste erkennt, kann offensiv den Live-IPC-Zustand legitimer Apps auslesen (Office-DDE-Topics, IME-State, registrierte Explorer-Klassennamen).
Erkennungsmöglichkeiten
AtomBasicInformation-Aufrufe passieren ständig über GlobalGetAtomName — jedes Drag-and-Drop, jede COM-Marshalling-Runde, jede DDE-Konversation. Die Erkennung muss sich auf den Kontext konzentrieren: AtomBasicInformation gerufen aus einem Thread, der gerade über NtTestAlert / KiUserApcDispatcher in einen frisch allozierten Puffer resumed wurde, ist der kanonische Atom-Bomb-Stage-2-Indikator (EDRs mit den 2017er Atom-Bomb-Regeln suchen genau das). AtomTableInformation ist in normalen Code-Pfaden seltener und ein etwas stärkeres Signal — ein Nicht-System-Prozess, der es aufruft, lohnt einen Pivot. WinDbg / forensischer Snapshot der globalen Atom-Tabelle (`!atom`) ist die orthogonale Blue-Team-Primitive — alles mit binären Bytes oder Länge > einigen hundert ist verdächtig.
Direkte Syscall-Beispiele
asmx64 direct stub (Win11 24H2)
; Direct syscall stub for NtQueryInformationAtom (SSN 0x152 on Win11 24H2)
NtQueryInformationAtom PROC
mov r10, rcx ; syscall convention
mov eax, 152h ; SSN — varies per build
syscall
ret
NtQueryInformationAtom ENDPcAtom Bombing — stage 2 (kernel writes shellcode into target)
// Inside the victim process, the queued APC runs this code.
// GlobalGetAtomNameA -> NtQueryInformationAtom -> kernel copies the atom
// 'name' bytes (which were our shellcode in stage 1) into 'buf'.
#include <windows.h>
VOID StageTwoApc(PVOID context) {
USHORT atomId = (USHORT)(ULONG_PTR)context;
char buf[4096]; // attacker-sized to fit the shellcode
UINT got = GlobalGetAtomNameA(atomId, buf, sizeof(buf));
// Stage 3 (not shown): NtSetContextThread / ROP -> NtProtectVirtualMemory
// flips buf to RWX and pivots execution into it.
(void)got;
}cAtom table enumeration (defensive or offensive)
// Dump every atom in the global table and print its name + refcount.
// Use defensively: hunt for binary residue (Atom Bomb IOC).
// Use offensively: read live IPC state (DDE topics, IME state).
#include <windows.h>
#include <winternl.h>
#include <stdio.h>
typedef struct _ATOM_TABLE_INFORMATION {
ULONG NumberOfAtoms;
USHORT Atoms[1];
} ATOM_TABLE_INFORMATION;
typedef struct _ATOM_BASIC_INFORMATION {
USHORT UsageCount;
USHORT Flags;
USHORT NameLength;
WCHAR Name[1];
} ATOM_BASIC_INFORMATION;
typedef NTSTATUS (NTAPI *pNtQueryInformationAtom)(
USHORT, ULONG, PVOID, ULONG, PULONG);
VOID DumpAtomTable(VOID) {
pNtQueryInformationAtom NtQueryInformationAtom = (pNtQueryInformationAtom)
GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtQueryInformationAtom");
BYTE tbuf[8192]; ULONG ret = 0;
if (NtQueryInformationAtom(0, /*AtomTableInformation*/ 1,
tbuf, sizeof(tbuf), &ret) < 0) return;
ATOM_TABLE_INFORMATION* ti = (ATOM_TABLE_INFORMATION*)tbuf;
for (ULONG i = 0; i < ti->NumberOfAtoms; ++i) {
BYTE abuf[1024]; ULONG ar = 0;
if (NtQueryInformationAtom(ti->Atoms[i], /*AtomBasicInformation*/ 0,
abuf, sizeof(abuf), &ar) < 0) continue;
ATOM_BASIC_INFORMATION* ai = (ATOM_BASIC_INFORMATION*)abuf;
wprintf(L"0x%04X rc=%u name=%.*s\n",
ti->Atoms[i], ai->UsageCount, ai->NameLength / 2, ai->Name);
}
}MITRE ATT&CK-Mappings
Last verified: 2026-05-20