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
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • 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-2021-38371

CVE-2021-38371: Exim STARTTLS Response Injection Flaw

CVE-2021-38371 is a response injection vulnerability in Exim's STARTTLS feature affecting versions through 4.94.2. Attackers can exploit buffering during MTA SMTP sending. This article covers technical details, impact, and mitigation.

Updated: May 16, 2026

CVE-2021-38371 Overview

CVE-2021-38371 affects the STARTTLS feature in Exim mail transfer agent (MTA) through version 4.94.2. The vulnerability allows response injection through buffering during MTA SMTP sending operations. An attacker positioned as a man-in-the-middle can inject pre-TLS plaintext commands that the Exim client processes after the TLS handshake completes. This breaks the security boundary that STARTTLS is intended to establish between unencrypted and encrypted SMTP sessions. The flaw is classified under [CWE-74] for improper neutralization of special elements in output used by downstream components. The vulnerability impacts integrity of mail transmission without affecting confidentiality or availability.

Critical Impact

A network-positioned attacker can inject commands into encrypted SMTP sessions, enabling credential theft, mail redirection, and bypass of TLS protections on outbound mail delivery.

Affected Products

  • Exim MTA versions through 4.94.2
  • Linux distributions packaging vulnerable Exim builds
  • Debian LTS systems prior to applying the October 2024 security update

Discovery Timeline

  • 2021-08-10 - CVE-2021-38371 published to NVD
  • 2025-11-03 - Last updated in NVD database

Technical Details for CVE-2021-38371

Vulnerability Analysis

The vulnerability resides in how Exim handles the transition from plaintext SMTP to TLS-encrypted SMTP via the STARTTLS command. When acting as an SMTP client during mail delivery, Exim fails to discard buffered data from the plaintext channel before initiating the TLS handshake. This buffer retention allows attackers to smuggle SMTP commands across the encryption boundary.

The defect falls into the broader class of STARTTLS injection issues documented in the NoSTARTTLS research disclosure. The flaw violates the explicit requirement in RFC 3207 that any pipelined commands following STARTTLS must be discarded before negotiating TLS. Exim instead processes them as if they originated from inside the encrypted session.

Root Cause

The root cause is improper neutralization of buffered input across a protocol state transition. Exim's SMTP client code reads data into a buffer before establishing TLS, and the buffer is not flushed when the connection upgrades. Commands injected by a network attacker during the cleartext phase remain in the buffer and are interpreted within the trusted TLS context.

Attack Vector

Exploitation requires the attacker to intercept or tamper with traffic between an Exim MTA acting as a sender and a remote SMTP server. The attacker injects additional SMTP responses or commands immediately before the 220 Ready to start TLS reply. After the TLS handshake, Exim parses the previously buffered attacker-controlled data as legitimate server responses. This enables redirection of mail flows, manipulation of envelope addresses, or harvesting of authentication credentials sent over the upgraded channel. The attack is network-based, requires no authentication, and needs no user interaction. Technical details are available in the Exim CVE-2021-38371 advisory and the NoSTARTTLS research.

Detection Methods for CVE-2021-38371

Indicators of Compromise

  • Unexpected SMTP command sequences in Exim main logs immediately following STARTTLS negotiation with remote relays
  • TLS sessions to outbound MTAs where the server banner or initial response differs from prior baselines
  • Mail delivery to unexpected hosts or with modified envelope recipients after relay through the affected MTA

Detection Strategies

  • Inspect Exim transport logs for malformed or duplicated response codes around the STARTTLS transition
  • Compare expected server certificates and EHLO banners against historical baselines for known relay partners
  • Apply network detection rules that flag SMTP responses containing CRLF-separated commands before the TLS handshake

Monitoring Recommendations

  • Forward Exim mainlog and rejectlog to a centralized logging platform and alert on anomalous STARTTLS sequences
  • Monitor outbound TCP/25 and TCP/587 sessions for protocol anomalies and unexpected destination changes
  • Track Exim version inventory across mail infrastructure to confirm all instances run patched builds

How to Mitigate CVE-2021-38371

Immediate Actions Required

  • Upgrade Exim to a version later than 4.94.2 that incorporates the STARTTLS buffer fix
  • Apply the Debian LTS update referenced in the Debian LTS announcement on affected distributions
  • Audit outbound mail routes and verify TLS certificate pinning where supported

Patch Information

Exim has published remediation details in the official advisory. Operators running Debian-based systems should install the package update from the Debian LTS October 2024 announcement. The patch ensures the SMTP client buffer is discarded prior to TLS negotiation, aligning behavior with RFC 3207 requirements.

Workarounds

  • Configure Exim to use implicit TLS on port 465 instead of opportunistic STARTTLS where the remote server supports it
  • Restrict outbound relay to trusted smarthosts over authenticated and pinned TLS connections
  • Disable STARTTLS for transports to destinations that cannot be verified, accepting plaintext delivery only over trusted networks
bash
# Example Exim transport configuration enforcing implicit TLS
remote_smtp_smarthost:
  driver = smtp
  port = 465
  protocol = smtps
  tls_verify_hosts = *
  tls_verify_certificates = /etc/ssl/certs/ca-certificates.crt
  hosts_require_tls = *

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

  • Vulnerability Details
  • TypeOther

  • Vendor/TechExim

  • SeverityHIGH

  • CVSS Score7.5

  • EPSS Probability2.21%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityNone
  • CWE References
  • CWE-74
  • Technical References
  • SecVuln Info Resource

  • Exim Official Website

  • Debian LTS Security Announcement
  • Vendor Resources
  • Exim CVE-2021-38371 Details
  • Related CVEs
  • CVE-2026-45185: Exim Use-After-Free Vulnerability

  • CVE-2025-67896: Exim Buffer Overflow Vulnerability

  • CVE-2025-26794: Exim Mail Server SQLi Vulnerability

  • CVE-2023-42116: Exim SMTP Buffer Overflow RCE Vulnerability
Default Legacy - Prefooter | 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