-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add guidance for testing password reset token exposure via Referer headers #1355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 5 commits
ef7cc79
a9510b7
d72aded
bf24d5c
b128e7b
8a8cc49
4280158
fbe018f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,10 +113,46 @@ In this model, the user is emailed a link that contains a token. They can then c | |
|
|
||
| - Is the link exposed to third parties? | ||
|
|
||
| If the page that the user is taken to includes content from other parties (such as loading scripts from other domains), then the reset token in the URL may be exposed in the HTTP `Referer` header sent in these requests. The `Referrer-Policy` HTTP header can be used to protect against this, so check if one is defined for the page. | ||
| #### Testing for Reset Token Exposure via Referer Headers | ||
| When a password reset link contains the token in the URL, such as: `https://example.com/reset?token=ABC123` | ||
|
|
||
| Additionally, if the page includes any tracking, analytics or advertising scripts, the token will also be exposed to them. | ||
|
|
||
| the token may be included in the HTTP `Referer` header when the page | ||
| loads external resources such as analytics scripts, images, or | ||
| JavaScript from third-party domains. | ||
|
|
||
| Testers should verify whether the reset token is leaked to external | ||
| services by inspecting network requests made by the reset page. | ||
|
|
||
| **Testing steps:** | ||
|
|
||
| 1. Trigger a password reset request and open the reset link. | ||
| 2. Inspect network requests using browser developer tools or an | ||
| intercepting proxy such as Burp Suite or OWASP ZAP. | ||
| 3. Identify requests made to external domains. | ||
| 4. Check whether the full reset URL, including the token, appears in | ||
| the `Referer` header of these requests. | ||
|
|
||
| If the token is transmitted to third-party domains, an attacker | ||
| controlling those resources may capture the token and use it to reset | ||
| the victim's password. | ||
|
|
||
| **Mitigations include:** | ||
|
|
||
| - Avoid embedding sensitive tokens directly in URLs where possible. | ||
| - Use short-lived tokens and invalidate them after use. | ||
| - Avoid loading third-party scripts or analytics on password reset pages. | ||
| - Configure an appropriate `Referrer-Policy` header such as: | ||
|
|
||
| ``` | ||
| Referrer-Policy: strict-origin | ||
| ``` | ||
|
|
||
| or | ||
|
|
||
| ``` | ||
| Referrer-Policy: no-referrer | ||
| ``` | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this isn't already covered in existing content it should be fit into the Remediation section. so that the entire page follows the established template.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also the header examples should use inline code fences since they aren't multiline blocks. |
||
| - Are the emails sent from a domain with anti-spoofing protection? | ||
|
|
||
| The domain should implement SPF, DKIM, and DMARC to prevent attackers from spoofing emails from it, which could be used as part of a social engineering attack. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this already within a "How to Test" section?