Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising. Learn More

Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising. Learn More

Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

Database Security

Prevent unauthorized access and exceed compliance requirements.

Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

Installing VMware Tools on Kali Linux and Some Debugging Basics

I have been using Backtrack for a while now and decided to switch to Kali Linux, a new open source distribution by the creators of Back track. It's built on Debian and is FHS compliant, which is a very good thing.

So I downloaded the VMware image from the Kali Linux download page and ran it using VMware Fusion. The first thing I did (and I guess everybody does) was run an "apt-get update && apt-get dist-upgrade" to upgrade the system. Immediately after that, I found an annoying issue when trying to drag and drop files from the host into the VM. Here is the error message I got each time I tried to copy a file:

"There was an error getting information about …"


Apparently, the VMware Tools needed to be upgraded and, believe me, it was not an easy task.

Vmware Tools Installation

To install the VMware Tools, I selected "Reinstall VMware Tools" from the "Virtual Machine" menu (I am using VMware Fusion 5.0.3 on Mac OS X, but the same procedure should apply on other platforms and versions).


This automatically mounted a virtual CD containing the installation software.


My next step would be to copy the compressed file, un tar it and run the installer (the version at the time of writing was 9.2.2-893683). This process is not as easy as it might appear:

# cp /media/cdrom/VMwareTools-9.2.2-893683.tar.gz .# tar xzvf VMwareTools-9.2.2-893683.tar.gz# cd  vmware-tools-distrib/# ./

After answering some questions with the default options, I ended up with the following:


I needed to dig deeper into the code to understand what was going on.

Looking at

When I opened the file /usr/bin/ with my favorite editor and searched for the string "is not a valid path to," I found this at line 6152:


Apparently, $kh_path was empty (""), and I needed to find out why. The first parameter of the get ValidKernel Headers Path()function is $kh_path and upon further review I found the code responsible for setting its value (line 6192):

$gKernelHeaders = `$modconfig --get-kernel-headers $mcKverOpt $appLoaderArgs`;

I just added this code right after the line6192 in to find out what the command actually is:

print("$modconfig --get-kernel-headers $mcKverOpt $appLoaderArgs");

Running the tool again gave me this:


Next I tried executing this command:


As I expected, nothing happened. I had to plunge further and find out which files the tool was calling. I suspected that missing files might have been the issue.

Tracing the system calls with strace I found the following:

# apt-get install strace# strace '/usr/lib/vmware-tools/sbin32/vmware-modconfig-console' --validate-kernel-headers -k 3.7-trunk-686-pae "" -- -l "/usr/lib/vmware-tools"

Here is the interesting part:


...[SNIP]...access("/lib/modules/3.7-trunk-686-pae/build/include/linux/version.h", F_OK) = -1 ENOENT (No such file or directory)...[SNIP]...

With that, I'd discovered the issue: the file/lib/modules/3.7-trunk-686-pae/build/include/linux/version.h was missing.

To fix it, I used this:

# cd /lib/modules/3.7-trunk-686-pae/build/include/# ln -s /usr/src/linux-headers-3.7-trunk-686-pae/include/generated/uapi/linux/version.h linux/version.h

And I was presented with the following after running again:


"Excellent," I thought, "it's fixed." In actuality, there was more work to do:


Some of the services reported an error, and one in particular didnot start:

...[SNIP].../etc/init.d/vmware-tools: 1088: local: ': bad variable name     Blocking file system:      failed...[SNIP]...

Fixing /etc/init.d/vmware-tools

It seems that the service initialization script also needed to be fixed. For more details, I opened the /etc/init.d/vmware-tools file to see what lies at line 1088:

local run_kver=`get_version_integer`

The get_version_integer() function is defined as follows:


As you can see above, the script gets the kernel version number by running the "uname –r" command and parsing the result string.

Running the command gave me this:

# uname –r3.7-trunk-686-pae

The issue here is that the script is expecting a set of three numbers (kernel version, major revision and minor revision), but here the u name command only returns two numbers: the kernel version and the major revision (3.7).

When the script called the kernel_version_integer() function, the calling parameter values were wrong:


Here is the kernel_version_integer() function definition:

kernel_version_integer() {  echo $(((($1 * 256) + $2) * 256 + $3))}

The error was that the following operation was executed and, obviously, it failed:

((3 * 256) + 7-trunk-686-pae) * 256 +

The correct operation should be:

((3 * 256) + 7) * 256 + 0

So we have two issues here: v2 is not correctly parsed and v3 is not set to zero.

Here is how I quickly fixed the code of the get_version_integer()function:

get_version_integer() {  local version_uts  local v1  local v2  local v3   version_uts=`uname -r`   # There is no double quote around the back-quoted expression on purpose  # There is no double quote around $version_uts on purpose  set `IFS='.'; echo $version_uts`  v1="$1"  v2="$2"  v3="$3"  # There is no double quote around the back-quoted expression on purpose  # There is no double quote around $v3 on purpose  if [ -z "$v1" ]; then    v1="0"  else    set `IFS='-ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; echo $v1`    v1="$1"  fi  if [ -z "$v2" ]; then    v2="0"  else    set `IFS='-ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; echo $v2`    v2="$1"  fi  if [ -z "$v3" ]; then    v3="0"  else    set `IFS='-ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; echo $v3`    v3="$1"  fi kernel_version_integer "$v1" "$v2" "$v3"}

I found that this resolved the error:


Perfect! The services started successfully.

Keep in mind that I ran If you want to re-run the whole installation with, the file/etc/init.d/vmware-tools will be overwritten. In that case, you would need to modify the file vmware-tools-distrib/installer/ in the VMware Tools installation directory because it will overwrite/etc/init.d/vmware-tools.


It is not always easy to update VMware Tools utility, especially when using non-common Linux distributions. I haven't tried the VMware Fusion 6.0 yet and don't know if these issues are still there, but I'm sure you will have to adapt the fixes according to the errors you may find.

I hope this post will be useful and will save you some time. But remember, debugging basics are important, and you may have to repeat the process for the next kernel or VMware upgrade.

Latest SpiderLabs Blogs

Welcome to Adventures in Cybersecurity: The Defender Series

I’m happy to say I’m done chasing Microsoft certifications (AZ104/AZ500/SC100), and as a result, I’ve had the time to put some effort into a blog series that hopefully will entertain and inform you...

Read More

Trustwave SpiderLabs: Insights and Solutions to Defend Educational Institutions Against Cyber Threats

Security teams responsible for defending educational institutions at higher education and primary school levels often find themselves facing harsh lessons from threat actors who exploit the numerous...

Read More

Breakdown of Tycoon Phishing-as-a-Service System

Just weeks after Trustwave SpiderLabs reported on the Greatness phishing-as-a-service (PaaS) framework, SpiderLabs’ Email Security team is tracking another PaaS called Tycoon Group.

Read More