Dark Mode

Settings

Capec-40 Detail

Manipulating Writeable Terminal Devices

Standard Software Likelihood: High Typical Severity: Very High

Parents: 248

Description

This attack exploits terminal devices that allow themselves to be written to by other users. The attacker sends command strings to the target terminal device hoping that the target user will hit enter and thereby execute the malicious command with their privileges. The attacker can send the results (such as copying /etc/passwd) to a known directory and collect once the attack has succeeded.

Not present

External ID Source Link Description
CAPEC-40 capec https://capec.mitre.org/data/definitions/40.html
CWE-77 cwe http://cwe.mitre.org/data/definitions/77.html
REF-1 reference_from_CAPEC G. Hoglund, G. McGraw, Exploiting Software: How to Break Code, 2004--02, Addison-Wesley
Explore
  1. Identify attacker-writable terminals: Determine if users TTYs are writable by the attacker.

  2. Techniques
    Determine the permissions for the TTYs found on the system. Any that allow user write to the TTY may be vulnerable.
    Attempt to write to other user TTYs. This approach could leave a trail or alert a user.
Exploit
  1. Execute malicious commands: Using one or more vulnerable TTY, execute commands to achieve various impacts.

  2. Techniques
    Commands that allow reading or writing end user files can be executed.
  1. User terminals must have a permissive access control such as world writeable that allows normal users to control data on other user's terminals.
  1. Access to a terminal on the target network
Low
Ability to discover permissions on terminal devices. Of course, brute force can also be used.
Integrity Availability Authorization Access Control Confidentiality
Execute Unauthorized Commands (Run Arbitrary Code) Execute Unauthorized Commands (Run Arbitrary Code) Gain Privileges Gain Privileges Gain Privileges
Read Data
Execute Unauthorized Commands (Run Arbitrary Code)
  1. "Any system that allows other peers to write directly to its terminal process is vulnerable to this type of attack. If the terminals are available through being over-privileged (i.e. world-writable) or the attacker is an administrator, then a series of commands in this format can be used to echo commands out to victim terminals. "$echo -e "\033[30m\033\132" > /dev/ttyXX where XX is the tty number of the user under attack. This will paste the characters to another terminal (tty). Note this technique works only if the victim's tty is world writable (which it may not be). That is one reason why programs like write(1) and talk(1) in UNIX systems need to run setuid." [REF-1] If the victim continues to hit "enter" and execute the commands, there are an endless supply of vectors available to the attacker, copying files, open up network connections, ftp out to servers, and so on.