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-2025-55158

CVE-2025-55158: Vim Use-After-Free Vulnerability

CVE-2025-55158 is a use-after-free flaw in Vim affecting versions 9.1.1231 to 9.1.1405. It occurs during Vim9 script import operations with nested tuples. This article covers technical details, affected versions, and patches.

Published: April 29, 2026

CVE-2025-55158 Overview

CVE-2025-55158 is a double-free vulnerability affecting Vim, the popular open-source command line text editor. The flaw exists in Vim versions 9.1.1231 through 9.1.1405, where processing nested tuples during Vim9 script import operations can trigger memory corruption. Specifically, when an error occurs during evaluation, the clear_tv() function may attempt to free memory that has already been deallocated due to improper lifetime handling in the handle_import and ex_import code paths.

Critical Impact

Successful exploitation of this double-free vulnerability can lead to denial of service through application crashes when users open and execute specially crafted Vim scripts.

Affected Products

  • Vim versions 9.1.1231 to 9.1.1405
  • Systems running vulnerable Vim installations with Vim9 script support enabled

Discovery Timeline

  • 2025-08-11 - CVE-2025-55158 published to NVD
  • 2025-08-12 - Last updated in NVD database

Technical Details for CVE-2025-55158

Vulnerability Analysis

This vulnerability is classified as CWE-415 (Double Free), a memory corruption issue that occurs when the same memory location is freed more than once. In the context of CVE-2025-55158, the flaw manifests within Vim's typed value (typval_T) management system during Vim9 script import operations.

When processing nested tuples, if an error occurs during evaluation, the clear_tv() function is invoked to clean up memory. However, due to improper lifetime handling in the import code paths, the function may attempt to deallocate memory that was already freed earlier in the execution flow. This can corrupt the heap's internal data structures and lead to unpredictable behavior, including application crashes.

The attack requires user interaction—specifically, the user must explicitly open and execute a maliciously crafted Vim script. This limits the attack surface but still poses a significant risk to developers and system administrators who routinely work with Vim scripts from untrusted sources.

Root Cause

The root cause lies in the improper management of typed value lifetimes within the handle_import and ex_import code paths. When a tuple's first item is added from rettv, the original rettv structure retains its type information. If an error subsequently triggers cleanup via clear_tv(), both the tuple and the original rettv may attempt to free the same memory, resulting in a double-free condition.

Attack Vector

The vulnerability can be exploited through a network-based attack vector where an attacker distributes a specially crafted Vim script. When a victim downloads and executes this malicious script (for example, as part of a plugin installation or configuration file), the double-free condition is triggered. The attack requires user interaction to open and execute the script, which limits automated exploitation but enables targeted attacks against developers and system administrators.

The patch addresses this issue by setting the rettv type to VAR_UNKNOWN after its first item is added to the tuple, preventing the caller from attempting to free the already-transferred memory:

c
	    // Add the first item to the tuple from "rettv"
	    if (tuple_append_tv(tuple, rettv) == FAIL)
		return FAIL;
+	    // The first item in "rettv" is added to the tuple.  Set the rettv
+	    // type to unknown, so that the caller doesn't free it.
+	    rettv->v_type = VAR_UNKNOWN;
	}
    }

Source: GitHub Commit Details

Detection Methods for CVE-2025-55158

Indicators of Compromise

  • Unexpected Vim crashes when processing Vim9 scripts containing nested tuple structures
  • Core dumps or crash reports originating from the clear_tv() function
  • Suspicious Vim script files containing complex nested tuple import statements
  • Memory corruption errors in system logs associated with Vim processes

Detection Strategies

  • Monitor for Vim process crashes and analyze crash dumps for double-free signatures
  • Implement file integrity monitoring for Vim configuration directories to detect malicious script injection
  • Deploy endpoint detection rules to identify execution of Vim scripts from untrusted sources
  • Use memory sanitizers (ASan/MSan) in development environments to catch double-free issues

Monitoring Recommendations

  • Enable system-level monitoring for abnormal Vim process terminations
  • Audit Vim script execution in privileged environments where Vim is used for system administration
  • Track downloads and installations of Vim plugins from unofficial sources
  • Review Vim version information across your infrastructure to identify vulnerable installations

How to Mitigate CVE-2025-55158

Immediate Actions Required

  • Upgrade Vim to version 9.1.1406 or later immediately
  • Audit all Vim scripts from untrusted sources before execution
  • Temporarily restrict Vim9 script execution in security-sensitive environments
  • Review recently installed Vim plugins for potentially malicious content

Patch Information

This vulnerability has been addressed in Vim version 9.1.1406. The fix modifies the tuple handling code in src/tuple.c to properly transfer ownership of typed values during import operations. After adding the first item from rettv to the tuple, the patch sets rettv->v_type = VAR_UNKNOWN to prevent the caller from attempting to free the already-transferred memory.

For detailed patch information, refer to the GitHub Security Advisory or the official release notes.

Workarounds

  • Avoid executing Vim9 scripts from untrusted sources until the patch is applied
  • Use older Vim script syntax (legacy scripts) instead of Vim9 scripts when possible
  • Run Vim in restricted mode (vim -Z) when working with untrusted files
  • Implement sandboxing for Vim processes in multi-user environments
bash
# Check current Vim version
vim --version | head -1

# Update Vim on Debian/Ubuntu
sudo apt update && sudo apt install vim

# Update Vim on RHEL/CentOS/Fedora
sudo dnf update vim

# Verify updated version is 9.1.1406 or higher
vim --version | grep -E "patch 1406|IMproved 9\.1\.140[6-9]|IMproved 9\.1\.14[1-9]|IMproved 9\.1\.[2-9]|IMproved 9\.[2-9]|IMproved [1-9][0-9]"

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

  • Vulnerability Details
  • TypeUse After Free

  • Vendor/TechVim

  • SeverityMEDIUM

  • CVSS Score6.9

  • EPSS Probability0.07%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/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
  • AvailabilityHigh
  • CWE References
  • CWE-415
  • Vendor Resources
  • GitHub Commit Details

  • GitHub Release Information

  • GitHub Security Advisory
  • Related CVEs
  • CVE-2024-41957: Vim Use-After-Free Vulnerability

  • CVE-2025-26603: Vim Use-After-Free Vulnerability

  • CVE-2025-24014: Vim Use-After-Free Vulnerability

  • CVE-2025-55157: Vim Use-After-Free 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