CAPEC-500: WebView Injection
An adversary, through a previously installed malicious application, injects code into the context of a web page displayed by a WebView component. Through the injected code, an adversary is able to manipulate the DOM tree and cookies of the page, expose sensitive information, and can launch attacks against the web application from within the web page.
Last updated
Overview
CAPEC-500 (WebView Injection) is a detailed-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
[Determine target web application] An adversary first needs to determine what web application they wish to target.
- Target web applications that require users to enter sensitive information.
- Target web applications that an adversary wishes to operate on behalf of a logged in user.
- Step 2Experiment
[Create malicious application] An adversary creates an application, often mobile, that incorporates a WebView component to display the targeted web application. This malicious application needs to downloaded by a user, so adversaries will make this application useful in some way.
- Create a 3rd party application that adds useful functionality to the targeted web application. Victims will download the application as a means of using the targeted web application.
- Create a fun game that at some point directs a user to the targeted web application. For example, prompt the user to buy in game currency by directing them to PayPal.
- Step 3Experiment
[Get the victim to download and run the application] An adversary needs to get the victim to willingly download and run the application.
- Pay for App Store advertisements
- Promote the application on social media, either through accounts made by the adversary or by paying for other accounts to advertise.
- Step 4Exploit
[Inject malicious code] Once the victim runs the malicious application and views the targeted web page in the WebView component, the malicious application will inject malicious JavaScript code into the web application. This is done by using WebView's loadURL() API, which can inject arbitrary JavaScript code into pages loaded by the WebView component with the same privileges. This is often done by adding a script tag to the document body with a src destination to a remote location that serves malicious JavaScript code.
- Execute operations on the targeted web page on behalf of an authenticated user.
- Steal cookie information from the victim.
- Add in extra fields to the DOM in an attempt to get a user to divulge sensitive information.
What the attacker needs
Prerequisites
- An adversary must be able install a purpose built malicious application onto the device and convince the user to execute it. The malicious application is designed to target a specific web application and is used to load the target web pages via the WebView component. For example, an adversary may develop an application that interacts with Facebook via WebView and adds a new feature that a user desires. The user would install this 3rd party app instead of the Facebook app.
How to mitigate it
Defenses that reduce the risk of CAPEC-500.
- The only known mitigation to this type of attack is to keep the malicious application off the system. There is nothing that can be done to the target application to protect itself from a malicious application that has been installed and executed.
Frequently asked questions
Common questions about CAPEC-500.
- What is CAPEC-500?
- An adversary, through a previously installed malicious application, injects code into the context of a web page displayed by a WebView component. Through the injected code, an adversary is able to manipulate the DOM tree and cookies of the page, expose sensitive information, and can launch attacks against the web application from within the web page.
- How does a WebView Injection attack work?
- It typically unfolds over 4 phases. It begins with: [Determine target web application] An adversary first needs to determine what web application they wish to target.
- How do you prevent CAPEC-500?
- The only known mitigation to this type of attack is to keep the malicious application off the system. There is nothing that can be done to the target application to protect itself from a malicious application that has been installed and executed.
- What weaknesses does CAPEC-500 target?
- CAPEC-500 exploits 2 CWE weaknesses, including CWE-749 (Exposed Dangerous Method or Function), CWE-940 (Improper Verification of Source of a Communication Channel).
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-500
Track the CVEs and weaknesses attackers exploit with this technique, with AI-written analysis and remediation guidance.