CVE-2026-5358
Executive Summary
CVE-2026-5358 is a critical heap-based buffer overflow vulnerability in the GNU C Library (glibc) version 2.43 and older, specifically within the obsolete nis_local_principal function. This function, part of the deprecated Network Information Service (NIS) subsystem, can overflow a buffer in the data section when processing a crafted UDP response. An unauthenticated, remote attacker can exploit this to overwrite neighboring static data in the requesting application, leading to arbitrary code execution, data corruption, or denial of service. The vulnerability has a CVSS score of 9.1 (Critical) and currently has no known patch or public exploit code. NIS support has been deprecated since glibc 2.26, and applications are strongly advised to migrate to modern identity services.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects the core system library (glibc) used by virtually all Linux distributions. Any application that links against glibc and uses the deprecated NIS functions is at risk. The supply chain impact is severe because glibc is a foundational component; a compromise can cascade to all dependent services. No package-specific mitigations exist beyond disabling NIS entirely.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The attack is performed remotely over the network.
- Attack Complexity (AC): Low (L) – No special conditions are required; the attacker only needs to send a crafted UDP response.
- Privileges Required (PR): None (N) – No authentication is needed.
- User Interaction (UI): None (N) – The victim does not need to perform any action.
- Scope (S): Unchanged (U) – The exploit cannot affect resources beyond the vulnerable component.
- Confidentiality (C): High (H) – Full disclosure of memory contents is possible.
- Integrity (I): High (H) – Arbitrary data can be overwritten.
- Availability (A): High (H) – The service can be crashed or controlled.
Threat Level: Critical. The combination of network exploitability, no authentication, and high impact makes this a top-priority vulnerability for any system still using NIS.
Deep Dive & Mechanics
The nis_local_principal function is used to retrieve the NIS principal name for the local host. It constructs a UDP request to the NIS server and waits for a response. The vulnerability lies in how the function handles the response buffer:
- Buffer Allocation: The function allocates a fixed-size buffer in the data section (BSS or data segment) to store the response.
- UDP Response Handling: When a UDP response arrives, the function copies the response data into this buffer without proper bounds checking.
- Overflow: An attacker can spoof a crafted UDP response that exceeds the allocated buffer size, causing a heap-based overflow. This overwrites adjacent static data, such as function pointers, global variables, or other critical structures.
- Exploitation: By carefully crafting the overflow data, an attacker can redirect execution flow, modify security settings, or cause a denial of service.
The attack is particularly dangerous because NIS responses are not authenticated, and the function does not validate the source of the response. Any attacker on the network can send a malicious UDP packet to the vulnerable service.
Vulnerable vs. Patched Code
Vulnerable Code (glibc <= 2.43):
// Simplified vulnerable code
char buffer[256]; // Fixed-size buffer in data section
int nis_local_principal(...) {
// ... setup UDP socket ...
recvfrom(sock, buffer, sizeof(buffer), 0, ...); // No size check
// ... process buffer ...
}
Patched Code (hypothetical fix):
// Patched code with bounds checking
char buffer[256];
int nis_local_principal(...) {
// ... setup UDP socket ...
ssize_t received = recvfrom(sock, buffer, sizeof(buffer) - 1, 0, ...);
if (received < 0 || received >= sizeof(buffer)) {
// Handle error or truncate
return -1;
}
buffer[received] = '\0';
// ... process buffer ...
}
The fix would involve validating the received data length against the buffer size before copying, and truncating or rejecting oversized responses.
Exploitation & Lab Setup
Red Team (Offensive)
Lab Setup:
- Target: A Linux machine running glibc 2.43 with NIS enabled (e.g.,
ypbindservice active). - Attacker: Any machine on the same network segment.
- Tools: Python with
scapyor raw sockets, a custom UDP spoofing script.
Exploitation Steps:
- Identify Target: Scan for hosts with NIS services (port 111 for portmapper, then query for NIS).
- Craft Payload: Create a UDP packet that mimics a legitimate NIS response but contains a payload larger than the expected buffer size.
- Spoof Response: Send the crafted packet to the target's ephemeral port used by
nis_local_principal. The attacker must guess or observe the source port and transaction ID. - Trigger Overflow: The vulnerable function copies the oversized payload into the fixed buffer, overwriting adjacent data.
- Achieve Code Execution: Overwrite a function pointer or return address with a controlled value to redirect execution to shellcode.
Example Python Script (Conceptual):
import socket
import struct
def exploit(target_ip, target_port, transaction_id):
# Craft oversized NIS response
payload = b"A" * 300 # Overflow buffer
# Build UDP packet with spoofed source
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(payload, (target_ip, target_port))
Note: No public exploit code is available; this is a conceptual demonstration.
Blue Team (Defensive)
Detection:
- Monitor for unexpected UDP traffic on NIS-related ports (typically 111, 746, 747, or ephemeral ports).
- Look for oversized UDP packets destined for NIS services.
- Use network intrusion detection systems (NIDS) to flag anomalous NIS responses.
Mitigation:
- Immediate: Disable NIS entirely if not required. Remove
ypbind,ypserv, and related packages. - Network: Block NIS ports at the firewall (UDP 111, 746, 747, and any RPC ports).
- Monitoring: Enable logging for all NIS-related activities and alert on any NIS traffic.
Indicators of Compromise (IOCs)
- Network IOCs:
- UDP packets with source port 111 or 746/747 containing unusually large payloads (>256 bytes).
- Multiple NIS responses from unexpected IP addresses.
- Spoofed UDP packets with mismatched transaction IDs.
- Host IOCs:
- Unexpected crashes or segmentation faults in applications using NIS.
- Presence of shellcode or abnormal memory patterns in core dumps.
- Unusual processes spawned by NIS-related daemons.
- File IOCs:
- Modified
/etc/nsswitch.confentries related to NIS. - Suspicious entries in
/var/log/messagesor/var/log/syslogindicating NIS errors.
- Modified
Detection Engineering
YARA Rule
rule CVE_2026_5358_NIS_Overflow {
meta:
description = "Detects oversized NIS UDP responses indicative of CVE-2026-5358 exploitation"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2026-5358"
strings:
$nis_magic = { 00 00 00 00 } // NIS response magic bytes (example)
$overflow = /.{300,}/ // Payload > 256 bytes
condition:
$nis_magic at 0 and #overflow > 0
}
Sigma Rule
title: CVE-2026-5358 NIS Buffer Overflow Detection
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects oversized UDP packets targeting NIS services
author: Valters IT
logsource:
category: network
product: suricata
detection:
selection:
dest_port:
- 111
- 746
- 747
ip_protocol: UDP
length: > 256
condition: selection
falsepositives:
- Legitimate large NIS responses (rare)
level: high
Suricata Rule
alert udp any any -> any 111,746,747 (msg:"CVE-2026-5358 NIS Buffer Overflow Attempt"; content:"|00 00 00 00|"; offset:0; depth:4; byte_test:2,>,256,4; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Action: Disable NIS on all systems. Remove or stop the
ypbind,ypserv, andypxfrdservices.systemctl stop ypbind systemctl disable ypbind apt-get remove nis # Debian/Ubuntu yum remove ypbind # RHEL/CentOS - Network Hardening: Block all NIS-related ports (UDP 111, 746, 747) at the firewall.
- Migration: Replace NIS with modern alternatives like LDAP, Kerberos, or FreeIPA.
- Patch Monitoring: Since no official patch exists, monitor glibc updates from your distribution vendor. Apply any patch that addresses buffer overflow in NIS functions.
- Compensating Controls: If NIS cannot be disabled immediately, restrict NIS traffic to trusted networks only using firewall rules or VLAN segmentation.
Valters IT
DevSecOps & Cyber Threat Intelligence Division
{/* [Security Hash: 15E90BAEFEBF3BE2831443E7] */}