Bug 142446 - CAN-2004-1138 vim arbitrary command execution vulnerability
Summary: CAN-2004-1138 vim arbitrary command execution vulnerability
Alias: None
Product: Fedora
Classification: Fedora
Component: vim
Version: 3
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Karsten Hopp
QA Contact: David Lawrence
Whiteboard: impact=low,embargo=20041215:14
Keywords: Security
Depends On:
TreeView+ depends on / blocked
Reported: 2004-12-09 19:20 UTC by Josh Bressers
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Clone Of:
Last Closed: 2005-01-12 14:36:08 UTC

Attachments (Terms of Use)

Description Josh Bressers 2004-12-09 19:20:17 UTC
This was reported by gentoo to vendor-sec

Ciaran McCreesh, our Gentoo vim maintainer, found and reported upstream
several modeline-related vulnerabilities in vim :

It's possible to do some pretty nasty stuff via vim modelines despite
the existing security code.

For example, by passing evil values for a fileformat setting in a
modeline, it's possible to make vim source arbitrary scripts upon
startup. This would hurt on a multiuser system. Here's one way:

User 'fred' creates a file in /home/fred/evil.vim containing lots of
nastiness (for example, "system('echo alias vim=emacs >> ~/.bashrc') |
quit"). He then creates a file in some shared location with a modeline
which does something like"set ft=../../../*fred/evil". User 'joe', who
has ftplugins and modelines enabled, edits this file. This results in a
call of ":runtime!../../../*fred/evil" , which (assuming ~/.vim is in
runtimepath) expands to ~/.vim/../../../*fred/evil which matches

Bram Moolenaar provided the following vim patch, that fixes the reported
vulnerabilities and adds more conservative modeline rights :

Patch 6.3.045
Problem:   Unusual characters in an option value may cause unexpected
           behavior, especially for a modeline. (Ciaran McCreesh)
Solution:  Don't allow setting termcap options or 'printdevice' or
           'titleold' in a modeline.  Don't list options for "termcap"
           and "all" in a modeline.  Don't allow unusual characters in
           'filetype', 'syntax', 'backupext', 'keymap', 'patchmode' and
Files:     src/option.c, runtime/doc/options.txt

Comment 1 Josh Bressers 2004-12-09 19:21:15 UTC
Treat this issue as embargoed for now.  While it is technically
public, it's not well known.

Comment 2 Josh Bressers 2004-12-15 21:45:57 UTC
Lifting embargo

Comment 3 Karsten Hopp 2005-01-12 14:36:08 UTC
FC3 packages with a fix pushed and announced

Note You need to log in before you can comment on or make changes to this bug.