CVE-2023-40547 Overview
A remote code execution vulnerability was discovered in Shim, the UEFI bootloader used by many Linux distributions to enable Secure Boot support. The Shim boot support trusts attacker-controlled values when parsing an HTTP response, allowing a completely controlled out-of-bounds write primitive that can lead to complete system compromise. This vulnerability is particularly dangerous as it operates during the early boot phase, before the operating system's security controls are active.
Critical Impact
This vulnerability enables attackers to achieve complete system compromise by exploiting a flaw in HTTP response parsing during the Secure Boot process. An attacker with adjacent network access who can perform a Man-in-the-Middle attack or compromise the boot server can execute arbitrary code before the operating system loads, effectively bypassing all OS-level security protections.
Affected Products
- Red Hat Shim (all affected versions)
- Red Hat Enterprise Linux 7.0
- Red Hat Enterprise Linux 8.0
- Red Hat Enterprise Linux 9.0
Discovery Timeline
- 2024-01-25 - CVE-2023-40547 published to NVD
- 2024-11-21 - Last updated in NVD database
Technical Details for CVE-2023-40547
Vulnerability Analysis
This vulnerability stems from improper input validation in Shim's HTTP boot functionality (CWE-787: Out-of-Bounds Write, CWE-346: Origin Validation Error). When Shim processes HTTP responses during network boot operations, it fails to properly validate attacker-controlled values embedded in the response data. This oversight creates a completely controlled out-of-bounds write primitive.
The attack requires adjacent network access, meaning the attacker must be on the same network segment as the target system. The exploitation complexity is high because the attacker must either perform a Man-in-the-Middle attack on the HTTP boot traffic or compromise the boot server itself. However, successful exploitation requires no privileges or user interaction, and the impact crosses security boundaries affecting confidentiality, integrity, and availability at the highest level.
Root Cause
The root cause of CVE-2023-40547 lies in Shim's implicit trust of values received in HTTP responses during the boot process. The HTTP response parsing code does not adequately validate size fields and buffer boundaries before using attacker-supplied data in memory operations. This lack of proper bounds checking allows an attacker to specify malicious values that cause writes beyond the intended buffer boundaries, creating an out-of-bounds write condition. Because this occurs during the early boot phase before operating system security mechanisms are active, the attacker gains complete control over the boot process.
Attack Vector
The attack vector requires adjacent network positioning (such as the same local network or VLAN) and follows this exploitation path:
- Positioning: The attacker gains a position on the same network segment as a target system configured for HTTP boot
- Interception: The attacker either performs a Man-in-the-Middle attack on the HTTP boot traffic or compromises the legitimate boot server
- Malicious Response Crafting: The attacker crafts a malicious HTTP response containing specially designed values that trigger the out-of-bounds write
- Memory Corruption: When the target system boots and Shim processes the malicious HTTP response, the controlled out-of-bounds write corrupts memory in a way that allows code execution
- Complete Compromise: The attacker achieves arbitrary code execution during the pre-boot phase, gaining complete control of the system before any operating system security protections are loaded
This early-boot exploitation is particularly severe because it can be used to install persistent bootkits, bypass Secure Boot protections, and establish footholds that survive operating system reinstallation.
Detection Methods for CVE-2023-40547
Indicators of Compromise
- Unexpected changes to Shim bootloader binary or configuration files
- Anomalous HTTP traffic patterns during system boot sequences
- Unauthorized modifications to UEFI boot variables or boot order
- Network traffic containing malformed HTTP responses targeting boot services
- Evidence of Man-in-the-Middle attacks on local network segments where HTTP boot is used
Detection Strategies
- Monitor network traffic for suspicious HTTP responses to systems during boot operations, particularly responses with unusual size fields or malformed headers
- Implement Secure Boot attestation monitoring to detect unauthorized changes to the boot chain
- Deploy network intrusion detection signatures for anomalous HTTP boot traffic patterns
- Use endpoint detection solutions capable of monitoring UEFI/pre-boot integrity
Monitoring Recommendations
- Enable logging for DHCP and boot server communications on network infrastructure
- Implement boot integrity measurement and attestation using TPM where available
- Monitor for ARP spoofing or other Man-in-the-Middle indicators on network segments with HTTP boot-enabled systems
- Regularly audit Shim versions across enterprise systems and correlate with vulnerability status
How to Mitigate CVE-2023-40547
Immediate Actions Required
- Update Shim to the patched version provided by your Linux distribution vendor immediately
- Review and restrict network access to systems that use HTTP boot functionality
- Consider disabling HTTP boot on systems where it is not required
- Implement network segmentation to isolate boot infrastructure from general network traffic
- Monitor for Man-in-the-Middle attack indicators on network segments with boot servers
Patch Information
Red Hat has released multiple security advisories addressing this vulnerability. Organizations should apply the appropriate patches based on their specific Red Hat Enterprise Linux version:
- Red Hat Security Advisory RHSA-2024:1834
- Red Hat Security Advisory RHSA-2024:1835
- Red Hat Security Advisory RHSA-2024:1873
- Red Hat Security Advisory RHSA-2024:1876
- Red Hat Security Advisory RHSA-2024:1883
- Red Hat Security Advisory RHSA-2024:1902
- Red Hat Security Advisory RHSA-2024:1903
- Red Hat Security Advisory RHSA-2024:1959
- Red Hat Security Advisory RHSA-2024:2086
Debian users should refer to the Debian LTS Announcement from May 2024 for applicable patches.
For detailed vulnerability information, see the Red Hat CVE-2023-40547 Details page and Red Hat Bugzilla Report #2234589.
Workarounds
- Disable HTTP boot in UEFI/BIOS settings if network boot functionality is not required for the system
- Switch to HTTPS boot where supported to provide encryption and integrity protection for boot traffic
- Implement network-level controls such as 802.1X authentication and DHCP snooping to prevent unauthorized boot server impersonation
- Use boot server infrastructure on isolated, dedicated network segments with strict access controls
- Enable Secure Boot with properly enrolled keys and monitor for boot integrity violations
# Check current Shim version on Red Hat-based systems
rpm -q shim-x64
# Verify Secure Boot status
mokutil --sb-state
# Update Shim package on Red Hat Enterprise Linux
sudo dnf update shim-x64
# Disable HTTP boot in efibootmgr (if applicable)
# Note: UEFI settings may need to be changed in BIOS
efibootmgr -v | grep -i http
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


