CVE-2022-23093 Overview
CVE-2022-23093 is a stack buffer overflow vulnerability in FreeBSD's ping utility that occurs during the processing of raw IP packets in the pr_pack() function. The vulnerability arises when the function copies received IP and ICMP headers into stack buffers without properly accounting for the possible presence of IP option headers, resulting in a buffer overflow of up to 40 bytes.
When processing ICMP responses, the ping utility must reconstruct the IP header, ICMP header, and potentially a "quoted packet" that represents the packet which generated an ICMP error. The quoted packet also contains its own IP and ICMP headers. The failure to validate IP option header lengths before copying data into fixed-size stack buffers creates a memory safety issue that can be triggered remotely.
Critical Impact
A remote attacker can crash the ping process by sending specially crafted ICMP responses containing IP option headers, causing denial of service. The ping process runs in a capability mode sandbox, limiting further exploitation potential.
Affected Products
- FreeBSD 12.3 (including patch levels p1 through p9 and beta1)
- FreeBSD 12.4-RC2-p1
- FreeBSD 13.1 (including patch levels p1 through p4, beta, and RC releases)
Discovery Timeline
- 2024-02-15 - CVE CVE-2022-23093 published to NVD
- 2025-06-04 - Last updated in NVD database
Technical Details for CVE-2022-23093
Vulnerability Analysis
The vulnerability exists in the pr_pack() function within the FreeBSD ping utility. This function is responsible for processing incoming ICMP echo reply packets and extracting relevant information for display to the user.
When an ICMP packet arrives, pr_pack() performs several header reconstruction operations. It copies the IP header and ICMP header from the received packet into local stack buffers. Additionally, for ICMP error responses, it processes a "quoted packet" embedded within the ICMP payload that contains the original packet that triggered the error.
The core issue is that IP packets can contain optional header fields following the standard 20-byte IP header. These IP options can add up to 40 additional bytes to the header. The pr_pack() function allocates fixed-size buffers based on the minimum IP header size and fails to check for or accommodate these variable-length option fields before performing copy operations.
While this vulnerability enables remote triggering of a crash condition, the security impact is partially mitigated by FreeBSD's use of Capsicum capability mode sandboxing for the ping process. At the point where the buffer overflow occurs, the process is already constrained in its ability to interact with the rest of the system, limiting the potential for exploitation beyond denial of service.
Root Cause
The root cause is a classic buffer overflow (CWE-120) resulting from inadequate bounds checking. The pr_pack() function uses fixed-size stack buffers sized for standard IP and ICMP headers without accounting for the variable-length IP options field. When IP options are present in either the response packet or the quoted packet, the copy operation writes beyond the allocated buffer boundaries by up to 40 bytes—the maximum size of the IP options field.
Attack Vector
The attack can be executed remotely over a network connection. An attacker needs to be able to send ICMP packets that will be received by a vulnerable FreeBSD system running the ping utility. The attack works by crafting ICMP responses (or error messages) containing IP headers with option fields that exceed the expected header size.
The attacker would need to either:
- Respond to legitimate ping requests from the target system with malformed ICMP echo replies containing IP options
- Send unsolicited ICMP error messages (such as Destination Unreachable or Time Exceeded) containing quoted packets with IP options
The vulnerability can be exploited without authentication and requires no user interaction beyond the normal use of the ping command.
Detection Methods for CVE-2022-23093
Indicators of Compromise
- Unexpected ping process crashes or core dumps on FreeBSD systems
- ICMP packets containing unusually large IP option headers in network traffic captures
- Repeated ping utility failures when communicating with specific remote hosts
Detection Strategies
- Monitor for abnormal termination of ping processes, particularly SIGSEGV signals indicating memory corruption
- Implement network intrusion detection rules to flag ICMP packets with IP option lengths exceeding normal thresholds
- Deploy endpoint detection to identify stack buffer overflow patterns in ping utility execution
- Review system logs for core dumps associated with /sbin/ping or /usr/sbin/ping
Monitoring Recommendations
- Configure process monitoring to alert on unexpected ping utility terminations
- Enable core dump collection and analysis for post-incident forensics
- Monitor network traffic for anomalous ICMP packets with extended IP option fields
- Implement SentinelOne's behavioral AI detection to identify potential exploitation attempts targeting system utilities
How to Mitigate CVE-2022-23093
Immediate Actions Required
- Apply the security patches provided by FreeBSD immediately
- Review and update all FreeBSD systems to patched versions
- Consider restricting ping utility usage to trusted environments until patches are applied
- Monitor for unusual ICMP traffic patterns targeting vulnerable systems
Patch Information
FreeBSD has released security patches addressing this vulnerability. The official security advisory is available at the FreeBSD Security Advisory SA-22:15. Organizations should update to the latest patched versions of FreeBSD 12.3-RELEASE, 12.4-RELEASE, or 13.1-RELEASE as specified in the advisory.
The patch modifies the pr_pack() function to properly account for IP option headers when calculating buffer sizes, ensuring that copy operations do not exceed allocated buffer boundaries.
Workarounds
- Restrict use of the ping utility to trusted network environments only
- Implement firewall rules to filter incoming ICMP packets with suspicious IP option configurations
- Consider using alternative network diagnostic tools that do not have this vulnerability
- Apply network-level filtering to drop ICMP packets with abnormally large IP option headers
# Example: FreeBSD pf firewall rule to log suspicious ICMP traffic
# Add to /etc/pf.conf
block in log quick proto icmp all
pass in proto icmp icmp-type echoreq keep state
pass in proto icmp icmp-type echorep keep state
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


