Summary
A persistent open redirect vulnerability was identified in Facebook’s mobile Push Notification endpoint, allowing attackers to bypass Linkshim and redirect users to malicious sites.
https://p.facebook.com/notifications/client/push/enabled/
The issue was caused by improper validation of the ?ref= parameter, which allowed attackers to craft a URL that forces Facebook to redirect users to an external website. Although Facebook normally protects users through Linkshim, this specific endpoint failed to sanitize deeply encoded redirect payloads, resulting in a successful open redirect.
Root Cause Analysis
When inspecting the source code of the push-notification page, a suspicious JavaScript object appeared:
[ upsell: null, redirectUrl: "{}", enabledUrl: null ]
The presence of redirectUrl indicated that the endpoint supports redirect behavior when a ?ref= parameter is supplied. Normally, Facebook sanitizes redirect parameters, but this endpoint failed to validate deeply encoded values.
Initial attempts such as:
?ref=https://evil.com
or:
?ref=https%3A%2F%2Fevil.com
did not trigger any redirect.
However, stacking additional encoded slashes finally bypassed validation:
https%3A%2F%2F%2Fevil%2ecom
This broke the validation logic and caused the browser to treat it as a valid external URL. As a result, Facebook rendered the page and immediately redirected the user to the attacker-controlled domain.
This enabled a full open redirect to any external website.
Attack Flow
- User clicks a crafted URL containing a malicious
refvalue. - The server reads the unsanitized
refparameter and assigns it toredirectUrl. - Facebook’s redirect logic attempts to normalize the URL.
- Over-encoded slashes bypass the domain validation.
- The browser interprets the payload as a valid absolute external URL.
- The user is redirected to an attacker-controlled site (phishing, malware, credential theft).
Proof of Concept (PoC)
A working payload that redirects users to https://evil.com:
https://p.facebook.com/notifications/client/push/enabled/?ref=https%3A%2F%2F%2Fevil%2ecom
Decoded, this becomes an unusual triple-slash pattern:
https:///evil.com
When evaluated by the browser, it becomes:
https://evil.com
and the redirect triggers successfully.
Attempts to perform XSS on this endpoint failed due to Facebook’s strict hex-encoding filters and Linkshim, but the open redirect itself is still a security concern, especially for phishing.
Steps to Reproduce
Visit the endpoint:
https://p.facebook.com/notifications/client/push/enabled/Test a normal redirect:
?ref=https://example.com→ No redirect
Test an encoded redirect:
?ref=https%3A%2F%2Fexample.com→ Still no redirect
Use a deeply encoded triple-slash payload:
?ref=https%3A%2F%2F%2Fevil%2ecomFull exploit URL:
https://p.facebook.com/notifications/client/push/enabled/?ref=https%3A%2F%2F%2Fevil%2ecomResult:
https://evil.com
Disclosure Timeline
- September 22, 2020 — Reported to Facebook Whitehat
- September 23, 2020 — Facebook team reproduced and began investigation
- September 28, 2020 — Provided additional technical details
- October 08, 2020 — Patch deployed and vulnerability fixed
- October 21, 2020 — Bounty awarded
Conclusion
A simple over-encoded triple-slash payload was enough to slip past Facebook’s redirect validation and defeat Linkshim entirely. Normal and single-encoded payloads were caught, but stacking the encoding one layer further broke the domain check, and the browser resolved it into a clean external URL anyway. The result is a persistent open redirect on a trusted Facebook domain, which is exactly the kind of flaw phishing campaigns rely on since the link appears to come from Facebook itself.
FAQ
What is this? Linkshim Bypass and Persistent Open Redirect via Double URL Encoding on Facebook’s Push Notification Endpoint.
How does it work? It’s all in the Root Cause Analysis and Attack Flow sections above, read top to bottom.
Isn’t it useless?
Not at all. The victim only needs to click a link that looks like it points to facebook.com. No application install, no special access, just a crafted ?ref= value doing the work.
What’s so bad about it? Linkshim exists specifically to stop Facebook links from redirecting users to malicious sites, but this endpoint skipped that protection entirely. A URL that starts with a trusted facebook.com domain can still land the user on an attacker controlled page, which makes it far more convincing than a typical phishing link.
Why?
Because the ?ref= parameter was validated against simple and single-encoded payloads, but a deeply encoded triple-slash value was enough to break that validation logic before the browser normalized and followed it. It’s already fixed as of October 08, 2020, per the timeline above.