Skip to main content

Overview

Screen and tmux sessions persist after the user detaches. If a privileged user left a session running and permissions allow attaching, you get their shell.

Screen

List Sessions

List All User Sessions

Each directory is named S-<username>. Check for root sessions:

Attach to Session

Same user:
If multiuser mode enabled and you have ACL:

SUID Screen (CVE-2017-5618)

Check if screen is SUID:
GNU Screen 4.5.0 — local root exploit:

Exploit Steps


tmux

List Sessions

Find tmux Sockets

Socket naming: /tmp/tmux-<UID>/default

Check Root tmux

Attach to Session

Same user:

Non-default Socket

Writable Socket

If tmux socket is writable by your user:
If writable:

Enumerate Both

One-liner to check for hijackable sessions:

Quick Reference