Vim/Neovim Arbitrary Code Execution via Modelines

Huh, strange. So I got it to do something. Here are my keystrokes:
1 vim<enter>
2 :set modeline<enter>
3 :o poc2.txt<enter>
4 (contents of the file now appear in the command section at the bottom)
5 <enter> (to run the command in vim)
6 and then I arrive here:

$ vim Linux wat 5.0.15-steamvr-generic #steamvr1-Ubuntu SMP Sat May 11 18:18:50 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux Press ENTER or type command to continue

So it’s sort of working, but I still had to press <enter> to actually run it.

I then added set modeline to my .vimrc, and then when I open the file I arrive at #4 above which still requires me to press <enter> to actually run uname.


Leave a Reply