Skip to content
Access control Write-up Intermediate

GNU screen root exploit

The logfile permission check in GNU screen opens the logfile with full root privileges, allowing an attacker to truncate any file or create a root-owned file with arbitrary contents. This can be exploited to gain full root access.

lists.gnu.org

Published on lists.gnu.org

Summary: root exploit 4.5.0 Project: GNU Screen Submitted by: None Submitted on: Tue 24 Jan 2017 07:05:09 PM UTC Category: Program Logic Severity: 3 - Normal Priority: 5 - Normal Status: None Privacy: Private Assigned to: None Open/Closed: Open Discussion Lock: Any Release: None Fixed Release: None Planned Release…

The author, on lists.gnu.org

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

Root cause

Likely, the permission check for the logfile name is performed after opening the file with root privileges, allowing arbitrary file creation or truncation.

Impact

An attacker could truncate any file or create a root-owned file with arbitrary contents, potentially leading to full root access.

What the attacker needed

Screen is setuid root or run as root; attacker can run screen commands

How it was found

  1. Run screen with the -L option to enable logging and specify a logfile name.
  2. The logfile is created with root ownership in the current directory.
  3. The contents of the logfile are the output of the command run by screen.

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.

GNU screen is a terminal multiplexer that lets you run multiple terminal sessions. A bug in how it checks permissions for log files means that when screen runs with root privileges, it can be tricked into creating or overwriting files anywhere on the system as the root user. An attacker could use this to replace important system files and take full control of the machine.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.