Vulnerability · Published Aug 26, 2024 · Assigned by GitHub_M

CVE-2024-43802heap-buffer-overflow in ins_typebuf() in Vim < 9.1.0697

Medium 4.5

In plain English

A medium-severity heap buffer overflow in vim from vim. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.3% (higher than 22% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)4.5Medium
Exploit odds (30 days)0.3%top 77.6% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official description

Vim is an improved version of the unix vi text editor. When flushing the typeahead buffer, Vim moves the current position in the typeahead buffer but does not check whether there is enough space left in the buffer to handle the next characters. So this may lead to the tb_off position within the typebuf variable to point outside of the valid buffer size, which can then later lead to a heap-buffer overflow in e.g. ins_typebuf(). Therefore, when flushing the typeahead buffer, check if there is enough space left before advancing the off position. If not, fall back to flush current typebuf contents. It's not quite clear yet, what can lead to this situation. It seems to happen when error messages occur (which will cause Vim to flush the typeahead buffer) in comnination with several long mappgins and so it may eventually move the off position out of a valid buffer size. Impact is low since it is not easily reproducible and requires to have several mappings active and run into some error condition. But when this happens, this will cause a crash. The issue has been fixed as of Vim patch v9.1.0697. Users are advised to upgrade. There are no known workarounds for this issue.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Alpine:v3.20vim9.1.0707-r0ALPINE-CVE-2024-43802
Alpine:v3.21vim9.1.0707-r0ALPINE-CVE-2024-43802
Alpine:v3.22vim9.1.0707-r0ALPINE-CVE-2024-43802
Alpine:v3.23vim9.1.0707-r0ALPINE-CVE-2024-43802
Alpine:v3.24vim9.1.0707-r0ALPINE-CVE-2024-43802
Debian:12vim2:9.0.1378-2+deb12u1DEBIAN-CVE-2024-43802
Debian:13vim2:9.1.0698-1DEBIAN-CVE-2024-43802
Debian:14vim2:9.1.0698-1DEBIAN-CVE-2024-43802
Ubuntu:22.04:LTSvim2:8.2.3995-1ubuntu2.19USN-7048-1
Ubuntu:22.04:LTSvim2:8.2.3995-1ubuntu2.19UBUNTU-CVE-2024-43802
Ubuntu:24.04:LTSvim2:9.1.0016-1ubuntu7.3UBUNTU-CVE-2024-43802
Ubuntu:24.04:LTSvim2:9.1.0016-1ubuntu7.3USN-7048-1

Affected products (as reported)

VendorProductVersions
vim vim < 9.1.0697

Weakness: CWE-122 · Vector: CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L

References