Security
Headlines
HeadlinesLatestCVEs

Headline

CVE-2022-2210: Out-of-bound write in function ml_append_int in vim

Out-of-bounds Write in GitHub repository vim/vim prior to 8.2.

CVE
#linux#git

Description

Out-of-bound write in function ml_append_int at memline.c:2895

Version

commit 8eba2bd291b347e3008aa9e565652d51ad638cfa (HEAD, tag: v8.2.5151)

Proof of Concept

guest@elk:~/trung$ valgrind ./vim2/src/vim -u NONE -i NONE -n -m -X -Z -e -s -S /home/guest/trung/poc/poc35min -c ':qa!' 
==28900== Memcheck, a memory error detector
==28900== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==28900== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==28900== Command: ./vim2/src/vim -u NONE -i NONE -n -m -X -Z -e -s -S /home/guest/trung/poc/poc35min -c :qa!
==28900== 
  debug=  define=^\s*#\s*define  dictionary=  diffexpr=  diffopt=internal,filler,closeoff  directory=.,~/tmp,/var/tmp,/tmp  display=
==28900== Invalid read of size 1
==28900==    at 0x4C38796: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==28900==    by 0x21594C: memmove (string_fortified.h:40)
==28900==    by 0x21594C: ml_append_int (memline.c:2895)
==28900==    by 0x218AED: ml_flush_line (memline.c:4054)
==28900==    by 0x21949C: ml_append_flush.part.11 (memline.c:3315)
==28900==    by 0x313727: u_undoredo (undo.c:2820)
==28900==    by 0x31403F: u_doit.part.9 (undo.c:2272)
==28900==    by 0x230E8F: nv_kundo (normal.c:4756)
==28900==    by 0x2385B4: normal_cmd (normal.c:939)
==28900==    by 0x1B671C: exec_normal (ex_docmd.c:8807)
==28900==    by 0x1B697F: ex_normal (ex_docmd.c:8693)
==28900==    by 0x1BB29D: do_one_cmd (ex_docmd.c:2570)
==28900==    by 0x1BB29D: do_cmdline (ex_docmd.c:992)
==28900==    by 0x2ABF00: do_source_ext (scriptfile.c:1674)
==28900==  Address 0x6ab8270 is 0 bytes after a block of size 4,096 alloc'd
==28900==    at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==28900==    by 0x140C60: lalloc (alloc.c:246)
==28900==    by 0x38122A: mf_alloc_bhdr.isra.3 (memfile.c:884)
==28900==    by 0x382006: mf_new (memfile.c:375)
==28900==    by 0x2147DF: ml_new_data (memline.c:4080)
==28900==    by 0x21769C: ml_open (memline.c:394)
==28900==    by 0x150EA4: open_buffer (buffer.c:186)
==28900==    by 0x1A8096: do_ecmd (ex_cmds.c:3029)
==28900==    by 0x1BC226: do_exedit (ex_docmd.c:7158)
==28900==    by 0x1BC835: ex_splitview (ex_docmd.c:6774)
==28900==    by 0x1BB29D: do_one_cmd (ex_docmd.c:2570)
==28900==    by 0x1BB29D: do_cmdline (ex_docmd.c:992)
==28900==    by 0x2ABF00: do_source_ext (scriptfile.c:1674)
==28900== 
==28900== Invalid write of size 1
==28900==    at 0x4C3878B: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==28900==    by 0x21594C: memmove (string_fortified.h:40)
==28900==    by 0x21594C: ml_append_int (memline.c:2895)
==28900==    by 0x218AED: ml_flush_line (memline.c:4054)
==28900==    by 0x21949C: ml_append_flush.part.11 (memline.c:3315)
==28900==    by 0x313727: u_undoredo (undo.c:2820)
==28900==    by 0x31403F: u_doit.part.9 (undo.c:2272)
==28900==    by 0x230E8F: nv_kundo (normal.c:4756)
==28900==    by 0x2385B4: normal_cmd (normal.c:939)
==28900==    by 0x1B671C: exec_normal (ex_docmd.c:8807)
==28900==    by 0x1B697F: ex_normal (ex_docmd.c:8693)
==28900==    by 0x1BB29D: do_one_cmd (ex_docmd.c:2570)
==28900==    by 0x1BB29D: do_cmdline (ex_docmd.c:992)
==28900==    by 0x2ABF00: do_source_ext (scriptfile.c:1674)
==28900==  Address 0x6ab8270 is 0 bytes after a block of size 4,096 alloc'd
==28900==    at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==28900==    by 0x140C60: lalloc (alloc.c:246)
==28900==    by 0x38122A: mf_alloc_bhdr.isra.3 (memfile.c:884)
==28900==    by 0x382006: mf_new (memfile.c:375)
==28900==    by 0x2147DF: ml_new_data (memline.c:4080)
==28900==    by 0x21769C: ml_open (memline.c:394)
==28900==    by 0x150EA4: open_buffer (buffer.c:186)
==28900==    by 0x1A8096: do_ecmd (ex_cmds.c:3029)
==28900==    by 0x1BC226: do_exedit (ex_docmd.c:7158)
==28900==    by 0x1BC835: ex_splitview (ex_docmd.c:6774)
==28900==    by 0x1BB29D: do_one_cmd (ex_docmd.c:2570)
==28900==    by 0x1BB29D: do_cmdline (ex_docmd.c:992)
==28900==    by 0x2ABF00: do_source_ext (scriptfile.c:1674)
==28900== 
==28900== Invalid read of size 1
==28900==    at 0x4C38788: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==28900==    by 0x21594C: memmove (string_fortified.h:40)
==28900==    by 0x21594C: ml_append_int (memline.c:2895)
==28900==    by 0x218AED: ml_flush_line (memline.c:4054)
==28900==    by 0x21949C: ml_append_flush.part.11 (memline.c:3315)
==28900==    by 0x313727: u_undoredo (undo.c:2820)
==28900==    by 0x31403F: u_doit.part.9 (undo.c:2272)
==28900==    by 0x230E8F: nv_kundo (normal.c:4756)
==28900==    by 0x2385B4: normal_cmd (normal.c:939)
==28900==    by 0x1B671C: exec_normal (ex_docmd.c:8807)
==28900==    by 0x1B697F: ex_normal (ex_docmd.c:8693)
==28900==    by 0x1BB29D: do_one_cmd (ex_docmd.c:2570)
==28900==    by 0x1BB29D: do_cmdline (ex_docmd.c:992)
==28900==    by 0x2ABF00: do_source_ext (scriptfile.c:1674)
==28900==  Address 0x6ab8273 is 3 bytes after a block of size 4,096 alloc'd
==28900==    at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==28900==    by 0x140C60: lalloc (alloc.c:246)
==28900==    by 0x38122A: mf_alloc_bhdr.isra.3 (memfile.c:884)
==28900==    by 0x382006: mf_new (memfile.c:375)
==28900==    by 0x2147DF: ml_new_data (memline.c:4080)
==28900==    by 0x21769C: ml_open (memline.c:394)
==28900==    by 0x150EA4: open_buffer (buffer.c:186)
==28900==    by 0x1A8096: do_ecmd (ex_cmds.c:3029)
==28900==    by 0x1BC226: do_exedit (ex_docmd.c:7158)
==28900==    by 0x1BC835: ex_splitview (ex_docmd.c:6774)
==28900==    by 0x1BB29D: do_one_cmd (ex_docmd.c:2570)
==28900==    by 0x1BB29D: do_cmdline (ex_docmd.c:992)
==28900==    by 0x2ABF00: do_source_ext (scriptfile.c:1674)
==28900== 
==28900== 
==28900== Process terminating with default action of signal 11 (SIGSEGV)
==28900==    at 0x5851177: kill (syscall-template.S:78)
==28900==    by 0x254A47: may_core_dump (os_unix.c:3448)
==28900==    by 0x254A47: mch_exit (os_unix.c:3484)
==28900==    by 0x37FD2A: getout (main.c:1737)
==28900==    by 0x5850F0F: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==28900==    by 0x4C38795: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==28900==    by 0x21594C: memmove (string_fortified.h:40)
==28900==    by 0x21594C: ml_append_int (memline.c:2895)
==28900==    by 0x218AED: ml_flush_line (memline.c:4054)
==28900==    by 0x21949C: ml_append_flush.part.11 (memline.c:3315)
==28900==    by 0x313727: u_undoredo (undo.c:2820)
==28900==    by 0x31403F: u_doit.part.9 (undo.c:2272)
==28900==    by 0x230E8F: nv_kundo (normal.c:4756)
==28900==    by 0x2385B4: normal_cmd (normal.c:939)
==28900== 
==28900== HEAP SUMMARY:
==28900==     in use at exit: 129,159 bytes in 552 blocks
==28900==   total heap usage: 2,459 allocs, 1,907 frees, 4,494,485 bytes allocated
==28900== 
==28900== LEAK SUMMARY:
==28900==    definitely lost: 9,947 bytes in 227 blocks
==28900==    indirectly lost: 0 bytes in 0 blocks
==28900==      possibly lost: 0 bytes in 0 blocks
==28900==    still reachable: 119,212 bytes in 325 blocks
==28900==         suppressed: 0 bytes in 0 blocks
==28900== Rerun with --leak-check=full to see details of leaked memory
==28900== 
==28900== For counts of detected and suppressed errors, rerun with: -v
==28900== ERROR SUMMARY: 7643972 errors from 3 contexts (suppressed: 0 from 0)
Segmentation fault

