Linux 3.13.0-32-generic Exploit Info

The bug resided in the overlayfs implementation regarding the rename operation. Specifically, when renaming a file across directories on an overlayfs mount, the kernel failed to properly check permissions on the upper directory. A local attacker could exploit this race condition to rename a file from a world-writable location to a protected location (like /etc/passwd or /etc/sudoers ). In a normal filesystem, renaming a file requires write permissions on the source and target directories. However, in the buggy overlayfs code, the kernel performed the rename operation using the lower filesystem's credentials (which are privileged) instead of the calling user's credentials.

For penetration testers: Enjoy the easy win, but document it thoroughly. A root shell via a 9-year-old bug is a clear sign of a broken patch management policy. linux 3.13.0-32-generic exploit

char opts[256]; snprintf(opts, sizeof(opts), "lowerdir=%s,upperdir=%s,workdir=%s", lower, upper, work); mount("overlay", merged, "overlayfs", 0, opts); Now, inside /tmp/merged , the file file appears. If you edit it, the changes actually go to /tmp/upper/file . This is where the exploit deviates from normal behavior. The attacker creates a second thread. Thread A tries to rename the file from the overlay to a protected location (e.g., /etc/cron.d/exploit ). Thread B constantly churns the filesystem by creating and deleting files in the upper directory. The bug resided in the overlayfs implementation regarding