Saturday, 11 August 2018

Fixing Kali vs Virtual Box Additions

Like most Pen Testers, I use Kali. However I'm running Kali under Virtual Box on Windows 7. Probably not the best option, but it's what I have to work with. But, and this is a big issue, Kali won't accept the Guest Additions which will allow me to cut and paste between Guest and Host, and map a shared drive. Not good when you need to gather evidence. So it's time to fix it.
Virtual Box 5.2.16
Kali 4.17.0-kali1-amd64
There are numerous articles out there on how to "fix" this issue. But the problem is, they don't work.

First problem is that apt-get update and such does nothing. I mean absolutely nothing. So lets check /etc/apt/sources.list
#
# deb cdrom:[Debian GNU/Linux 2018.2 _Kali-rolling_ - Official Snapshot amd64 LIVE/INSTALL Binary 20180412-10:55]/ kali-last-snapshot contrib main non-free
#deb cdrom:[Debian GNU/Linux 2018.2 _Kali-rolling_ - Official Snapshot amd64 LIVE/INSTALL Binary 20180412-10:55]/ kali-last-snapshot contrib main non-free
# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.
Do you see what's missing? Yep, no repos listed due to the way it was installed. I suspect this may be why many people are saying the "fixes" supplied don't work. Never mind, lets cat "deb http://http.kali.org/kali kali-rolling main non-free contrib"to the end of the file.

Now apt-get update and apt-get dist-upgrade work. Even if they do take a long time to upgrade properly.

So after waiting for all the updates to be done (a shade over 2 hours) now we need to get all the headers loaded to allow Virtual Box to build the additions. So the command to do this is:
apt-get install -y linux-headers-$(uname -r)
Right?

Wrong!

No, that's what you'd expect but that's not what you get. The name of the systems is different. They better option is to find out what headers you need.
apt-cache search linux-headers
This will dump out all the headers included with the build. Go to the top of the list and look for the "-all" option. Thats the one you want. So now, you can run:
apt-get install -y <whatever your build header is>
Finally after that is done (and after a reboot), you're ready to install the Guest Additions. Sort of. Running from the CDRom doesn't work, so remember to copy the file to your home drive.
root@kali:~#cp /media/cdrom/VBoxLinuxAdditions.run ~
root@kali:~# chmod 755 VBoxLinuxAdditions.run
root@kali:~/Desktop#./VBoxLinuxAdditions.run
And now you should be able to copy/paste to your heart's content.

No comments:

Post a Comment