The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2023-42118

CVE-2023-42118: Libspf2 Integer Underflow RCE Vulnerability

CVE-2023-42118 is an integer underflow vulnerability in Exim libspf2 that enables remote code execution through malicious SPF macros. This article covers technical details, affected versions, impact, and mitigation.

Published: February 4, 2026

CVE-2023-42118 Overview

CVE-2023-42118 is an integer underflow vulnerability in the libspf2 library used by Exim mail server that allows network-adjacent attackers to execute arbitrary code on affected installations. The vulnerability exists within the parsing of SPF (Sender Policy Framework) macros, where the process fails to properly validate user-supplied data, resulting in an integer underflow before writing to memory.

This vulnerability is particularly dangerous because authentication is not required to exploit it. An attacker on an adjacent network can leverage this flaw to execute code in the context of the service account, potentially leading to full system compromise of mail servers running vulnerable versions of Exim with libspf2.

Critical Impact

Unauthenticated remote code execution on Exim mail servers via malicious SPF macro parsing, allowing attackers to compromise email infrastructure.

Affected Products

  • libspf2_project libspf2
  • exim exim

Discovery Timeline

  • 2024-05-03 - CVE CVE-2023-42118 published to NVD
  • 2025-08-07 - Last updated in NVD database

Technical Details for CVE-2023-42118

Vulnerability Analysis

The vulnerability resides in the SPF macro parsing functionality within libspf2. SPF macros are used to construct dynamic SPF records and involve variable expansion. When processing these macros, the library performs arithmetic operations on user-controlled data without adequate bounds checking.

The integer underflow occurs when the parsing routine calculates buffer sizes or offsets based on attacker-controlled input. When a carefully crafted SPF record with malicious macro values is processed, the arithmetic operation underflows, resulting in a value much larger than expected. This corrupted value is then used in subsequent memory operations, leading to memory corruption.

The vulnerability was tracked internally by the Zero Day Initiative as ZDI-CAN-17578 and publicly disclosed as ZDI-23-1472.

Root Cause

The root cause is improper validation of user-supplied data during SPF macro parsing. The vulnerable code path performs arithmetic operations (subtraction) on length or offset values derived from the SPF record without checking whether the result would underflow below zero. When an unsigned integer underflows, it wraps around to a very large positive value, which can then be used to perform out-of-bounds memory writes.

This is a classic CWE-191 (Integer Underflow) vulnerability where the absence of boundary validation before arithmetic operations allows attackers to manipulate memory operations through carefully crafted input values.

Attack Vector

The attack requires network adjacency, meaning the attacker must be on the same network segment as the target mail server or be able to route traffic to it. The attack flow involves:

  1. The attacker crafts a malicious DNS TXT record containing a specially designed SPF policy with manipulated macro values
  2. When the Exim server receives an email and performs SPF validation, it queries DNS for the SPF record
  3. The libspf2 library parses the malicious SPF macros, triggering the integer underflow
  4. The underflowed value corrupts memory operations, allowing the attacker to write arbitrary data to controlled memory locations
  5. The attacker achieves code execution in the context of the Exim service account

The vulnerability can be triggered remotely through the normal email delivery process, making it particularly dangerous for internet-facing mail servers. No authentication or user interaction is required for exploitation.

Detection Methods for CVE-2023-42118

Indicators of Compromise

  • Unusual SPF record queries to external DNS servers containing abnormally long or malformed macro values
  • Exim process crashes or restarts associated with SPF validation operations
  • Memory corruption signatures in Exim process memory space during SPF checks
  • Anomalous outbound network connections from the mail server following email processing

Detection Strategies

  • Monitor DNS query logs for SPF record lookups with suspicious patterns or unusually large responses
  • Implement network intrusion detection rules to identify malformed SPF records in DNS traffic
  • Enable verbose logging in Exim to capture SPF processing errors and unexpected behavior
  • Deploy endpoint detection to monitor Exim process behavior for signs of exploitation

Monitoring Recommendations

  • Configure alerting for Exim service crashes or unexpected restarts
  • Monitor system logs for memory corruption or segmentation fault events related to the mail service
  • Track network connections originating from the Exim process for post-exploitation activity
  • Implement file integrity monitoring on Exim binaries and configuration files

How to Mitigate CVE-2023-42118

Immediate Actions Required

  • Update libspf2 to the latest patched version as soon as patches become available
  • Consider disabling SPF checking temporarily if the business impact is acceptable
  • Implement network segmentation to limit network-adjacent attack surface
  • Review and restrict network access to mail servers to trusted sources where possible

Patch Information

Organizations should monitor the Zero Day Initiative Advisory ZDI-23-1472 and the Openwall OSS Security Mailing List for patch availability and updates. Contact the libspf2 project maintainers and your Linux distribution's security team for patched packages.

Ensure that both the libspf2 library and Exim mail server are updated to versions that contain the security fix for this vulnerability.

Workarounds

  • Disable SPF checking in Exim configuration if not strictly required for mail operations
  • Implement upstream DNS filtering to block known malicious SPF records
  • Use network access controls to restrict which hosts can connect to the mail server on the local network segment
  • Consider using an alternative SPF implementation if available and compatible with your mail infrastructure
bash
# Configuration example
# Exim configuration to disable SPF checking (temporary workaround)
# Add to exim.conf or relevant configuration file:
# Comment out or remove SPF ACL conditions
# acl_check_rcpt:
#   deny  spf = fail
#   warn  spf = softfail

# Alternatively, if using libspf2 directly, ensure it's not loaded:
# Remove or comment SPF-related lookup definitions

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechExim

  • SeverityHIGH

  • CVSS Score8.8

  • EPSS Probability3.01%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-191
  • Technical References
  • Zero Day Initiative Advisory ZDI-23-1472

  • Openwall OSS Security Mailing List Post
  • Related CVEs
  • CVE-2023-42116: Exim SMTP Buffer Overflow RCE Vulnerability

  • CVE-2023-42115: Exim AUTH Out-Of-Bounds Write RCE Flaw

  • CVE-2020-28026: Exim Mail Server RCE Vulnerability

  • CVE-2020-28021: Exim Mail Server RCE Vulnerability
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English