CVE-2023-52556
Executive Summary
CVE-2023-52556 is a race condition vulnerability in the pf(4) packet filter of OpenBSD 7.4. The flaw occurs during concurrent processing of network packets and the expiration of packet states, potentially leading to a kernel panic (denial of service). The vulnerability is triggered locally or remotely by an attacker who can send crafted network traffic that exploits the timing window between state creation and expiration. No public exploit code or proof-of-concept is currently available, and the EPSS score is 0.0%, indicating low exploitation activity. The vendor has released an errata patch (errata 009) to address the issue.
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 is not related to a package manager (NPM, PyPI, Go, Ruby) but is a core operating system component (pf(4) packet filter). The supply chain risk is limited to the OpenBSD base system distribution. Users should ensure they are running a patched version of OpenBSD 7.4.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
- Base Score: 5.1 (Medium)
- Attack Vector (AV): Local (L) – The attacker must be able to send packets to the target system.
- Attack Complexity (AC): High (H) – Exploitation requires precise timing to win the race condition.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): None (N) – No user action required.
- Scope (S): Unchanged (U) – The vulnerability does not affect other components.
- Confidentiality (C): None (N) – No data exposure.
- Integrity (I): None (N) – No data modification.
- Availability (A): High (H) – Successful exploitation causes a kernel panic, leading to denial of service.
Threat Level: Medium. The attack complexity is high, but the impact on availability is severe. The vulnerability is not remotely exploitable without network access, but an attacker on the same network segment could trigger a crash.
Deep Dive & Mechanics
The pf(4) packet filter maintains a state table to track active connections. Each state has a timeout, after which it is expired and removed. The race condition occurs when:
- A packet arrives that matches an existing state.
- Simultaneously, the state's timeout expires, and the state is being removed from the table.
- The packet processing code attempts to access the state after it has been freed, leading to a use-after-free or null pointer dereference, causing a kernel panic.
The vulnerability is in the interaction between the packet processing path (e.g., pf_test()) and the state expiration timer (pf_state_expires()). The fix likely involves proper locking or reference counting to ensure that a state is not freed while it is still being referenced by a packet.
Vulnerable vs. Patched Code
The exact code diff is not publicly available, but the patch (errata 009) likely modifies the pf(4) state handling to prevent the race condition. A typical fix would involve:
- Vulnerable: The state expiration function frees the state without checking if it is currently being processed by another thread.
- Patched: The state expiration function acquires a lock or increments a reference count before freeing, ensuring no concurrent access.
// Vulnerable pseudo-code
void pf_state_expire(struct pf_state *s) {
// No lock held
pf_state_unlink(s);
pf_state_free(s);
}
// Patched pseudo-code
void pf_state_expire(struct pf_state *s) {
pf_state_lock(s);
if (s->refcount > 0) {
// Defer free
s->expired = 1;
pf_state_unlock(s);
return;
}
pf_state_unlink(s);
pf_state_free(s);
pf_state_unlock(s);
}
Exploitation & Lab Setup
Red Team
No public exploit code is available. To test the vulnerability in a lab environment:
- Setup: Install OpenBSD 7.4 (unpatched) on a virtual machine with pf enabled.
- Trigger: Send a high volume of crafted TCP/UDP packets that create and immediately expire states. Use a tool like
hping3or a custom script to send packets with short timeouts. - Observation: Monitor the kernel for panics using
dmesgor a crash dump.
# Example using hping3 to flood with SYN packets (state creation)
hping3 -S -p 80 --flood <target_ip>
Blue Team
- Detection: Monitor for kernel panics or system crashes. Use
syslogto capture panic messages. - Mitigation: Apply the patch immediately. If patching is not possible, consider disabling pf or reducing state table size to minimize exposure.
- Forensics: Collect crash dumps (
/var/crash) and analyze withgdborkgdbto identify the race condition.
Indicators of Compromise (IOCs)
- System Logs: Kernel panic messages in
/var/log/messagesordmesgoutput containing references topf,state, orpanic. - Crash Dumps: Files in
/var/crashwith timestamps matching the attack. - Network Traffic: Unusual patterns of short-lived connections or high rates of state creation/expiration.
Detection Engineering
YARA Rule
rule CVE_2023_52556_PF_Race_Condition {
meta:
description = "Detects kernel panic logs related to CVE-2023-52556"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2023-52556"
strings:
$panic1 = "panic: pf: state" ascii wide nocase
$panic2 = "panic: pf_state_expire" ascii wide nocase
$panic3 = "kernel: pf: use-after-free" ascii wide nocase
condition:
any of them
}
Sigma Rule
title: CVE-2023-52556 - OpenBSD pf Race Condition Kernel Panic
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects kernel panic messages indicating exploitation of CVE-2023-52556
author: Valters IT
date: 2025-04-10
references:
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-52556
logsource:
product: openbsd
service: syslog
detection:
selection:
- EventID: 1
Message: "*panic: pf*"
- EventID: 1
Message: "*panic: pf_state*"
condition: selection
falsepositives:
- Legitimate kernel bugs
level: high
Suricata Rule
alert tcp any any -> any any (msg:"CVE-2023-52556 - Potential pf Race Condition Trigger"; flow:to_server; flags:S; threshold:type both, track by_src, count 1000, seconds 1; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Patch: Apply OpenBSD 7.4 errata 009 using
syspatch(8):syspatchOr manually download and apply the patch from the OpenBSD errata page.
Workaround: If patching is not possible, consider:
- Disabling pf:
pfctl -d - Reducing state table size to limit exposure:
set limit states <lower_number> - Implementing network segmentation to limit attack surface.
- Disabling pf:
Monitoring: Enable kernel crash dump collection and monitor for panics.
Long-term: Keep the system updated with the latest errata.
Valters IT
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.