Opened 3 weeks ago

Closed 2 weeks ago

#6076 closed enhancement (fixed)

vim >= 9.2.1346 (Security Update)

Reported by: Joe Locash Owned by: SecurityAdvisory
Priority: high Milestone: 13.2
Component: Book Version: git
Severity: normal Keywords:
Cc:

Description

A couple of recent security advisories:

Insecure Socket Directory in Vim < 9.2.1308
===========================================
Date: 08.11.2026
Severity: Medium
CVE: *requested, not yet assigned*
CWE: Unverified Ownership (CWE-283), Incorrect Default Permissions (CWE-276)

## Summary
When using the socketserver backend of the clientserver feature, Vim places
its socket in a per-user directory such as `/tmp/vim-<uid>`.  An existing
directory was used without checking its owner or permissions, and the socket
was created with the user's umask.  A local attacker can pre-create this
directory and then connect to or replace the victim's server socket, which
allows evaluating arbitrary Vim expressions in the victim's Vim.

## Description
`socketserver_get_path()` creates the socket directory
`$XDG_RUNTIME_DIR/vim` or `$TMPDIR/vim-<uid>` (`/tmp` if `$TMPDIR` is unset)
using:

    if (vim_mkdir(buf, 0700) == -1 && errno != EEXIST)
        continue;

If the directory already exists, it is used as-is.  Since `/tmp` is
world-writable, another user can create `/tmp/vim-<uid>` for the victim's
uid beforehand, owned by the attacker and with permissive mode.
`channel_listen_unix()` then binds the server socket inside that directory
with permissions `0777 & ~umask`.  The socketserver does not authenticate
connecting clients and evaluates "expr" messages using
`eval_client_expr_to_string()`, and "keystrokes" messages are inserted into
the input buffer.

With a permissive umask (e.g. `002` or `000`) the attacker can connect to the
socket directly.  With the common umask `022` a direct connect fails, but
since the attacker owns the directory, they can still remove or replace the
socket and impersonate the server towards clients.

## Impact
Arbitrary Vim expression evaluation, and therefore arbitrary shell command
execution, in the context of the user running Vim, on multi-user systems.

Exploitation requires:

* a Vim build with the `+socketserver` feature, used as server (e.g. using
  `--servername` or with `+autoservername`),
* the attacker having a local account on the same system,
* the socket directory being located in a shared directory such as `/tmp`
  (`$XDG_RUNTIME_DIR` is not affected, since it is only accessible by the
  user),
* for direct code execution: a umask that makes the socket accessible by
  the attacker.

## Acknowledgements
The Vim project would like to thank Calif.io and 360AlphaLab for independently
reporting the issue.

