Skip to content

Conversation

@tomsonpl
Copy link
Contributor

@tomsonpl tomsonpl commented Nov 29, 2025

Disks & Volumes Artifact

The Disks & Volumes artifact provides comprehensive visibility into physical storage hardware across Windows, Linux, and macOS systems. This information is essential for asset inventory, hardware verification, and forensic investigations involving storage device analysis, removable media detection, and system baseline comparisons.

Core Forensic Artifacts Coverage

# Artifact OS Query File Description
10 Disks & Volumes Windows disk_info_windows_elastic d8a1b2c3 Physical disk hardware inventory via WMI
10a Disks & Volumes Linux disk_info_linux_macos_elastic e9f2c3d4 Block devices with mount information
10b Disks & Volumes macOS disk_info_linux_macos_elastic e9f2c3d4 Block devices with mount information

Queries by Platform


🪟 Windows - Physical Disk Hardware Inventory

Description

Retrieve physical disk hardware information on Windows systems including manufacturer, model, serial number, size, and interface type. Useful for asset inventory and hardware verification.

Detection Focus:

  • Hardware asset inventory and tracking
  • Removable storage device detection
  • System baseline comparison for forensic analysis
  • Disk serial number verification for chain of custody

Result

Screenshot 2025-12-08 at 12 09 52

Query results will show all physical disks with their hardware identifiers, manufacturers, models, serial numbers, partition counts, and sizes in both bytes and human-readable GB format.

Platform

windows

Interval

3600 seconds (1 hour)

Query ID

disk_info_windows_elastic

ECS Field Mappings

Static Values:

  • event.category["host"]
  • event.type["info"]
  • event.moduleosquery
  • event.datasetosquery.disk_info
  • host.os.typewindows
  • tags["osquery", "inventory", "disk", "windows"]

Field Mappings:

  • host.disk.device.namedevice_name
  • host.disk.device.serial_numberserial
  • host.disk.device.vendorvendor
  • host.disk.device.modelmodel
  • host.disk.device.typedevice_type

SQL Query

-- Windows physical disk hardware inventory
-- Source: disk_info table (WMI Win32_DiskDrive)
-- Use case: Asset inventory, hardware verification
SELECT
    disk_index,
    name AS device_name,
    id,
    pnp_device_id,
    type AS device_type,
    manufacturer AS vendor,
    hardware_model AS model,
    serial,
    description,
    partitions,
    disk_size,
    -- Convert to human-readable size
    ROUND(disk_size / 1073741824.0, 2) AS disk_size_gb
FROM disk_info;

🐧 Linux / 🍎 macOS - Block Device Inventory with Mount Information

Description

Retrieve physical disk hardware information on Linux and macOS systems. Filters out loop devices, snap mounts, and virtual filesystems to show only real storage devices. Cross-platform equivalent to Windows disk_info query.

Detection Focus:

  • Physical storage device enumeration
  • Mount point and filesystem analysis
  • Storage utilization monitoring
  • Removable media and external drive detection
  • Virtual machine disk identification

Result

Screenshot 2025-12-08 at 12 09 59 Screenshot 2025-12-08 at 12 10 26

Query results will show block devices with vendor, model, type, UUID, size, mount points, filesystem types, usage percentages, and available space. Automatically filters noise from snap packages, virtual filesystems, and system mounts.

Platform

linux,darwin

Interval

3600 seconds (1 hour)

Query ID

disk_info_linux_macos_elastic

ECS Field Mappings

Static Values:

  • event.category["host"]
  • event.type["info"]
  • event.moduleosquery
  • event.datasetosquery.disk_info
  • tags["osquery", "inventory", "disk", "linux", "macos"]

Field Mappings:

  • host.disk.device.namedevice_name
  • host.disk.device.vendorvendor
  • host.disk.device.modelmodel
  • host.disk.device.typedevice_type
  • file.pathmount_point

SQL Query

-- Linux/macOS physical disk inventory
-- Source: block_devices + mounts tables
-- Filters out: loop devices, snap mounts, disk images, virtual filesystems
SELECT
    bd.name AS device_name,
    bd.vendor,
    bd.model,
    bd.type AS device_type,
    bd.uuid,
    ROUND((bd.size * bd.block_size) / 1073741824.0, 2) AS size_gb,
    m.path AS mount_point,
    m.type AS filesystem_type,
    CASE
        WHEN m.blocks > 0 THEN
            ROUND(100.0 * (m.blocks - m.blocks_free) / m.blocks, 2)
        ELSE NULL
    END AS usage_percent,
    ROUND((m.blocks_available * m.blocks_size) / 1073741824.0, 2) AS available_gb
FROM block_devices bd
LEFT JOIN mounts m ON (
    m.device LIKE '%' || bd.name || '%'
    OR m.device_alias LIKE '%' || bd.name || '%'
)
WHERE bd.name != ''
  AND bd.type != ''
  -- Filter out loop devices (snap packages on Linux)
  AND bd.name NOT LIKE 'loop%'
  AND bd.name NOT LIKE '/dev/loop%'
  -- Filter out disk images only (keep Virtual Interface for VMs)
  AND bd.type != 'Disk Image'
  -- Filter out squashfs (snap), devtmpfs, tmpfs, overlay
  AND COALESCE(m.type, '') NOT IN ('squashfs', 'devtmpfs', 'tmpfs', 'overlay', 'autofs')
  -- Filter out snap mount paths
  AND COALESCE(m.path, '') NOT LIKE '/snap/%'
  -- Filter out macOS system asset paths
  AND COALESCE(m.path, '') NOT LIKE '/System/Library/Assets%'
  -- Only show primary mount points (avoid duplicates)
  AND (
    m.path IS NULL
    OR m.path IN ('/', '/boot', '/boot/efi', '/home', '/var', '/tmp', '/opt')
    OR m.path LIKE '/Volumes/%'
    OR m.path LIKE '/mnt/%'
    OR m.path LIKE '/media/%'
  );

- Add disk_info_windows_elastic query using disk_info table (Windows)
- Add disk_info_linux_macos_elastic query using block_devices + mounts tables
- Linux/macOS query filters out loop devices, snap mounts, disk images
- Update artifacts_matrix.md to reflect new coverage (3/46 = 6.5%)
@tomsonpl tomsonpl marked this pull request as ready for review December 1, 2025 07:55
@tomsonpl tomsonpl requested a review from a team as a code owner December 1, 2025 07:55
@tomsonpl tomsonpl requested review from gergoabraham and paul-tavares and removed request for a team December 1, 2025 07:55
@andrewkroh andrewkroh added documentation Improvements or additions to documentation. Applied to PRs that modify *.md files. Integration:osquery_manager Osquery Manager Team:Defend Workflows Security team for Endpoint and OSQuery workflows [elastic/security-defend-workflows] labels Dec 1, 2025
- Add ECS event fields (event.category, event.type, event.module, event.dataset)
- Fix ECS namespace: observer.* → host.disk.device.* for proper disk field mappings
- Add column aliases (name→device_name, manufacturer→vendor, etc.) for ECS alignment
- Add host.os.type for Windows query
- Add descriptive tags for query categorization
- Update coreMigrationVersion to 9.2.0
@elasticmachine
Copy link

💚 Build Succeeded

History

@tomsonpl tomsonpl requested review from calladoum-elastic and removed request for gergoabraham and paul-tavares December 8, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation. Applied to PRs that modify *.md files. Integration:osquery_manager Osquery Manager Team:Defend Workflows Security team for Endpoint and OSQuery workflows [elastic/security-defend-workflows]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants