Home > CAPEC List > CAPEC-40: Manipulating Writeable Terminal Devices (Version 3.0)  

CAPEC-40: Manipulating Writeable Terminal Devices

Attack Pattern ID: 40
Abstraction: Standard
Status: Draft
Presentation Filter:
+ 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.
+ Likelihood Of Attack

High

+ Typical Severity

Very High

+ Relationships

The table(s) below shows the other attack patterns and high level categories that are related to this attack pattern. These relationships are defined as ChildOf, ParentOf, MemberOf and give insight to similar items that may exist at higher and lower levels of abstraction. In addition, relationships such as CanFollow, PeerOf, and CanAlsoBe are defined to show similar attack patterns that the user may want to explore.

+ Relevant to the view "Mechanisms of Attack" (CAPEC-1000)
NatureTypeIDName
ChildOfMeta Attack PatternMeta Attack Pattern - A meta level attack pattern in CAPEC is a decidedly abstract characterization of a specific methodology or technique used in an attack. A meta attack pattern is often void of a specific technology or implementation and is meant to provide an understanding of a high level approach. A meta level attack pattern is a generalization of related group of standard level attack patterns. Meta level attack patterns are particularly useful for architecture and design level threat modeling exercises.248Command Injection
+ Execution Flow
Explore
  1. Identify attacker-writable terminals: Determine if users TTYs are writable by the attacker. 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.

    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. Commands that allow reading or writing end user files can be executed.

    Techniques
    Commands that allow reading or writing end user files can be executed.
+ Prerequisites
User terminals must have a permissive access control such as world writeable that allows normal users to control data on other user's terminals.
+ Skills Required
[Level: Low]
Ability to discover permissions on terminal devices. Of course, brute force can also be used.
+ Resources Required
Access to a terminal on the target network
+ Consequences

The table below specifies different individual consequences associated with the attack pattern. The Scope identifies the security property that is violated, while the Impact describes the negative technical impact that arises if an adversary succeeds in their attack. The Likelihood provides information about how likely the specific consequence is expected to be seen relative to the other consequences in the list. For example, there may be high likelihood that a pattern will be used to achieve a certain impact, but a low likelihood that it will be exploited to achieve a different impact.

ScopeImpactLikelihood
Confidentiality
Access Control
Authorization
Gain Privileges
Confidentiality
Read Data
Confidentiality
Integrity
Availability
Execute Unauthorized Commands
+ Mitigations
Design: Ensure that terminals are only writeable by named owner user and/or administrator
Design: Enforce principle of least privilege
+ Example Instances

"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." [R.40.1][REF-2]

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.

+ References
[REF-1] G. Hoglund and G. McGraw. "Exploiting Software: How to Break Code". Addison-Wesley. 2004-02.
+ Content History
Submissions
Submission DateSubmitterOrganization
2014-06-23CAPEC Content TeamThe MITRE Corporation
Modifications
Modification DateModifierOrganization
2017-08-04CAPEC Content TeamThe MITRE Corporation
Updated Attack_Phases, Description, Description Summary, Related_Vulnerabilities
2018-07-31CAPEC Content TeamThe MITRE Corporation
Updated Attacker_Skills_or_Knowledge_Required, Related_Attack_Patterns, Type (Attack_Pattern -> Relationship)

More information is available — Please select a different filter.
Page Last Updated or Reviewed: July 31, 2018