macvim-dev / macvim-dev/macvim

[Security] MacVim affected by CVE-2026-46483 — tar#Vimuntar() command injection via shellescape (vim < 9.2.0479)

Đang mở
#1,650 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Vim Script
Star
7.9k
Fork
691
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

[Security] MacVim affected by CVE-2026-46483 — tar#Vimuntar() command injection via shellescape (vim < 9.2.0479)

Summary

MacVim bundles the vim source at version 9.2 (patches 1-332 in the current build), which is
below the patched version 9.2.0479 that fixes CVE-2026-46483.

Vulnerability Details

  • Upstream CVE: CVE-2026-46483
  • Inherited from: vim/vim
  • Affected code: runtime/autoload/tar.vim, function tar#Vimuntar()
  • Vulnerability type: CWE-78 — OS Command Injection
  • Fixed in: vim 9.2.0479 (commit 3fb5e58fbc63d86a3e65f1a141b0d67af2aa38a1)

Root Cause

In tar#Vimuntar() (runtime/autoload/tar.vim), the function decompresses a .tgz tarball
using :!gunzip and tar. The filename is escaped using shellescape(tartail) without
the second argument 1:

" runtime/autoload/tar.vim (macvim r183, around line 815)
if tartail =~ '\.tgz'
   if executable("gunzip")
    silent exe "!gunzip ".shellescape(tartail)

When vim's :! command processes the command string, the ! character in the filename
is interpreted by vim's command-line history substitution BEFORE the shell sees it.
shellescape(x, 0) (the default) does not escape ! for the vim :! context, while
shellescape(x, 1) does.

If an attacker can name a .tgz file to contain !command, and trick a user into
running tar#Vimuntar() on it, the embedded command is executed.

Affected MacVim Code

MacVim's runtime/autoload/tar.vim contains the vulnerable tar#Vimuntar() function at
line 784. The fix changes shellescape(tartail) to shellescape(tartail, 1) throughout
the function.

Note: neovim does NOT have the tar#Vimuntar() function and is not affected by this
specific vulnerability.

Affected MacVim Version

MacVim r183 (vim 9.2 patches 1-332) — current HEAD as of 2026-05-18.

The fix commit 3fb5e58fbc63d86a3e65f1a141b0d67af2aa38a1 from vim/vim is not present
in the macvim-dev/macvim repository:

git log --all --oneline | grep 3fb5e58f  # returns no output

Suggested Fix

Merge or cherry-pick vim/vim patches up to at least 9.2.0479:

The fix changes shellescape(tartail) to shellescape(tartail, 1) which properly escapes
! characters for vim's :! command context.

References

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với runtime/autoload/tar.vim và kiểm tra tar#Vimuntar(), đặc biệt là phần xử lý .tgz xung quanh dòng bị ảnh hưởng. So sánh hàm này với commit Vim 3fb5e58fbc63d86a3e65f1a141b0d67af2aa38a1 và xác minh rằng MacVim bao gồm upstream fix cho đến Vim 9.2.0479; hoàn tất khi hàm dễ bị tấn công đã được cập nhật và thay đổi được bao phủ bằng một bước xác minh phù hợp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
macos, vim
Lĩnh vực
operating-systems, security
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.