CAPECattack pattern
CAPEC-62 Cross Site Request Forgery
Very High
Official page ↗
- Abstraction
- Standard
- Status
- Draft
- Likelihood of attack
- High
- Typical severity
- Very High
- CAPEC version
- 3.9
Description
An attacker crafts malicious web links and distributes them (via web pages, email, etc.), typically in a targeted manner, hoping to induce users to click on the link and execute the malicious action against some third-party application. If successful, the action embedded in the malicious link will be processed and accepted by the targeted application with the users' privilege level. This type of attack leverages the persistence and implicit trust placed in user session cookies by many web applications today. In such an architecture, once the user authenticates to an application and a session cookie is created on the user's system, all following transactions for that session are authenticated using that cookie including potential actions initiated by an attacker and simply "riding" the existing session cookie.
Execution flow
1. [Explore] [Explore target website] The attacker first explores the target website to determine pieces of functionality that are of interest to them (e.g. money transfers). The attacker will need a legitimate user account on the target website. It would help to have two accounts.
2. [Experiment] [Create a link that when clicked on, will execute the interesting functionality.] The attacker needs to create a link that will execute some interesting functionality such as transfer money, change a password, etc.
3. [Exploit] [Convince user to click on link] Finally, the attacker needs to convince a user that is logged into the target website to click on a link to execute the CSRF attack.
Skills required
• [Medium] The attacker needs to figure out the exact invocation of the targeted malicious action and then craft a link that performs the said action. Having the user click on such a link is often accomplished by sending an email or posting such a link to a bulletin board or the likes.
Consequences
• Confidentiality, Access Control, Authorization: Gain Privileges
• Confidentiality: Read Data
• Integrity: Modify Data
Mitigations
• Use cryptographic tokens to associate a request with a specific action. The token can be regenerated at every request so that if a request with an invalid token is encountered, it can be reliably discarded. The token is considered invalid if it arrived with a request other than the action it was supposed to be associated with.
• Although less reliable, the use of the optional HTTP Referrer header can also be used to determine whether an incoming request was actually one that the user is authorized for, in the current context.
• Additionally, the user can also be prompted to confirm an action every time an action concerning potentially sensitive data is invoked. This way, even if the attacker manages to get the user to click on a malicious link and request the desired action, the user has a chance to recover by denying confirmation. This solution is also implicitly tied to using a second factor of authentication before performing such actions.
• In general, every request must be checked for the appropriate authentication token as well as authorization in the current session context.
Related
Child of · CAPEC (1)
- CAPEC-21 Exploitation of Trusted Identifiers attack pattern
Weakness · CWE (5)
- CWE-1275 Sensitive Cookie with Improper SameSite Attribute weakness
- CWE-306 Missing Authentication for Critical Functionality weakness
- CWE-352 Cross-Site Request Forgery weakness
- CWE-664 Improper Control of a Resource Through its Lifetime weakness
- CWE-732 Incorrect Permission Assignment for Critical Resource weakness
Referenced by CAPEC · child of (1)
- CAPEC-467 Cross Site Identification attack pattern
Referenced by CWE · attack pattern (5)
- CWE-1275 Sensitive Cookie with Improper SameSite Attribute weakness
- CWE-306 Missing Authentication for Critical Functionality weakness
- CWE-352 Cross-Site Request Forgery weakness
- CWE-664 Improper Control of a Resource Through its Lifetime weakness
- CWE-732 Incorrect Permission Assignment for Critical Resource weakness