Parameter pollution in social sharing buttons
The social sharing buttons on HackerOne's blog did not properly encode the page URL, so an attacker could add a second 'u' parameter to a crafted link. When a victim shared that link to Facebook, the share preview pointed to the attacker's chosen URL instead of the original article.
Originally disclosed on HackerOne
- Triaged in 2 hours
- Fixed in 8 hours
- Paid in 8 hours
- Disclosed after 8 hours
Hello! For example we have a link https://hackerone.com/blog/introducing-signal-and-impact, and we will change it to https://hackerone.com/blog/introducing-signal-and-impact?&u=https://vk.com/durov. If you send a link to the user and he wants to share a link to facebook, the content will change.
https://www.facebook.com/sharer.php?u=https://hackerone.com/blog/introducing-signal-and-impact?&u=https://vk.com/durov
What the report shows
The target is a HackerOne blog post, and the feature under examination is its Facebook sharing link. The researcher, gorostislav, noticed that the sharing links are built from the page URL, and that the page URL can carry extra query parameters that the sharing code does not strip out.
The demonstration uses a real blog post as the base:
https://hackerone.com/blog/introducing-signal-and-impact
The researcher then appends a second parameter, u, pointing at another site:
https://hackerone.com/blog/introducing-signal-and-impact?&u=https://vk.com/durov
The report states that if a user receives that link and shares it to Facebook, the content will change. The resulting Facebook sharer URL is:
https://www.facebook.com/sharer.php?u=https://hackerone.com/blog/introducing-signal-and-impact?&u=https://vk.com/durov
In other words, the u parameter that the attacker added to the HackerOne URL is carried through into the u parameter of the Facebook sharer endpoint. The report does not show the rendered share preview, so the exact content that Facebook displayed is not documented here; the claim is that "the content will change".
The report was filed on HackerOne, classified as a violation of secure design principles, paid a bounty of 500.00 USD, and was disclosed on 2015-12-19. No CVSS score or severity rating is given in the text, and no fix is described.
Root cause
The report does not describe the cause. Because the page accepts and reflects arbitrary query parameters, an attacker controls part of the string that ends up as the u value of the third-party sharer.
Impact
The effect is parameter pollution of the sharing flow: the attacker decides what URL is offered to the social network when a victim shares the page. The report only states that the shared content will change. The report frames this as content changing in the share dialog; it does not claim script execution, account takeover or any other direct compromise, and those should not be assumed.
How this kind of bug works
Sharing widgets, embed builders, redirectors and canonical-link generators all follow the same pattern: they read the current request URL (or a parameter supplied by the client) and place it into a URL they emit, either into their own markup or into a third-party endpoint. If the value is not parsed and re-serialised properly, any parameter the attacker appends to the page URL becomes part of the generated link.
The classic failure modes are:
- Concatenating the raw query string into an output URL instead of taking only the path or an allow-listed parameter.
- Encoding the value once but not accounting for the fact that the receiving endpoint will decode it again, so a nested
?or&re-emerges as a parameter separator. - Trusting the
HostorRefererheader to build absolute links, which lets an attacker influence the origin as well as the path.
The defence is to treat the shared URL as data: parse it, keep only the components you intend to share, rebuild it with a proper URL API, and percent-encode it when it is embedded as a parameter value.
How to test for it
- Find every place the application generates a link that contains the current URL: share buttons, "copy link", email-this-page, QR generators, canonical and Open Graph tags, OAuth and SSO redirect parameters, and logout return URLs.
- Load a page with a harmless marker parameter appended, for example a unique value in a parameter the page does not otherwise use, and inspect the generated share or redirect link. Does the marker appear?
- If it does, try to break out of the intended parameter: append an extra
&followed by a parameter name the downstream endpoint understands, and see whether it is treated as a separate parameter by the receiving service. - Check the rendered preview on the third-party service, not just the URL string, because some platforms sanitise or ignore the injected value.
- Test the same page with different parameter orders and with encoded variants to see whether the application decodes before or after building the link.
A positive result is a generated link, or a rendered third-party preview, whose destination or metadata is controlled by input the attacker supplied in the page URL. Common false positives are reflected parameters that appear in the page but never reach the outbound link, values that the third party rejects outright, and cases where the change is only cosmetic and the share still resolves to the original page.
How it is fixed
- Build share links from a fixed, server-side canonical URL for the resource, not from the raw request URI.
- If parameters must be forwarded, allow-list them by name and validate their values.
- Percent-encode the URL when it is placed inside another URL's query string, and use a URL parsing library rather than string concatenation.
- Do not derive the origin from user-controlled headers; pin it to a configured value.
Hunting notes
This class of bug hides wherever a page URL is echoed into another context: social share rows, "share via email" links, embed and iframe generators, PDF or print views, and redirect parameters used after login. Recon signals include share buttons whose href contains the full current URL, pages that reflect arbitrary query parameters into meta tags, and any endpoint whose parameter value looks like a URL.
Explain what a victim would see and why the trusted origin makes the share convincing. Keep the claim proportional to what you demonstrated; if the impact is limited to misleading share content, say so rather than implying script execution.
What happened, in plain words
HackerOne runs a blog, and a blog post can be shared to Facebook through a sharing link. The researcher, gorostislav, looked at how those buttons build their links and found that they reuse the address of the page you are currently on, including anything extra that someone has tacked onto the end of that address.
A web address can carry extra pieces after a question mark. Those pieces are called query parameters, and they are how a site passes small values around, for example a search term. The part before the question mark says which page you want; the part after it is a list of name and value pairs. The sharing code was copying the whole address, parameters and all, into the link it sent to Facebook.
That means an attacker can craft a link to a genuine HackerOne blog post, add a parameter of their own, and send it to a victim. The report says that when the link is shared to Facebook, the content will change. The report only states that the shared content will change.
The demonstration starts from a real blog post:
https://hackerone.com/blog/introducing-signal-and-impact
The researcher then appends a second parameter, u, whose value is another site:
https://hackerone.com/blog/introducing-signal-and-impact?&u=https://vk.com/durov
Reading that address piece by piece: https://hackerone.com/blog/introducing-signal-and-impact is the real page; the ? marks the start of the parameters; the & separates parameters from each other; and u=https://vk.com/durov is a parameter named u whose value is a link to a profile on another network.
The report says the content will change when the link is shared to Facebook. The resulting Facebook sharer URL is:
https://www.facebook.com/sharer.php?u=https://hackerone.com/blog/introducing-signal-and-impact?&u=https://vk.com/durov
Here https://www.facebook.com/sharer.php is Facebook's sharing endpoint, and its own parameter is also called u: the address of the page to share. The attacker's u from the HackerOne address has been carried straight through into Facebook's u. The report says the content will change; it does not show the rendered preview, so what Facebook actually displayed is not documented.
The report was filed on HackerOne, classified as a violation of secure design principles, paid a bounty of 500.00 USD, and was disclosed on 2015-12-19. No severity score is given and no fix is described.
The report does not explain why the trick works. The effect is limited to misleading share content: the report does not claim script execution, account takeover or any other direct compromise, and none should be assumed.
In general, how this kind of bug works
Sharing widgets, embed builders, redirectors and canonical-link generators all follow the same pattern: they read the current request address, or a parameter supplied by the client, and place it into an address they emit, either into their own page or into a third-party endpoint. If the value is not parsed and rebuilt properly, any parameter an attacker appends to the page address becomes part of the generated link. Think of a receptionist who copies your entire note, including the postscript someone else added, onto the form they send onward.
The classic failure modes are:
- Concatenating the raw query string into an output address instead of taking only the path or an allow-listed parameter.
- Encoding the value once but not accounting for the fact that the receiving endpoint will decode it again, so a nested
?or&re-emerges as a parameter separator. - Trusting the
HostorRefererheader to build absolute links, which lets an attacker influence the origin as well as the path.
The defence is to treat the shared address as data: parse it, keep only the components you intend to share, rebuild it with a proper URL API, and percent-encode it when it is embedded as a parameter value.
How to test for it
- Find every place the application generates a link that contains the current address: share buttons, "copy link", email-this-page, QR generators, canonical and Open Graph tags, OAuth and SSO redirect parameters, and logout return URLs.
- Load a page with a harmless marker parameter appended, for example a unique value in a parameter the page does not otherwise use, and inspect the generated share or redirect link. Does the marker appear?
- If it does, try to break out of the intended parameter: append an extra
&followed by a parameter name the downstream endpoint understands, and see whether it is treated as a separate parameter by the receiving service. - Check the rendered preview on the third-party service, not just the address string, because some platforms sanitise or ignore the injected value.
- Test the same page with different parameter orders and with encoded variants to see whether the application decodes before or after building the link.
A positive result is a generated link, or a rendered third-party preview, whose destination or metadata is controlled by input the attacker supplied in the page address. Common false positives are reflected parameters that appear in the page but never reach the outbound link, values that the third party rejects outright, and cases where the change is only cosmetic and the share still resolves to the original page.
How it is fixed
- Build share links from a fixed, server-side canonical address for the resource, not from the raw request URI.
- If parameters must be forwarded, allow-list them by name and validate their values.
- Percent-encode the address when it is placed inside another address's query string, and use a URL parsing library rather than string concatenation.
- Do not derive the origin from user-controlled headers; pin it to a configured value.
Hunting notes
This class of bug hides wherever a page address is echoed into another context: social share rows, "share via email" links, embed and iframe generators, PDF or print views, and redirect parameters used after login. Recon signals include share buttons whose href contains the full current address, pages that reflect arbitrary query parameters into meta tags, and any endpoint whose parameter value looks like an address.
Explain what a victim would see and why the trusted origin makes the share convincing. Keep the claim proportional to what you demonstrated; if the impact is limited to misleading share content, say so rather than implying script execution.
Glossary
- Query parameter: a name and value pair after the
?in a web address, used to pass small pieces of information to a page. - Query string: everything after the
?in a web address, made up of one or more query parameters separated by&. - Social sharing button: a button on a page that opens a third-party service's dialog to post that page to a social network.
- Sharer endpoint: the address on a social network that accepts the address of a page to share, here
https://www.facebook.com/sharer.php. - Parameter pollution: a bug where an attacker adds or overrides parameters so that a value they control is used where the application expected its own.
- Concatenation: joining strings end to end; here, gluing the current address into a share link without parsing it.
- Encoding (percent-encoding): rewriting characters in an address so they are treated as data rather than as separators such as
?and&. - URL parsing: splitting an address into its parts (scheme, host, path, parameters) so each can be handled deliberately.
- Allow-list: a list of values that are explicitly permitted, with everything else rejected.
- Canonical URL: the single, fixed address an application decides is the official one for a resource.
- Host header: a field in an HTTP request that names the site the browser wants; if trusted blindly it can be influenced by an attacker.
- Referer header: a field in an HTTP request that names the page the user came from.
- Open Graph tags: metadata in a page's HTML that social networks read to build a preview of a shared link.
- Redirect parameter: a parameter that tells a site where to send the user next, often after login.
- OAuth / SSO: login schemes where one site hands the user to another to sign in and then back again, using redirect parameters.
- False positive: a finding that looks like a bug but is not actually exploitable.
- Bounty: a payment made by a bug bounty programme for a valid report.
- Disclosure: the point at which a report is made public.