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-2022-24302

CVE-2022-24302: Paramiko Race Condition Vulnerability

CVE-2022-24302 is a race condition vulnerability in Paramiko that could expose private key files between creation and chmod operations. This article covers the technical details, affected versions, and mitigation steps.

Published: February 18, 2026

CVE-2022-24302 Overview

CVE-2022-24302 is a race condition vulnerability affecting Paramiko, a popular Python SSH library. The vulnerability exists in the write_private_key_file function where a Time-of-Check Time-of-Use (TOCTOU) race condition occurs between the file creation and the subsequent chmod operation. This timing window could allow an attacker to read sensitive private key material before proper file permissions are applied, resulting in unauthorized information disclosure.

Critical Impact

Private SSH keys may be exposed to unauthorized users due to a race condition in file permission handling, potentially compromising authentication credentials and enabling unauthorized system access.

Affected Products

  • Paramiko versions before 2.10.1
  • Debian Linux 9.0 and 10.0
  • Fedora 34, 35, and 36

Discovery Timeline

  • March 17, 2022 - CVE-2022-24302 published to NVD
  • December 16, 2025 - Last updated in NVD database

Technical Details for CVE-2022-24302

Vulnerability Analysis

This vulnerability is classified as CWE-362 (Concurrent Execution using Shared Resource with Improper Synchronization). The core issue lies in the write_private_key_file function within Paramiko's pkey.py module. When writing a private key to a file, the function first creates the file and then applies restrictive permissions via a separate chmod call. This two-step process creates a brief window during which the file exists with potentially insecure default permissions.

The race condition can be exploited in multi-user environments where an attacker with local access can monitor file creation events. By timing their access attempt to occur after file creation but before chmod completes, an attacker could potentially read the contents of newly written private key files.

Root Cause

The root cause is the non-atomic file creation and permission-setting operations in the write_private_key_file function. The vulnerable code path creates a file with default permissions inherited from the process umask, then subsequently calls chmod to restrict access. This sequential approach violates secure coding practices for handling sensitive cryptographic material, where atomic operations or pre-setting secure permissions are recommended.

Attack Vector

The attack requires network-adjacent or local access to exploit the timing window. An attacker would need to:

  1. Monitor the target system for file creation events in directories where Paramiko may write private keys
  2. Race to read the file contents during the window between file creation and permission modification
  3. Extract private key material before the chmod operation completes

The vulnerability's exploitation complexity is considered high due to the precise timing required, but successful exploitation could expose SSH private keys used for authentication to remote systems.

The vulnerable code pattern can be found in the Paramiko pkey.py source, where the file write and permission modification occur as separate operations rather than an atomic sequence.

Detection Methods for CVE-2022-24302

Indicators of Compromise

  • Unexpected file access attempts to newly created SSH key files in temporary or user directories
  • Audit logs showing rapid successive file operations on private key files by different processes
  • Evidence of file monitoring tools or scripts watching for key file creation events

Detection Strategies

  • Monitor for abnormal file system activity patterns around SSH key generation operations
  • Implement file integrity monitoring on directories where private keys are stored
  • Enable detailed auditing of file access events, particularly focusing on timing between creation and permission changes
  • Review application logs for Paramiko usage patterns that involve key file generation

Monitoring Recommendations

  • Deploy endpoint detection solutions to monitor for suspicious file access patterns during key generation
  • Configure audit rules to track file permission changes on sensitive directories
  • Implement runtime application self-protection (RASP) to detect potential race condition exploitation attempts

How to Mitigate CVE-2022-24302

Immediate Actions Required

  • Upgrade Paramiko to version 2.10.1 or later immediately
  • Audit systems for any potentially compromised SSH private keys generated before patching
  • Rotate SSH keys that may have been created using vulnerable Paramiko versions
  • Review access logs for any suspicious file access patterns around key generation events

Patch Information

Paramiko version 2.10.1 addresses this vulnerability by implementing atomic file operations for private key writing. The fix ensures proper file permissions are set at creation time rather than applied after the fact. Refer to the Paramiko Changelog for complete release notes and upgrade instructions.

For Linux distributions, security updates are available:

  • Debian users should apply updates per the Debian LTS Announcement
  • Fedora users should update via standard package management as per Fedora Package Announcements

Workarounds

  • Set a restrictive umask (e.g., 0077) before invoking Paramiko key generation operations
  • Store private keys in directories with restricted access permissions at the directory level
  • Use memory-only key storage when possible to avoid writing private keys to disk
  • Implement additional access controls on systems where Paramiko is used to generate keys
bash
# Set restrictive umask before key generation
umask 0077

# Verify Paramiko version
pip show paramiko | grep Version

# Upgrade Paramiko to patched version
pip install --upgrade paramiko>=2.10.1

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

  • Vulnerability Details
  • TypeRace Condition

  • Vendor/TechParamiko

  • SeverityMEDIUM

  • CVSS Score5.9

  • EPSS Probability0.73%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
  • Impact Assessment
  • ConfidentialityHigh
  • IntegrityNone
  • AvailabilityNone
  • CWE References
  • CWE-362
  • Technical References
  • GitHub Code Snippet

  • Debian LTS Announcement March 2022

  • Debian LTS Announcement September 2022

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Debian LTS Announcement December 2025
  • Vendor Resources
  • Paramiko Changelog
  • 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