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-2021-32749

CVE-2021-32749: Fail2ban mail-whois Action RCE Vulnerability

CVE-2021-32749 is a remote code execution vulnerability in Fail2ban's mail-whois action that allows attackers to execute arbitrary commands through malicious whois responses. This article covers technical details, affected versions, and mitigation.

Published: February 25, 2026

CVE-2021-32749 Overview

CVE-2021-32749 is a Command Injection vulnerability affecting Fail2ban, a widely-used daemon designed to protect Linux servers by banning hosts that cause multiple authentication errors. The vulnerability exists in the mail-whois mailing action where the mail command from the mailutils package can execute arbitrary commands when unescaped sequences (\n~) are present in external input, such as whois server responses.

Critical Impact

Remote code execution is possible through malicious whois server responses, allowing attackers to execute arbitrary commands on systems using the vulnerable mail-whois action via MITM attacks or compromised whois servers.

Affected Products

  • Fail2ban versions 0.9.7 and prior
  • Fail2ban versions 0.10.0 through 0.10.6
  • Fail2ban versions 0.11.0 through 0.11.2
  • Fedora 34 and Fedora 35

Discovery Timeline

  • 2021-07-16 - CVE-2021-32749 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2021-32749

Vulnerability Analysis

This vulnerability stems from improper handling of escape sequences in the mailutils mail command when processing external input. The mail-whois action in Fail2ban queries whois servers to gather information about banned IP addresses and includes this data in notification emails. However, the mail command interprets certain escape sequences (specifically \n~ followed by commands) as interactive commands, enabling command execution.

The attack requires either a Man-in-the-Middle position to intercept and modify whois responses, or control over a whois server that the target system queries. While the attack complexity is high due to these prerequisites, successful exploitation results in complete system compromise with the ability to execute arbitrary commands with the privileges of the Fail2ban process.

Root Cause

The root cause is the failure to disable the escape character processing in the mail command. By default, the mailutils mail command interprets the tilde character (~) at the beginning of a line (following a newline) as an escape character, allowing various interactive commands to be executed. When untrusted data from whois responses is passed to the mail command without sanitization, an attacker can inject malicious escape sequences that result in command execution.

Attack Vector

An attacker exploiting CVE-2021-32749 would need to inject specially crafted content into whois server responses. This can be accomplished through:

  1. MITM Attack: Intercepting network traffic between the Fail2ban server and legitimate whois servers to inject malicious responses
  2. Compromised Whois Server: Taking control of a whois server that the target system queries

The malicious whois response would contain escape sequences like \n~!command which, when processed by the mail command, would execute the specified command on the target system.

text
# Example of the vulnerable configuration (before patch)
# config/action.d/complain.conf and config/action.d/dshield.conf

# Notes.:  Your system mail command. Is passed 2 args: subject and recipient
# Values:  CMD
#
-mailcmd = mail -s
+mailcmd = mail -E 'set escape' -s

Source: GitHub Commit

The fix adds -E 'set escape' to the mail command, which sets the escape character to an empty value, effectively disabling escape sequence processing and preventing command injection through external input.

Detection Methods for CVE-2021-32749

Indicators of Compromise

  • Unusual outbound connections from the Fail2ban process to unexpected destinations
  • Anomalous process spawning from mail-related commands executed by Fail2ban
  • Suspicious entries in Fail2ban logs showing unusual whois responses containing tilde characters (~)
  • Unexpected system commands being executed with Fail2ban user privileges

Detection Strategies

  • Monitor for mail processes spawning child processes that are not typical mail-related utilities
  • Implement network monitoring to detect suspicious whois responses containing escape sequences (\n~)
  • Audit Fail2ban configuration files to identify use of vulnerable mail-whois actions
  • Use file integrity monitoring on Fail2ban action configuration files in /etc/fail2ban/action.d/

Monitoring Recommendations

  • Enable verbose logging for Fail2ban to capture detailed action execution information
  • Implement network traffic analysis for whois protocol communications (TCP port 43)
  • Set up alerting for any command execution patterns originating from mail utilities
  • Monitor system calls from the Fail2ban daemon for unexpected execve() calls

How to Mitigate CVE-2021-32749

Immediate Actions Required

  • Upgrade Fail2ban to version 0.10.7 or 0.11.3 or later immediately
  • If immediate upgrade is not possible, disable or remove the mail-whois action from all jail configurations
  • Review current Fail2ban configurations to identify all jails using mail-based actions
  • Apply the manual patch to action configuration files if running a vulnerable version

Patch Information

The vulnerability has been patched in Fail2ban versions 0.10.7 and 0.11.3. The fix modifies the mailcmd configuration in affected action files (complain.conf, dshield.conf, and related mail actions) to include -E 'set escape' which disables the escape character processing in the mail command.

Security patches are available through the following commits:

  • Commit 2ed414e for version 0.11.x
  • Commit 410a6ce for version 0.10.x

Additional distribution-specific advisories:

  • Fedora Package Announcements
  • Gentoo GLSA 202310-13

Workarounds

  • Avoid using the mail-whois action entirely until patched
  • Switch to alternative notification methods such as sendmail-whois or custom scripts that properly sanitize input
  • Manually apply the patch by adding -E 'set escape' to the mailcmd variable in affected action configuration files
  • Implement network-level filtering to validate whois responses before they reach Fail2ban
bash
# Manual workaround: Patch the mailcmd configuration
# Edit /etc/fail2ban/action.d/complain.conf and /etc/fail2ban/action.d/dshield.conf

# Change:
# mailcmd = mail -s

# To:
mailcmd = mail -E 'set escape' -s

# Then restart fail2ban service
sudo systemctl restart fail2ban

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

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechFail2ban

  • SeverityHIGH

  • CVSS Score8.1

  • EPSS Probability0.30%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityHigh
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-78

  • CWE-94
  • Technical References
  • Fedora Package Announcement

  • Fedora Package Announcement

  • Gentoo GLSA 202310-13
  • Vendor Resources
  • GitHub Commit Change

  • GitHub Commit Change

  • GitHub Security Advisory
  • Latest CVEs
  • CVE-2025-70797: LimeSurvey XSS Vulnerability

  • CVE-2025-30650: Juniper Junos OS Auth Bypass Vulnerability

  • CVE-2026-35471: Goshs Path Traversal Vulnerability

  • CVE-2026-35393: Goshs Path Traversal 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