Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
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-2026-21439

CVE-2026-21439: badkeys Information Disclosure Flaw

CVE-2026-21439 is an information disclosure vulnerability in badkeys that allows attackers to inject ASCII control characters and ANSI escape sequences, creating misleading output. This article covers technical details.

Updated: January 22, 2026

CVE-2026-21439 Overview

CVE-2026-21439 is an output injection vulnerability affecting badkeys, a tool and library for checking cryptographic public keys for known vulnerabilities. In versions 0.0.15 and below, an attacker may inject content with ASCII control characters like vertical tabs, ANSI escape sequences, and other control characters that can create misleading output from the badkeys command-line tool. This impacts scanning DKIM keys (both --dkim and --dkim-dns), SSH keys (--ssh-lines mode), and filenames in various modes.

Critical Impact

Attackers can manipulate terminal output to deceive administrators by injecting control characters into cryptographic key data, potentially masking security warnings or displaying misleading information during key vulnerability scans.

Affected Products

  • badkeys versions 0.0.15 and below
  • badkeys DKIM key scanning functionality (--dkim, --dkim-dns)
  • badkeys SSH key scanning functionality (--ssh-lines mode)

Discovery Timeline

  • 2026-01-06 - CVE CVE-2026-21439 published to NVD
  • 2026-01-08 - Last updated in NVD database

Technical Details for CVE-2026-21439

Vulnerability Analysis

This vulnerability falls under CWE-150 (Improper Neutralization of Escape, Meta, or Control Sequences). The badkeys command-line tool processes cryptographic key data from various sources including DKIM DNS records, SSH key files, and user-provided filenames. When the tool outputs results to the terminal, it fails to properly sanitize or escape control characters embedded within this data.

An attacker who controls the content of cryptographic keys or filenames being scanned can embed ASCII control characters (such as vertical tabs, carriage returns, or ANSI escape sequences) within the key comments, DKIM record values, or filenames. When badkeys processes and displays these values, the injected control characters are interpreted by the terminal, allowing manipulation of the displayed output.

The practical impact includes the ability to hide security warnings by overwriting previous terminal lines, inject fake "safe" messages that appear to come from badkeys, or create visual confusion that could lead an administrator to trust a compromised key.

Root Cause

The root cause is improper output encoding in the badkeys CLI module. User-controlled input from SSH key comments, DKIM key type values, and filenames was passed directly to terminal output without escaping control characters. The runcli.py module lacked an escape function to neutralize dangerous characters before display, and the dkim.py module directly interpolated untrusted values into warning messages.

Attack Vector

This vulnerability requires local access to control the input data being processed by badkeys. An attacker must be able to influence the content of cryptographic keys or filenames that will be scanned. Attack scenarios include:

  1. Malicious SSH Key Comments: An attacker places an SSH public key with crafted comments containing ANSI escape sequences on a system. When an administrator runs badkeys with --ssh-lines, the terminal output is manipulated.

  2. DKIM Record Poisoning: If an attacker can influence DNS DKIM records (through DNS hijacking or compromised domain), they can embed control characters in the key type field that manipulate output when scanned.

  3. Filename Manipulation: Crafted filenames containing control characters can manipulate output when badkeys scans directories.

The following patches demonstrate the security fix implemented in version 0.0.16:

Patch 1: Adding escape function import in runcli.py

python
 from .scanssh import scanssh
 from .scantls import scantls
 from .update import update_bl
-from .utils import _errexit, _getret, _setret, _warnmsg
+from .utils import _errexit, _esc, _getret, _setret, _warnmsg

 MAXINPUTSIZE = 2048000

Source: GitHub Commit 635a2f3

Patch 2: Implementing the escape function in utils.py

python
 _retval = 0


+def _esc(inp):
+    return repr(inp)[1:-1]
+
+
 @functools.cache
 def _setret(rv):
     global _retval

Source: GitHub Commit 635a2f3

Patch 3: Removing user-controlled values from warning messages in dkim.py

python
             return False
         der = EDASN1 + rawed
         return PUBPRE + base64.b64encode(der).decode() + PUBPOST
-    _warnmsg(f"Unknown DKIM key type {dkim['k']}")
+    _warnmsg("Unknown DKIM key type")
     return False

Source: GitHub Commit de631f6

Detection Methods for CVE-2026-21439

Indicators of Compromise

  • Presence of ASCII control characters (0x00-0x1F, 0x7F) in SSH key comment fields
  • ANSI escape sequences (\\x1b[) embedded in DKIM DNS TXT records
  • Filenames containing vertical tabs (\\x0b), carriage returns (\\x0d), or other control characters in directories scanned by badkeys
  • Unusual terminal behavior when running badkeys scans

Detection Strategies

  • Monitor for anomalous characters in DNS DKIM TXT records using DNS monitoring tools
  • Implement file integrity monitoring to detect filenames containing non-printable characters
  • Review SSH authorized_keys files for embedded control sequences in key comments
  • Audit badkeys version in use across systems to identify vulnerable installations

Monitoring Recommendations

  • Enable logging of badkeys CLI output to files rather than relying solely on terminal display
  • Implement automated version checking for security tools including badkeys
  • Monitor DNS query logs for DKIM record lookups that return responses with unusual character patterns
  • Use terminal recording tools when performing security audits to capture raw output for later analysis

How to Mitigate CVE-2026-21439

Immediate Actions Required

  • Upgrade badkeys to version 0.0.16 or later immediately
  • Review recent badkeys scan outputs for potential manipulation if using affected versions
  • Redirect badkeys output to log files and review with tools that display control characters visibly
  • Validate the integrity of any security decisions made based on badkeys output from affected versions

Patch Information

The vulnerability is fixed in badkeys version 0.0.16. The fix introduces an _esc() function that escapes control characters in user-controlled output by using Python's repr() function to convert control characters to their escaped representations. Additionally, the DKIM module was updated to remove user-controlled values from warning messages entirely.

For detailed patch information, see:

  • Security Advisory GHSA-wjpc-4f29-83h3
  • GitHub Issue #40

Workarounds

  • Redirect badkeys output to a file and review with a hex editor or tool that renders control characters visibly (e.g., cat -v, hexdump)
  • Pipe badkeys output through cat -v to make control characters visible: badkeys --dkim example.com | cat -v
  • Avoid using badkeys in interactive terminal sessions until upgraded; use non-interactive batch processing with log capture instead
  • Manually validate cryptographic keys using alternative tools to cross-check badkeys results
bash
# Configuration example: Safe execution with output sanitization
# Run badkeys with output piped through cat -v to reveal control characters
badkeys --ssh-lines authorized_keys | cat -v > scan_results.txt

# Alternative: Use hexdump for detailed character inspection
badkeys --dkim-dns example.com 2>&1 | hexdump -C > dkim_scan.hex

# Upgrade to patched version
pip install --upgrade badkeys>=0.0.16

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

  • Vulnerability Details
  • TypeInformation Disclosure

  • Vendor/TechBadkeys

  • SeverityLOW

  • CVSS Score2.0

  • EPSS Probability0.01%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:P/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityNone
  • CWE References
  • CWE-150
  • Technical References
  • GitHub Commit Update

  • GitHub Commit Update

  • GitHub Issue #40

  • GitHub Security Advisory GHSA-wjpc-4f29-83h3
  • Latest CVEs
  • CVE-2025-52793: Esselink.nu Settings CSRF Vulnerability

  • CVE-2025-52772: Virtual Moderator CSRF Vulnerability

  • CVE-2025-48279: WC MyParcel Belgium XSS Vulnerability

  • CVE-2025-39381: KiotViet Sync CSRF 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