Detection rules › Elastic

Potential CVE-2025-32463 Nsswitch File Creation

Source
github.com/elastic/protections-artifacts

Detects suspicious creation of the nsswitch.conf file, outside of the regular /etc/nsswitch.conf path, consistent with attempts to exploit CVE-2025-32463 (the "sudo chroot" privilege escalation), where an attacker tricks sudo into using attacker-controlled NSS files or libraries to gain root.

MITRE ATT&CK coverage

TacticTechniques
Privilege Escalation

Rule body

[rule]
description = """
Detects suspicious creation of the nsswitch.conf file, outside of the regular /etc/nsswitch.conf path, consistent with
attempts to exploit CVE-2025-32463 (the "sudo chroot" privilege escalation), where an attacker tricks sudo into using
attacker-controlled NSS files or libraries to gain root.
"""
id = "cc81a704-da59-4baf-9b93-c9d893f17ab0"
license = "Elastic License v2"
name = "Potential CVE-2025-32463 Nsswitch File Creation"
os_list = ["linux"]
reference = [
    "https://www.stratascale.com/vulnerability-alert-CVE-2025-32463-sudo-chroot",
    "https://github.com/kh4sh3i/CVE-2025-32463",
]
version = "1.0.6"

query = '''
file where event.type == "creation" and file.path like "/*/etc/nsswitch.conf" and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and not 
(
  process.name in ("bash", "dash") and file.path like (
    "/var/tmp/mkinitramfs_*", "/tmp/tmp.*/mkinitramfs_*", "/tmp/petalinux*/etc/nsswitch.conf",
    "/tmp/selfextract.*/mkinitramfs_*/etc/nsswitch.conf", "/var/tmp/dracut.*/initramfs/etc/nsswitch.conf",
    "/tmp/user/0/mkinitramfs_*/etc/nsswitch.conf", "/opt/mkinitramfs_*/etc/nsswitch.conf",
    "/opt/dumpling-nxp/*/etc/nsswitch.conf", "/tmp/store/vfs/dir/*", "/opt/tmp/mkinitramfs_*",
    "/opt/nvidia_tmpfs/mkinitramfs*"
  )
)
'''

min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1068"
name = "Exploitation for Privilege Escalation"
reference = "https://attack.mitre.org/techniques/T1068/"


[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: file

file where event.type == "creation" and file.path like "/*/etc/nsswitch.conf" and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and not 
(
  process.name in ("bash", "dash") and file.path like (
    "/var/tmp/mkinitramfs_*", "/tmp/tmp.*/mkinitramfs_*", "/tmp/petalinux*/etc/nsswitch.conf",
    "/tmp/selfextract.*/mkinitramfs_*/etc/nsswitch.conf", "/var/tmp/dracut.*/initramfs/etc/nsswitch.conf",
    "/tmp/user/0/mkinitramfs_*/etc/nsswitch.conf", "/opt/mkinitramfs_*/etc/nsswitch.conf",
    "/opt/dumpling-nxp/*/etc/nsswitch.conf", "/tmp/store/vfs/dir/*", "/opt/tmp/mkinitramfs_*",
    "/opt/nvidia_tmpfs/mkinitramfs*"
  )
)

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.pathwildcard/var/tmp/mkinitramfs_*, /tmp/tmp.*/mkinitramfs_*, /tmp/petalinux*/etc/nsswitch.conf, /tmp/selfextract.*/mkinitramfs_*/etc/nsswitch.conf, /var/tmp/dracut.*/initramfs/etc/nsswitch.conf, /tmp/user/0/mkinitramfs_*/etc/nsswitch.conf, /opt/mkinitramfs_*/etc/nsswitch.conf, /opt/dumpling-nxp/*/etc/nsswitch.conf, /tmp/store/vfs/dir/*, /opt/tmp/mkinitramfs_*, /opt/nvidia_tmpfs/mkinitramfs*excludes:file.path
process.nameinbash, dashexcludes:process.name field:"process.name" value:"bash" field:"process.name" value:"dash"

Indicators

These rows show field, operator, and value matches.