Skip to content
Info disclosure Disclosed report Intermediate CVE-2021-43532

Context-menu "Copy Image Link" leaks intermediate redirect paths if loading interrupted

The 'Copy Image Link' context menu item copies the URL after redirects, which can expose intermediate redirect URLs containing sensitive information like tokens. An attacker can use a CSP img-src directive to block the final redirect, leaving the sensitive intermediate URL to be copied.

Ademar Nowasky Junior Follow

Originally disclosed on Mozilla

  • Fixed in 3 months
  • Paid in 3 months
  • Disclosed after 3 months
Text
Created attachment 9229778
poc.html

Hello,

The "Copy Image Link" item in the context menu of an image copies the URL after redirects. This data potentially reveals information about the redirect that would not otherwise be known to the original site. This could be used by a malicious site to obtain sensitive information like usernames or single-sign-on tokens encoded within the target URLs.

In cases where the sensitive information is not present in the final URL but instead in a redirect chain, it's possible to use a CSP img-src directive to break the redirect chain where it's needed to leave the image link with the sensitive information.

To perform this attack the victim needs to copy and paste the image link into the attacker's page. 

The POC demonstrates the redirect chain case in a scenario where the user can choose an avatar by copying and pasting its URL in an input field. Each avatar is loaded in a div as a background-image and the malicious image tags are loaded in front of it with opacity:0 to make them transparent. By right-clicking the avatar image to copy its link the victim will be instead interacting with the malicious image tag.

The POC redirect chain works as follow:

1. The image src is set to https://urlwee.com/foqfun1
2. The image src URL will redirect to the sensitive URL https://bit.ly/36esqPj?token=secret123
3. The sensitive URL will redirect to https://example.com

The goal is to leak the https://bit.ly/36esqPj?token=secret123. This is accomplished with the following CSP:

<meta http-equiv="Content-Security-Policy" content="img-src 'self' https://urlwee.com https://bit.ly">

As the CSP directive doesn't have the https://example.com URL it will block the redirect to it, leaving the image link as https://bit.ly/36esqPj?token=secret123

Video: https://youtu.be/R2kb3fph8PE

Firefox version: 90.0b12 (Windows)

The original report as published on Mozilla's Bugzilla, by Ademar Nowasky Junior. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the browser's 'Copy Image Link' feature uses the final URL after redirects instead of the original image source URL, and does not consider that intermediate redirect URLs may contain sensitive data.

Impact

A malicious site could obtain sensitive information such as usernames or single-sign-on tokens encoded in redirect URLs, but the victim must copy and paste the image link into the attacker's page.

What the attacker needed

Victim copies image link; victim pastes link into attacker page; attacker controls redirect chain

How it was found

  1. Set the image src to a URL that redirects to a sensitive URL.
  2. The sensitive URL redirects to a final URL.
  3. Apply a CSP img-src directive that allows the first and sensitive URLs but blocks the final URL.
  4. The victim right-clicks the image and selects 'Copy Image Link'.
  5. The copied link is the sensitive intermediate URL.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you right-click an image and choose 'Copy Image Link', the browser copies the final web address after any redirects. If a redirect chain includes a secret token in an intermediate address, that secret can be copied. An attacker can use a security policy to stop the redirect at the secret step, so the copied link contains the secret.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by Ademar Nowasky Junior

View all

3 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.