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-0128

CVE-2022-0128: Vim Out-of-bounds Read Vulnerability

CVE-2022-0128 is an out-of-bounds read vulnerability in Vim that allows attackers to read memory beyond allocated buffers. This article covers the technical details, affected versions, security impact, and mitigation.

Published: February 17, 2026

CVE-2022-0128 Overview

CVE-2022-0128 is an out-of-bounds read vulnerability affecting Vim, the popular text editor. This memory corruption flaw occurs when Vim reads one byte beyond the end of a line during command parsing, specifically when processing increment (++) and decrement (--) operators. The vulnerability can be triggered when a user opens a maliciously crafted file or executes specially crafted input, potentially leading to information disclosure, application crashes, or in some scenarios, arbitrary code execution.

Critical Impact

This out-of-bounds read vulnerability in Vim can allow attackers to cause denial of service or potentially execute arbitrary code when users interact with malicious files, affecting systems across Linux distributions and Apple macOS platforms.

Affected Products

  • Vim (all versions prior to patch 8.2.4009)
  • Apple Mac OS X 10.15.7 (multiple security update versions)
  • Apple macOS (multiple versions including 11.x and 12.x series)

Discovery Timeline

  • 2022-01-06 - CVE-2022-0128 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2022-0128

Vulnerability Analysis

The vulnerability exists in Vim's command parsing functionality within the ex_docmd.c source file. When parsing commands, Vim checks for increment (++) and decrement (--) operators by comparing consecutive characters. However, the original implementation failed to verify that the first character being checked was not a null terminator (NUL) before comparing it with the next character. This oversight allows an out-of-bounds read of one byte beyond the allocated buffer when processing the end of a line.

The flaw is classified as CWE-125 (Out-of-bounds Read), which occurs when software reads data past the end or before the beginning of an intended buffer. In this case, the missing bounds check enables reading beyond the legitimate memory boundaries of the command line being parsed.

Root Cause

The root cause is insufficient input validation in the command parsing logic. The vulnerable code directly compared p[0] with p[1] to detect consecutive + or - characters without first verifying that p[0] was not a null terminator. When p points to the end of a string (the null byte), the comparison p[0] == p[1] would read one byte past the string terminator, resulting in an out-of-bounds memory access.

Attack Vector

The attack requires local access and user interaction—specifically, a victim must open a maliciously crafted file or execute a crafted Vim command. An attacker could embed malicious content in a file that, when opened by Vim, triggers the vulnerable code path. While the local attack vector limits remote exploitation, the widespread use of Vim for editing configuration files and source code makes this a significant concern for development environments and server administration workflows.

c
// Vulnerable code in src/ex_docmd.c (before patch)
// Check for "++nr" and "--nr".
if (p == eap->cmd && p[0] == p[1] && (*p == '+' || *p == '-'))

// Fixed code in src/ex_docmd.c (patch 8.2.4009)
// Check for "++nr" and "--nr".
if (p == eap->cmd && p[0] != NUL && p[0] == p[1]
                                   && (*p == '+' || *p == '-'))

Source: GitHub Commit for Vim

Detection Methods for CVE-2022-0128

Indicators of Compromise

  • Unexpected Vim crashes or segmentation faults when opening files
  • Memory access violations logged in system logs related to Vim processes
  • Unusual Vim behavior when parsing commands containing ++ or -- sequences

Detection Strategies

  • Monitor for Vim process crashes and core dumps that indicate memory corruption
  • Implement file integrity monitoring for Vim binaries to detect tampering
  • Use memory sanitizer tools (AddressSanitizer, Valgrind) in development environments to detect out-of-bounds access
  • Deploy endpoint detection tools to identify exploitation attempts targeting Vim

Monitoring Recommendations

  • Configure system logging to capture Vim process errors and crashes
  • Set up alerts for repeated Vim crashes from the same user or system
  • Monitor for suspicious files with unusual encoding or content patterns that may be crafted to trigger the vulnerability

How to Mitigate CVE-2022-0128

Immediate Actions Required

  • Update Vim to version 8.2.4009 or later immediately
  • For Apple macOS users, apply the relevant security updates (HT213183, HT213256, or HT213343)
  • Review and update Vim installations on all managed systems, including servers and developer workstations
  • Consider temporarily restricting Vim usage on critical systems until patches are applied

Patch Information

The vulnerability was addressed in Vim patch 8.2.4009, which adds a null terminator check before comparing consecutive characters. The fix is available in the GitHub Commit for Vim. Apple has also released security updates addressing this vulnerability for macOS Monterey, macOS Big Sur, and macOS Catalina through security updates documented in Apple Support Article HT213183, Apple Support Article HT213256, and Apple Support Article HT213343. Gentoo users should reference Gentoo GLSA 202208-32 for distribution-specific guidance.

Workarounds

  • Avoid opening untrusted files with Vim until patched
  • Use alternative text editors for reviewing files from untrusted sources
  • Enable operating system-level exploit mitigations such as ASLR and DEP
  • Run Vim in sandboxed or containerized environments when handling potentially malicious content
bash
# Check current Vim version
vim --version | head -n 2

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

# Update Vim on macOS via Homebrew
brew update && brew upgrade vim

# Verify patch level includes 8.2.4009 or higher
vim -c 'echo has("patch-8.2.4009")' -c 'quit'

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

  • Vulnerability Details
  • TypeOther

  • Vendor/TechVim

  • SeverityHIGH

  • CVSS Score7.8

  • EPSS Probability0.34%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityHigh
  • AvailabilityHigh
  • CWE References
  • CWE-125
  • Technical References
  • Full Disclosure Announcement

  • Full Disclosure Announcement

  • Full Disclosure Announcement

  • Openwall OSS Security Post

  • Gentoo GLSA 202208-32

  • Apple Support Article HT213183

  • Apple Support Article HT213256

  • Apple Support Article HT213343
  • Vendor Resources
  • GitHub Commit for Vim

  • Huntr Bounty #63f51299
  • Related CVEs
  • CVE-2023-2610: Vim Integer Overflow Vulnerability

  • CVE-2023-5441: Vim NULL Pointer Dereference Vulnerability

  • CVE-2023-4734: Vim Integer Overflow Vulnerability

  • CVE-2023-2609: Vim NULL Pointer Dereference 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