Attachment

poc35min

Impact

Typically, this can result in corruption of data, a crash, or code execution.

Related news

Ubuntu Security Notice USN-6270-1

Ubuntu Security Notice 6270-1 - It was discovered that Vim incorrectly handled memory when opening certain files. If an attacker could trick a user into opening a specially crafted file, it could cause Vim to crash, or possibly execute arbitrary code. This issue only affected Ubuntu 22.04 LTS. It was discovered that Vim incorrectly handled memory when deleting buffers in diff mode. An attacker could possibly use this issue to cause a denial of service. This issue only affected Ubuntu 20.04 LTS and Ubuntu 22.04 LTS.

Gentoo Linux Security Advisory 202305-16

Gentoo Linux Security Advisory 202305-16 - Multiple vulnerabilities have been found in Vim, the worst of which could result in denial of service. Versions less than 9.0.1157 are affected.

CVE-2022-46756: DSA-2022-335: Dell VxRail Security Update for Multiple Third-Party Component Vulnerabilities

Dell VxRail, versions prior to 7.0.410, contain a Container Escape Vulnerability. A local high-privileged attacker could potentially exploit this vulnerability, leading to the execution of arbitrary OS commands on the container's underlying OS. Exploitation may lead to a system take over by an attacker.

Scanvus now supports Vulners and Vulns.io VM Linux vulnerability detection APIs

Hello everyone! Great news for my open source Scanvus project! You can now perform vulnerability checks on Linux hosts and docker images not only using the Vulners.com API, but also with the Vulns.io VM API. It’s especially nice that all the code to support the new API was written and contributed by colleagues from Vulns.io. […]

Gentoo Linux Security Advisory 202208-32

Gentoo Linux Security Advisory 202208-32 - Multiple vulnerabilities have been discovered in Vim, the worst of which could result in denial of service. Versions less than 9.0.0060 are affected.

Ubuntu Security Notice USN-5516-1

Ubuntu Security Notice 5516-1 - It was discovered that Vim incorrectly handled memory access. An attacker could potentially use this issue to cause the corruption of sensitive information, a crash, or arbitrary code execution.

CVE: Latest News

CVE-2023-50976: Transactions API Authorization by oleiman · Pull Request #14969 · redpanda-data/redpanda
CVE-2023-6905
CVE-2023-6903
CVE-2023-6904
CVE-2023-3907