CAPEC-160: Exploit Script-Based APIs
Some APIs support scripting instructions as arguments. Methods that take scripted instructions (or references to scripted instructions) can be very flexible and powerful. However, if an attacker can specify the script that serves as input to these methods they can gain access to a great deal of functionality. For example, HTML pages support tags that allow scripting languages to be embedded in the page and then interpreted by the receiving web browser. If the content provider is malicious, these scripts can compromise the client application. Some applications may even execute the scripts under their own identity (rather than the identity of the user providing the script) which can allow attackers to perform activities that would otherwise be denied to them.
Last updated
Overview
CAPEC-160 (Exploit Script-Based APIs) is a standard-level attack pattern catalogued by MITRE in the Common Attack Pattern Enumeration and Classification (CAPEC). It describes a recurring method attackers use to exploit software weaknesses.
How the attack works
The phases an attacker typically follows to carry out this attack.
- Step 1Explore
[Identify API] Discover an API of interest by exploring application documentation or observing responses to API calls
- Search via internet for known, published APIs that support scripting instructions as arguments
- Step 2Experiment
[Test simple script] Adversaries will attempt to give a smaller script as input to the API, such as simply printing to the console, to see if the attack is viable.
- Create a general script to be taken as input by the API
- Step 3Exploit
[Give malicious scripting instructions to API] Adversaries will now craft custom scripts to do malicious behavior. Depending on the setup of the application this script could be run with user or admin level priveleges.
- Crafting a malicious script to be run on a system based on priveleges and capabilities of the system
What the attacker needs
Prerequisites
- The target application must include the use of APIs that execute scripts.
- The target application must allow the attacker to provide some or all of the arguments to one of these script interpretation methods and must fail to adequately filter these arguments for dangerous or unwanted script commands.
Resources required
- None: No specialized resources are required to execute this type of attack.
Frequently asked questions
Common questions about CAPEC-160.
- What is CAPEC-160?
- Some APIs support scripting instructions as arguments. Methods that take scripted instructions (or references to scripted instructions) can be very flexible and powerful. However, if an attacker can specify the script that serves as input to these methods they can gain access to a great deal of functionality. For example, HTML pages support tags that allow scripting languages to be embedded in the page and then interpreted by the receiving web browser. If the content provider is malicious, these scripts can compromise the client application. Some applications may even execute the scripts under their own identity (rather than the identity of the user providing the script) which can allow attackers to perform activities that would otherwise be denied to them.
- How does a Exploit Script-Based APIs attack work?
- It typically unfolds over 3 phases. It begins with: [Identify API] Discover an API of interest by exploring application documentation or observing responses to API calls
- What weaknesses does CAPEC-160 target?
- CAPEC-160 exploits 1 CWE weakness, including CWE-346 (Origin Validation Error).
- How severe is CAPEC-160?
- MITRE rates CAPEC-160 as Medium severity.
References
Attack-pattern data is sourced from the MITRE CAPEC catalog (v3.9). Weakness associations link to the corresponding CWE entries on RadicalNotion.AI.
Defend against CAPEC-160
Track the CVEs and weaknesses attackers exploit with this technique, with AI-written analysis and remediation guidance.