macvim-dev / macvim-dev/macvim
[Security] MacVim affected by GHSA-hwg5-3cxw-wvvg — OS command injection via backticks in 'path' option completion (vim < 9.2.0435)
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Vim Script
- Estrellas
- 7.9k
- Forks
- 691
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Summary
MacVim's src/findfile.c and src/optiondefs.h allow backtick expressions in the 'path' option to be executed when file completion is triggered. Since 'path' can be set via modelines, an attacker can embed a malicious backtick command in a project file that executes when the victim uses file-path completion. The fix from vim 9.2.0435 (190cb3c2) has not been applied to macvim r183.
Vulnerability Details
- GHSA: GHSA-hwg5-3cxw-wvvg
- CVE: CVE-2026-44656
- Upstream fix (vim): 9.2.0435 (commit
190cb3c2b6e53290735f2c5cab1a06f703a90e69, 2026-05-03) - Affected code:
src/findfile.c+src/optiondefs.h('path'option) - Vulnerability type: CWE-78 — OS Command Injection
Root Cause
The 'path' option is not marked P_SECURE in src/optiondefs.h, so it can be set via modelines:
/* src/optiondefs.h line 2067 (macvim r183) */
{"path", "pa", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
Missing P_SECURE allows a modeline to set path+=\cmd`. In src/findfile.c, when file completion is performed for 'path'entries, backtick expressions are expanded via the shell — executingcmd`.
Attack Scenario
- Attacker places a project file with a modeline:
// vim: set path+=`id>/tmp/pwned` : - Victim opens the file in MacVim with modeline support enabled (default)
- MacVim sets
pathto include the backtick expression - When the victim presses
Tabfor:findcompletion, MacVim expands the backtick and executesid>/tmp/pwned
Verification
$ grep -n '"path".*P_STRING' src/optiondefs.h
2067: {"path", "pa", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
Missing P_SECURE. Also missing the backtick check in findfile.c. Patch 9.2.0435 not present:
$ git log --all --oneline | grep -i '9.2.0435\|path.*backtick\|hwg5'
(no output)
Suggested Fix
Merge vim patches up to at least 9.2.0435. The fix:
- Adds
P_SECUREto'path'inoptiondefs.h:{"path", "pa", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE|P_COMMA|P_NODUP, - Adds a backtick guard in
findfile.c:/* do not expand backticks, could have been set via a modeline */ if (vim_strchr(buf, '`') != NULL) continue;
References
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con src/optiondefs.h y src/findfile.c, y luego compara los cambios que faltan con el commit de Vim 190cb3c2 o la versión 9.2.0435. Verifica que la opción 'path' y el manejo de las comillas invertidas coincidan con la corrección upstream, y usa las comprobaciones grep y el escenario de ataque del issue para confirmar que la vulnerabilidad está solucionada.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- c, macos, vim
- Área
- desktop, security
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Tranquilo
- Claridad
- Bien especificado
- Aptitud para principiantes
- 68/100