## References
The issue has been fixed as of Vim patch [v9.2.1308](https://github.com/vim/vim/releases/tag/v9.2.1308).

- [Commit](https://github.com/vim/vim/commit/a448e0c6bc459d7dbeab581bcb76a0d)
- [Github Security Advisory](https://github.com/vim/vim/security/advisories/GHSA-p99j-mfjp-r4cg)
Heap Buffer Overflow with Crafted Spell File in Vim < 9.2.1309
==============================================================
Date: 08.11.2026
Severity: Low
CVE: *requested, not yet assigned*
CWE: Access of Resource Using Incompatible Type (CWE-843), Out-of-bounds Read
(CWE-125)

## Summary
A crafted spell file (`.spl`) containing two SN_SOFO sections causes Vim to
free the soundfolding items of the first section as if they were SN_SAL
items, reading beyond the allocated memory.  The spell file can be loaded by
a modeline, so opening a file is enough to trigger the issue.

## Description
The SN_SAL and SN_SOFO sections of a spell file both store their
soundfolding information in `sl_sal`.  For an SN_SOFO section, `set_sofo()`
uses `sl_sal` as an array of 256 `int *` pointers.  Before doing so, it calls
`free_sal_items()` to free any previous contents, which treats the array as
`salitem_T` entries.

Vim only writes either an SN_SAL or an SN_SOFO section, but the spell file
reader accepted any number of them.  When a second SN_SOFO section follows
the first one, `free_sal_items()` interprets the `int *` array as
`salitem_T` entries, reading beyond the end of the allocation and passing
the read values to `vim_free()`.

Since `'spelllang'` accepts the name of a `.spl` file and can be set from a
modeline together with `'spell'`, a crafted spell file is loaded when a file
containing such a modeline is opened.

## Impact
A heap out-of-bounds read, resulting in a crash of Vim.  An invalid free has
not been demonstrated but cannot be ruled out.

Exploitation requires:

* the crafted `.spl` file and a file with a modeline setting `'spell'` and
  `'spelllang'` to it, e.g. in a cloned repository or an extracted archive,
* `'modeline'` being enabled
* a multi-byte `'encoding'` such as utf-8 (the default in most environments).

## Acknowledgements
The Vim project would like to thank pangflame for reporting the issue.

## References
The issue has been fixed as of Vim patch [v9.2.1309](https://github.com/vim/vim/releases/tag/v9.2.1309).

- [Commit](https://github.com/vim/vim/commit/bdcb63d47fa5e86406a7b04a0ab62638018fb6b5)
- [Github Security Advisory](https://github.com/vim/vim/security/advisories/GHSA-26qr-jvfj-hcwm)

Change History (4)

comment:1 by Joe Locash, 2 weeks ago

Summary: vim >= 9.2.1309 (Security Update) → vim >= 9.2.1342 (Security Update)

Another update...

Command Execution via CSS Omni-Completion in Vim < 9.2.1342
===========================================================
Date: 12.11.2026
Severity: Low
CVE: *requested, not yet assigned*
CWE: Improper Neutralization of Special Elements used in an OS Command
     (CWE-78)

## Summary
The CSS omni-completion script in `runtime/autoload/csscomplete.vim` passes
the file name after an `@...ort` rule from the buffer to `glob()` without
escaping it.  On Unix, `glob()` hands a pattern containing backticks to the
shell, which allows arbitrary command execution when the user completes an
`@...ort` file name in a crafted CSS file.

## Description
When completing after `@...ort "` or `@...ort url(`,
`csscomplete#CompleteCSS()` takes the text typed so far and calls
`glob(filestart . '*')` to find matching files.  The text is taken directly
from the current line and not escaped.

If it contains backticks, `glob()` uses the shell for the expansion
and the text between the backticks is executed as a shell command.

## Impact
Arbitrary command execution in the context of the user running Vim, when the
user uses omni completion (`CTRL-X CTRL-O`) on a crafted `@...ort` line in a
CSS file.

Exploitation requires:
- a Unix-like system (on Windows `glob()` does not invoke the shell),
- filetype plugins enabled, so that 'omnifunc' is set for CSS files,
- the victim opening a crafted CSS file and using omni completion with the
  cursor after the crafted `@...ort` value.

The severity is rated Low because, unlike opening the file alone, the user
must explicitly invoke omni completion on a crafted suspicious line.

## Acknowledgements
The Vim project would like to thank Github user Magashwarahan for reporting the
issue.

## References
The issue has been fixed as of Vim patch [v9.2.1342](https://github.com/vim/vim/releases/tag/v9.2.1342).
- [Commit](https://github.com/vim/vim/commit/cd50664ab086a37839e3d12754040dbc324dbfa7)
- [Github Security Advisory](https://github.com/vim/vim/security/advisories/GHSA-pp46-p33v-78rf)

comment:2 by Joe Locash, 2 weeks ago

Summary: vim >= 9.2.1342 (Security Update) → vim >= 9.2.1346 (Security Update)

One more...

Command Execution via PowerShell Keyword Lookup in Vim < 9.2.1346
=================================================================

Date: 14.11.2026
Severity: Low
CVE: *requested, not yet assigned*
CWE: Improper Neutralization of Special Elements used in an OS Command
     (CWE-78)

## Summary

The fix for [GHSA-r5v6-q6j8-8qw2](https://github.com/vim/vim/security/advisories/GHSA-r5v6-q6j8-8qw2)
in `runtime/ftplugin/ps1.vim` quotes the argument of `K` for PowerShell by
doubling ASCII single quotes.  PowerShell also treats the typographic quotes
U+2018, U+2019, U+201A and U+201B as single quotes, which were not doubled.  A
crafted line in a PowerShell script can therefore still execute arbitrary
commands when the user selects it and presses `K`.

## Description

The PowerShell filetype plugin defines a `:GetHelp` command and sets
`keywordprg` to it.  The command passes the argument of `K` to PowerShell
as `Get-Help -Full '<arg>'` via `-Command`, doubling every `'` in the
argument to keep it inside the single-quoted string.

The PowerShell language accepts `'`, `‘`, `’`, `‚` and `‛` as
single-quote characters.  A typographic quote in the argument therefore
terminates the string, and the text following it is executed as PowerShell
code, e.g. for the line:

    x’;./hook.ps1;’

## Impact

Arbitrary command execution in the context of the user running Vim.
Exploitation requires:

- Vim with filetype plugins enabled and PowerShell (`pwsh` or
  `powershell.exe`) installed
- the victim opening a crafted PowerShell script, selecting the crafted
  line in Visual mode and invoking the keyword lookup with `K`.

The severity is rated Low because Normal-mode `K` is not affected and
exploitation requires the victim to deliberately select the crafted text in
Visual mode and invoke the keyword lookup.

## Acknowledgements

The Vim project would like to thank Zachariah Mithani for reporting the issue.

## References

The issue has been fixed as of Vim patch [v9.2.1346](https://github.com/vim/vim/releases/tag/v9.2.1346).

- [Commit](https://github.com/vim/vim/commit/188a790b05a282926b311503245f5119a5f6f3ed)
- [Github Security Advisory](https://github.com/vim/vim/security/advisories/GHSA-XXXX)
- [Previous advisory](https://github.com/vim/vim/security/advisories/GHSA-r5v6-q6j8-8qw2)

comment:3 by Bruce Dubbs, 2 weeks ago

Owner: changed from lfs-book to SecurityAdvisory

Updated at commit f4fe536d6. Leaving open for SA.

comment:4 by Bruce Dubbs, 2 weeks ago

Resolution: → fixed
Status: new → closed

Advisory sa-13.1-110 has been issued.

Note: See TracTickets for help on using tickets.