Bug 2016056 (CVE-2021-3872)
Summary: | CVE-2021-3872 vim: heap-based buffer overflow in win_redr_status() in drawscreen.c | ||
---|---|---|---|
Product: | [Other] Security Response | Reporter: | Guilherme de Almeida Suckevicz <gsuckevi> |
Component: | vulnerability | Assignee: | Red Hat Product Security <security-response-team> |
Status: | CLOSED ERRATA | QA Contact: | |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | unspecified | CC: | bdettelb, caswilli, fjansen, gchamoul, gghezzo, gparvin, jburrell, jnakfour, jramanat, jwong, karsten, kaycoth, pahickey, psegedy, stcannon, vkumar, vmugicag, zdohnal |
Target Milestone: | --- | Keywords: | Security |
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | vim 8.2.3487 | Doc Type: | If docs needed, set a value |
Doc Text: |
An out-of-bounds write flaw was found in vim's drawscreen.c win_redr_status() function. This flaw allows an attacker to trick a user to open a crafted file with specific arguments in vim, triggering an out-of-bounds write. The highest threat from this vulnerability is to confidentiality, integrity, and system availability.
|
Story Points: | --- |
Clone Of: | Environment: | ||
Last Closed: | 2021-11-02 23:40:14 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | 2016057, 2016123, 2016125, 2016200, 2016201, 2016202 | ||
Bug Blocks: | 2014663 |
Description
Guilherme de Almeida Suckevicz
2021-10-20 17:41:34 UTC
Created vim tracking bugs for this issue: Affects: fedora-all [bug 2016057] marking hosted services affected (low) / delegated solely for presence of affected code. Upstream patch commit: https://github.com/vim/vim/commit/826bfe4bbd7594188e3d74d2539d9707b1c6a14b Flaw summary: The vulnerable code is in src/drawscreen.c. Specifically: `p` is a pointer to the `NameBuff` buffer. It's size is represented by the `MAXPATHL` macro. `win_redr_status()` performs operations such as: `STRCPY(p + len, _("[Help]"));` The problem is that `len` can be large enough to cause this to overflow the `NameBuff` buffer to which `p` points, as there isn't enough room for the data being copied and no check is performed. This can result in out-of-bounds write when Vim buffer ("buffer" as in the Vim feature here, not array) names are long. The upstream patch uses `vim_snprintf()` with a write length constraint of `MAXPATHL - len` rather than `STRCPY()` to prevent an out-of-bounds write. This flaw is Moderate at most because while it is an out-of-bounds write, the attacker does not necessarily have an arbitrary write and the attack is not inherently bound to the network. This issue has been addressed in the following products: Red Hat Enterprise Linux 8 Via RHSA-2022:0366 https://access.redhat.com/errata/RHSA-2022:0366 |