Home > CAPEC List > CAPEC-35: Leverage Executable Code in Non-Executable Files (Version 2.5)  

CAPEC-35: Leverage Executable Code in Non-Executable Files

 
Leverage Executable Code in Non-Executable Files
Definition in a New Window Definition in a New Window
Attack Pattern ID: 35
Abstraction: Standard
Status: Draft
Completeness: Complete
+ Description

Summary

An attack of this type exploits a system's trust in configuration and resource files, when the executable loads the resource (such as an image file or configuration file) the attacker has modified the file to either execute malicious code directly or manipulate the target process (e.g. application server) to execute based on the malicious configuration parameters. Since systems are increasingly interrelated mashing up resources from local and remote sources the possibility of this attack occurring is high.

The attack can be directed at a client system, such as causing buffer overrun through loading seemingly benign image files, as in Microsoft Security Bulletin MS04-028 where specially crafted JPEG files could cause a buffer overrun once loaded into the browser. Another example targets clients reading pdf files. In this case the attacker simply appends javascript to the end of a legitimate url for a pdf (http://www.gnucitizen.org/blog/danger-danger-danger/)

http://path/to/pdf/file.pdf#whatever_name_you_want=javascript:your_code_here

The client assumes that they are reading a pdf, but the attacker has modified the resource and loaded executable javascript into the client's browser process.

The attack can also target server processes. The attacker edits the resource or configuration file, for example a web.xml file used to configure security permissions for a J2EE app server, adding role name "public" grants all users with the public role the ability to use the administration functionality.

< security-constraint>
<description>Security processing rules for admin screens</description>
<url-pattern>/admin/*</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
<auth-constraint>
<role-name>administrator</role-name>
<role-name>public</role-name>
</auth-constraint>
</security-constraint>

The server trusts its configuration file to be correct, but when they are manipulated, the attacker gains full control.

+ Attack Prerequisites
  • The attacker must have the ability to modify non-executable files consumed by the target software.

+ Typical Severity

Very High

+ Typical Likelihood of Exploit

Likelihood: High

+ Methods of Attack
  • Injection
  • API Abuse
  • Modification of Resources
+ Examples-Instances

Description

Virtually any system that relies on configuration files for runtime behavior is open to this attack vector. The configuration files are frequently stored in predictable locations, so an attacker that can fingerprint a server process such as a web server or database server can quickly identify the likely locale where the configuration is stored. And this is of course not limited to server processes. Unix shells rely on profile files to store environment variables, search paths for programs and so on. If the aliases are changed, then a standard Unix "cp" command can be rerouted to "rm" or other standard command so the user's intention is subverted.

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Low

To identify and execute against an over-privileged system interface

+ Resources Required

Ability to communicate synchronously or asynchronously with server that publishes an over-privileged directory, program, or interface. Optionally, ability to capture output directly through synchronous communication or other method such as FTP.

+ Solutions and Mitigations

Design: Enforce principle of least privilege

Design: Run server interfaces with a non-root account and/or utilize chroot jails or other configuration techniques to constrain privileges even if attacker gains some limited access to commands.

Implementation: Perform testing such as pen-testing and vulnerability scanning to identify directories, programs, and interfaces that grant direct access to executables.

Implementation: Implement host integrity monitoring to detect any unwanted altering of configuration files.

Implementation: Ensure that files that are not required to execute, such as configuration files, are not over-privileged, i.e. not allowed to execute.

+ Attack Motivation-Consequences
ScopeTechnical ImpactNote
Confidentiality
Integrity
Availability
Execute unauthorized code or commands
Run Arbitrary Code
Integrity
Modify application data
Confidentiality
Access_Control
Authorization
Gain privileges / assume identity
+ Injection Vector

Non-executable files

+ Payload

Executable code

+ Activation Zone

Client machine and client network

+ Payload Activation Impact

Description

Enables attacker to execute server side code with any commands that the program owner has privileges to.

+ Purposes
  • Exploitation
+ CIA Impact
Confidentiality Impact: MediumIntegrity Impact: HighAvailability Impact: Low
+ Technical Context
Architectural Paradigms
All
Frameworks
All
Platforms
All
Languages
All
+ References
[R.35.1] [REF-2] G. Hoglund and G. McGraw. "Exploiting Software: How to Break Code". Addison-Wesley. February 2004.
+ Content History
Submissions
SubmitterOrganizationDate
[R.35.1][REF-2] Cigital, Inc2007-01-01
Modifications
ModifierOrganizationDateCommentsSource
Gunnar PetersonCigital, Inc2007-02-28Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"
Sean BarnumCigital, Inc2007-03-09Review and revise
Richard StruseVOXEM, Inc2007-03-26Review and feedback leading to changes in Related Attack Patterns
Sean BarnumCigital, Inc2007-04-13Modified pattern content according to review and feedback
CAPEC Content TeamThe MITRE Corporation2014-02-06Updated Attack_Prerequisites, Attacker_Skills_or_Knowledge_Required, Examples-Instances, Injection_Vector, Resources_Required, Solutions_and_Mitigations, Type (Attack_Pattern -> Attack_Pattern)Internal
CAPEC Content TeamThe MITRE Corporation2014-04-10Updated Related_VulnerabilitiesInternal

Page Last Updated: May 07, 2014