Osquerybeat: Add elastic_ntfs_volumes and elastic_ntfs_partitions tables to osquery extension#50131
Conversation
|
This pull request doesn't have a |
🤖 GitHub commentsJust comment with:
|
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
|
I gave claude access to run osquery queries against our extension, and asked it to validate our table results for accuracy. Accuracy Test: elastic_ntfs_volumes & elastic_ntfs_partitionsDate: 2026-04-14 Test Environment
Comparison sources used:
elastic_ntfs_volumesRaw output
Comparison against logical_drivesVolume enumeration: PASS — all 5 volumes (C:–G:) are found by both tables.
Observation — FAT subtype: Unique value-add vs logical_drives:
Gap vs logical_drives: No size or free-space data. A JOIN with elastic_ntfs_partitionsRaw outputPhysicalDrive0 (4 partitions):
PhysicalDrive1 (4 partitions):
Comparison against device_partitions (Trail of Bits / TSK)
Offset alignment — PASS for all partitionsEvery TSK
Partition size comparisonTSK
The NTFS discrepancy is structural, not an error: TSK counts filesystem clusters (the NTFS volume reports one fewer cluster than the raw partition size because the last cluster is reserved as the boot-sector backup). The Windows API used by FSType naming
Partition count vs disk_info
Unique value-add vs device_partitions
Summary
|
|
closing in favor of #50140 |
Proposed commit message
Adds two new Windows-only tables to the Elastic osquery extension:
elastic_ntfs_volumes— Enumerates all mounted volumes on the system using the Windows Volume Management APIs. Provides the underlying physical device path (\.\PhysicalDriveN), device type (DISK vs CD_ROM), drive letter, volume label, and filesystem name. Fills a gap in logical_drives, which provides size/free-space but omits device path,device type, and volume label.
elastic_ntfs_partitions— Enumerates all GPT/MBR partition table entries per physical disk using IOCTL_DISK_GET_DRIVE_LAYOUT_EX. Reports partition number, style (GPT/MBR/RAW), type name (System/Reserved/Basic/Recovery), GUID, starting offset, byte length, drive letter assignment, and GPT attributes flags (RequiredPartition, NoDriveLetter).Implementation
Both tables share a single implementation package (pkg/ntfs) backed by an LRU cache to avoid redundant device enumeration within a single query. The package is structured around three layers:
Testing
Accuracy verified live against a Windows 11 host with two virtual NVMe disks (5 volumes, 8 partitions total). See comment below with a claude built testing report
Checklist
stresstest.shscript to run them under stress conditions and race detector to verify their stability../changelog/fragmentsusing the changelog tool.Disruptive User Impact
How to test this PR locally
Related issues
Use cases
Screenshots
Logs