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.
Technique
- Use web application debugging tool such as WebScarab, Tamper Data or TamperIE to analyze the information exchanged between the client and the server
- Use network sniffing tool such as Wireshark to analyze the information exchanged between the client and the server
- View HTML source of web pages that contain links or buttons that perform actions of interest.
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.
Technique
- Create a GET request containing all required parameters (e.g. https://www.somebank.com/members/transfer.asp?to=012345678901&amt=10000)
- Create a form that will submit a POST request (e.g.
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.
Technique
- Execute a phishing attack and send the user an e-mail convincing them to click on a link.
- Execute a stored XSS attack on a website to permanently embed the malicious link into the website.
- Execute a stored XSS attack on a website where an XMLHTTPRequest object will automatically execute the attack as soon as a user visits the page. This removes the step of convincing a user to click on a link.
- Include the malicious link on the attackers' own website where the user may have to click on the link, or where an XMLHTTPRequest object may automatically execute the attack when a user visits the site.
Skills Required
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.
Resources Required
All the attacker needs is the exact representation of requests to be made to the application and to be able to get the malicious link across to a victim.
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 Weaknesses
CWE-ID |
Weakness Name |
|
Cross-Site Request Forgery (CSRF) The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request. |
|
Missing Authentication for Critical Function The product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources. |
|
Improper Control of a Resource Through its Lifetime The product does not maintain or incorrectly maintains control over a resource throughout its lifetime of creation, use, and release. |
|
Incorrect Permission Assignment for Critical Resource The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors. |
|
Sensitive Cookie with Improper SameSite Attribute The SameSite attribute for sensitive cookies is not set, or an insecure value is used. |
References
REF-62
Session Riding: A Widespread Vulnerability in Today's Web Applications
Thomas Schreiber.
https://crypto.stanford.edu/cs155old/cs155-spring08/papers/Session_Riding.pdf REF-602
OWASP Web Security Testing Guide
https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/06-Session_Management_Testing/05-Testing_for_Cross_Site_Request_Forgery.html
Submission
Name |
Organization |
Date |
Date release |
CAPEC Content Team |
The MITRE Corporation |
2014-06-23 +00:00 |
|
Modifications
Name |
Organization |
Date |
Comment |
CAPEC Content Team |
The MITRE Corporation |
2015-11-09 +00:00 |
Updated Attack_Phases |
CAPEC Content Team |
The MITRE Corporation |
2015-12-07 +00:00 |
Updated Attack_Phases |
CAPEC Content Team |
The MITRE Corporation |
2017-01-09 +00:00 |
Updated Alternate_Terms, Attack_Phases |
CAPEC Content Team |
The MITRE Corporation |
2017-05-01 +00:00 |
Updated Attack_Phases |
CAPEC Content Team |
The MITRE Corporation |
2017-08-04 +00:00 |
Updated Attack_Phases, Related_Attack_Patterns |
CAPEC Content Team |
The MITRE Corporation |
2018-07-31 +00:00 |
Updated Attack_Phases, References |
CAPEC Content Team |
The MITRE Corporation |
2020-07-30 +00:00 |
Updated Example_Instances, Execution_Flow, Related_Weaknesses |
CAPEC Content Team |
The MITRE Corporation |
2020-12-17 +00:00 |
Updated References, Taxonomy_Mappings |
CAPEC Content Team |
The MITRE Corporation |
2021-06-24 +00:00 |
Updated Related_Weaknesses |