Skip to content
Path traversal Write-up Advanced

Privilege escalation eop vulnerability

A SUID binary for IBM DB2 (db2cacpy) could be tricked into copying an arbitrary file to /etc/services via a path traversal, allowing a local user to read any file. The attackers used this to read a Kerberos keytab and forge a ticket to log in as root over SSH.

blackarrow.net

Published on blackarrow.net

In one of its operations, the Red Teaming achieved command execution in a perimeter web page as a non-privileged user. This article describes the analysis and exploiting of a vulnerability (CVE-2018-1685) that could allow an attacker to read arbitrary files, but of which no public details are known.

Administrador, on blackarrow.net

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Impact

A local user could read arbitrary files, and in this case the attackers used that to obtain Kerberos keys and execute commands as root.

What the attacker needed

Local access as non-privileged user; SUID binary db2cacpy present; ability to create files in /tmp

The fix

The binary should validate the file path to prevent directory traversal, for example by resolving the canonical path and ensuring it stays within /tmp.

How it was found

  1. Find SUID binaries owned by root, including db2cacpy.
  2. Download the binary and required DB2 libraries for local analysis.
  3. Reverse engineer the binary to find a hardcoded key and a check that the second argument starts with '/tmp/services.'.
  4. Create a directory named 'services.' in /tmp and use a path traversal to make the binary copy /etc/shadow to /etc/services.
  5. Read the copied file to obtain sensitive information.
  6. Use the arbitrary file read to extract Kerberos keytab keys and forge a ticket for SSH access as root.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A program that runs with extra privileges (SUID) was supposed to copy a temporary file into a system file, but it did not check the file path properly. By putting special '..' sequences in the path, an attacker could make it copy a sensitive file like /etc/shadow instead. The attackers then used that ability to steal Kerberos keys and log in as an administrator.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.