Top Nav

Archive | RedHat

Dirty Cow Vulnerability (CVE-2016-5195)

On October 19, 2016, a privilege escalation vulnerability in the Linux kernel was disclosed. The bug is nicknamed Dirty COW because the underlying issue was a race condition in the way kernel handles copy-on-write (COW). Dirty COW has existed for a long time — at least since 2007, with kernel version 2.6.22 — so the vast majority of servers are at risk.

Exploiting this bug means that a regular, unprivileged user on your server can gain write access to any file they can read, and can therefore increase their privileges on the system. More information can be found on CVE-2016-5195 from Canonical, Red Hat, and Debian.

Fortunately, most major distributions have already released a fix. You can follow this tutorial to see if your server is vulnerable and to apply updates as needed.

Check Vulnerability

Ubuntu/Debian

To find out if your server is affected, check your kernel version.

  • uname -rv

You’ll see output like this:

Output

If your version is earlier than the following, you are affected:

  • 4.8.0-26.28 for Ubuntu 16.10
  • 4.4.0-45.66 for Ubuntu 16.04 LTS
  • 3.13.0-100.147 for Ubuntu 14.04 LTS
  • 3.2.0-113.155 for Ubuntu 12.04 LTS
  • 3.16.36-1+deb8u2 for Debian 8
  • 3.2.82-1 for Debian 7
  • 4.7.8-1 for Debian unstable

CentOS

Some versions of CentOS can use this script provided by RedHat for RHEL to test your server’s vulnerability. To try it, first download the script.

  • wget https://access.redhat.com/sites/default/files/rh-cve-2016-5195_1.sh

Then run it with bash.

  • bash rh-cve-2016-5195_1.sh

If you’re vulnerable, you’ll see output like this:

Output

Fix Vulnerability

Fortunately, applying the fix is straightforward: update your system and reboot your server.

On Ubuntu and Debian, upgrade your packages using apt-get.

  • sudo apt-get update && sudo apt-get dist-upgrade

You can update all of your packages on CentOS 6 and 7 with sudo yum update, but if you only want to update the kernel to address this bug, run:

  • sudo yum update kernel

Right now, we’re still waiting on a fix for CentOS 5. In the interim, you can use this workaround from the Red Hat bug tracker.

Finally, on all distributions, you’ll need to reboot your server to apply the changes.

  • sudo reboot

Conclusion

Make sure to update your Linux servers to stay protected from this privilege escalation bug.

0

Remote access via ssh with RedHat Rescue Disk

  1. Insert Rescue Disk and boot server.
  2. At the first prompt type “linux rescue” and hit enter.
  3. Follow boot disk prompts to start networking. Enter the system’s ip address, netmask, gateway and name server.
  4. Continue with prompts until the root partition is mounted and you get a command prompt.
  5. Verify network configuration with ifconfig and route.
  6. Use the following commands to start sshd:

You should now be able to SSH into the server.

3

Mount Windows drive share on RHEL5

RHEL5 replaced the old smbmount command with mount.cifs so to mount a shared Windows drive do something like:

1

Reinstall grub in MBR

Two approaches to this. The first is to use the grub-install utility:

The second approach is to use the grub command line:

1. Start the grub command line:

2. Determine the boot device:

You’ll get something like “(hd0,0)”.

3. Tell grub where the root is:

4. Install the MBR:

0

Fix strange characters from pstree on RedHat.

By default on Redhat, the output from pstree is scrambled like this:

There are a couple of ways to clear this up so that it looks like this:

Here are two possible solutions:

1. Use “pstree -G” to force VT100 line drawing

2. Do “export LANG=’en_US'” to change the language from UTF-8 to English

1