Sign up ×
Information Security Stack Exchange is a question and answer site for information security professionals. It's 100% free, no registration required.

I use vim and have a use case for modelines. A modeline means that vim will parse a textfile for lines like:

# vim: set someoption=somevalue

and will then set those options. This is awesome if I'm the person writing the modelines, but it also might break down the assumption that I can open untrusted text files with my text editor with no harm.

Assume that I'm running an updated version of vim. Assume that I don't mind if someone can set annoying options that make things look bad (eg, messing with the tabwidth). What could a malicious text file do?


share|improve this question

1 Answer 1

up vote 2 down vote accepted

Ideally not a lot, but in practice it's not as ideal as the ideal would suggest.

Just search for vim modeline vulnerability for a few examples of how this has gone wrong in the past. This is part of why modeline support is by default disabled if you're running vim as root.

share|improve this answer
-1. I found this answer via a Google search for "vim modeline vulnerability", and it simply recommends a Google search for the same term. Stack Exchange answers should be answers, and not just recommendations of searches someone could easily do. –  Scott Severance Apr 5 at 23:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.