Skip to content
Path traversal Write-up Intermediate

From writing to /tmp to a root shell on Inteno IOPSYS

The file read/write functions intended to be confined to /tmp could be abused because /var is a symlink to /tmp, allowing an authenticated user to overwrite Samba's configuration file. By adding a share with force user = root, the attacker gained root-level read/write access to the whole filesystem and could drop an SSH key to obtain a root shell.

blog.nns.ee

Published on blog.nns.ee

In this blog post, I describe how multiple safe features and configurations can be used to gain full filesystem read-write access - and a root shell - on devices running Inteno's IOPSYS as an authenticated user. This issue has been assigned the CVE ID: CVE-2018-14533.

The author, on blog.nns.ee

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

An authenticated user could gain full filesystem read-write access and a root shell, and the same flaw could also be used for other attacks such as running a script as root via dnsmasq or causing denial of service.

What the attacker needed

Authenticated user account on the device; network access to the router's web interface; Samba service available on the device

The fix

The vendor applied a fix that stores all files in /tmp/juci and renamed the calls to read_tmp_juci and write_tmp_juci.

How it was found

  1. Log in as the low-privileged user and call the file write function to overwrite the Samba configuration in /tmp/etc/smb.conf.
  2. Add a share whose path is the filesystem root, with guest access and force user set to root.
  3. Connect to the new share with smbclient as a guest.
  4. Read /etc/shadow to confirm root-level filesystem access.
  5. Upload an SSH public key to the dropbear authorized_keys file.
  6. Log in over SSH 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.

The router lets a normal logged-in user save files, but only in a temporary folder meant to be harmless. On this system that temporary folder is also where the Samba file-sharing program keeps its settings, so the user could rewrite those settings to give themselves full control. They then used that control to add their own login key and log in as the router's most powerful user.

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.