Skip to content
Access control Advisory Intermediate CVE-2024-1674

Inappropriate implementation in Navigation (CVE-2024-1674)

A same-origin download could be redirected to privileged URLs such as the new tab page, view-source: pages, or chrome-native:// pages, causing them to load when they normally should not. An attacker could use this to load restricted pages, potentially leading to further exploitation.

David Erceg Follow

Originally disclosed on Chrome VRP

Bounty$1,000 Medium View original
  • Fix shipped in 4.7 years

VULNERABILITY DETAILS
Typically, it's not possible to open the new tab page, view-source: pages or chrome-native:// pages. However, by redirecting a same-origin download to one of these locations, it is possible to load each of these types of pages.

This issue was found as part of https://bugs.chromium.org/p/chromium/issues/detail?id=966914.

VERSION
Chrome Version: Tested on 74.0.3729.169 (stable) and 76.0.3804.1 (canary)
Operating System: Windows 10 Pro, version 1809

REPRODUCTION CASE

  1. The attached files form a simple website. To begin with, download each of the files and place them in a directory.
  2. In the directory you downloaded the files to, run the following command in a terminal:

python3 server.py 8080

This will start a simple web server that can be used to serve the files in the directory. server.py is necessary here, as it redirects requests received for download.txt:

if self.path.startswith('/download.txt'):
self.send_response(302)

location = parse_qs(urlparse(self.path).query).get('location', None)  
self.send_header('Location', location[0])  

self.end_headers()  

This is important in step 4.2 below, where a download for this file will be initiated.

  1. In the browser, navigate to the following location:

http://localhost:8080/index.html

  1. This page includes a number of sample links as well as an input form. You can either select one of the sample links or enter a URL in the form (allowing you to easily test whether a particular URL will load). Once you do enter or select a URL, the page will attempt to redirect to that URL. This is done as follows:

4.1. The page includes a link with the "download" attribute set.
4.2. When you select a URL, it's appended onto the link location as a query parameter. The link is then clicked with JavaScript.
4.3. server.py then redirects the request for this link to the URL you selected. This should fail for things like view-source: URLs; instead, the pages will be loaded. You can use the sample links to test this behavior.

It is possible to load some other types of pages as well:

  1. chrome-search:// pages in an iframe

While view-source pages and chrome-native:// pages won't load in an iframe, some chrome-search:// pages will. Note that the new tab page itself won't load, because it has "X-Frame-Options" set to "DENY".

To test this, open the following page:

http://localhost:8080/iframe_parent.html

This page simply includes index.html in an iframe. If you click the chrome-search://most-visited/edit.html link, you should find that the link loads, unlike the other links on the page.

  1. file:/// pages

As noted in https://bugs.chromium.org/p/chromium/issues/detail?id=966914, it is also possible to load file:/// pages using view-source: pages. Although not demonstrated here, this would work as follows:

If you attempt to load view-source:file:///C:/non-existent.html, the request will be rewritten to file:///C:/non-existent.html. If you can create this file (possible for files in the download directory), all you have to do is navigate the tab containing this page to another site, then navigate back.

The file, which now exists, will be loaded and if it's a HTML file you created, you can have it navigate to another file:/// location. I don't think it's very useful, though, as you have no way of retrieving the file data. You can really only use this to navigate to file:/// locations.

  1. Chrome debug URLs

You can also indirectly load some Chrome debug URLs using view-source. For example, loading view-source:chrome://crashdump/ will create a crash dump, even though the view-source page apparently never loads.

  1. data: URLs

You can load a data: URL in a top frame by first opening the new tab page then navigating it. You can test this by going through the following instructions:

4.1. Open a tab (to any page) and run the following command in the devtools console:

var newWindow = open("http://localhost:8080/index.html");

4.2. Switch to the new window and click the chrome-search://local-ntp/local-ntp.html link.

4.3. Switch back to the original tab and run the following in the devtools console:

newWindow.location.href = "data:text/html,<p>Test</p>";

This will load a data: URL within the new window.

CREDIT INFORMATION
Reporter credit: David Erceg

The original report as published on the Chromium issue tracker, by David Erceg. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

Chrome normally refuses to open certain privileged pages directly: the new tab page, view-source: pages and chrome-native:// pages are not reachable by ordinary navigation. The issue was classified as an inappropriate implementation in Navigation. This report, filed through the Chrome VRP and credited to David Erceg, shows that a same-origin download can be redirected to one of those locations and cause the page to load anyway. The issue was tracked as CVE-2024-1674, classified as an inappropriate implementation in Navigation, rated medium severity, and a bounty of 1000.00 USD was awarded. It was disclosed on 2024-02-20.

The researcher notes that the issue was found as part of Chromium issue 966914.

Setup

The testing was done on Chrome 74.0.3729.169 (stable) and 76.0.3804.1 (canary), on Windows 10 Pro version 1809.

The reproduction uses a small local website made of attached files. Download the files and place them in a directory, then start the bundled server from that directory:

Bash
python3 server.py 8080

This serves the files in the directory over HTTP on port 8080. The server matters because it redirects requests for download.txt. The relevant part of server.py is:

Python
if self.path.startswith('/download.txt'):
    self.send_response(302)

    location = parse_qs(urlparse(self.path).query).get('location', None)
    self.send_header('Location', location[0])

    self.end_headers()

Any request whose path starts with /download.txt gets a 302 response, and the Location header is taken from the location query parameter of the request. That gives the test page a way to make the browser follow a redirect to an arbitrary URL while the request is being treated as a download.

Finding it

The observation is that a same-origin download can be redirected to a privileged location, and the browser then loads that location instead of failing. The page under test does this by combining a link with the download attribute and a server-side redirect: the link points at download.txt with the target URL appended as a query parameter, JavaScript clicks the link, and the server answers with a 302 to the chosen URL. A normal navigation to something like a view-source: URL should fail; here the pages load.

Exploitation

Step 1: serve the test site

Place the attached files in a directory and run the server as shown above. The server's redirect behaviour for /download.txt is the mechanism the whole test relies on.

Step 2: open the test page

Navigate the browser to:

HTTP
http://localhost:8080/index.html

The page contains a number of sample links and an input form. You can pick a sample link or type a URL into the form, which makes it easy to check whether a particular URL will load. Once a URL is entered or selected, the page attempts to redirect to it.

Step 3: trigger the download redirect

  1. The page includes a link with the download attribute set.
  2. When you select a URL, it is appended to the link location as a query parameter, and the link is clicked with JavaScript.
  3. server.py redirects the request for that link to the URL you selected.

For things like view-source: URLs this should fail, but instead the pages load. The sample links let you test the behaviour directly.

Step 4: load other page types

The same primitive reaches more than the three page types above.

chrome-search:// pages in an iframe

view-source: pages and chrome-native:// pages will not load in an iframe, but some chrome-search:// pages will. The new tab page itself will not load in a frame because it has X-Frame-Options set to DENY.

To test this, open:

HTTP
http://localhost:8080/iframe_parent.html

That page simply includes index.html in an iframe. Clicking the chrome-search://most-visited/edit.html link loads it, unlike the other links on the page.

file:/// pages

As noted in Chromium issue 966914, file:/// pages can also be loaded using view-source: pages. This is not demonstrated in the reproduction, but it would work as follows. If you attempt to load view-source:file:///C:/non-existent.html, the request is rewritten to file:///C:/non-existent.html. If you can create that file (possible for files in the download directory), you then navigate the tab containing this page to another site and navigate back. The file, which now exists, is loaded, and if it is an HTML file you created, you can have it navigate to another file:/// location. The researcher considers this not very useful, because there is no way to retrieve the file data; it can really only be used to navigate to file:/// locations.

Chrome debug URLs

Some Chrome debug URLs can be loaded indirectly using view-source. For example, loading view-source:chrome://crashdump/ creates a crash dump, even though the view-source page apparently never loads.

data: URLs

A data: URL can be loaded in a top frame by first opening the new tab page and then navigating it. To test this:

  1. Open a tab to any page and run the following in the DevTools console:
JavaScript
var newWindow = open("http://localhost:8080/index.html");
  1. Switch to the new window and click the chrome-search://local-ntp/local-ntp.html link.
  2. Switch back to the original tab and run the following in the DevTools console:
JavaScript
newWindow.location.href = "data:text/html,<p>Test</p>";

This loads a data: URL within the new window.

Root cause

The report describes the behaviour rather than the code behind it. What it establishes is that a redirect from a same-origin download to a privileged scheme results in the page being loaded. The report notes that these pages normally cannot be opened directly, and that the new tab page has X-Frame-Options set to DENY. The exact component at fault is not identified in the report; the classification is an inappropriate implementation in Navigation.

Impact

The primitive lets a page load the new tab page, view-source: pages and chrome-native:// pages, plus some chrome-search:// pages in an iframe, some Chrome debug URLs (for example creating a crash dump via view-source:chrome://crashdump/), and data: URLs in a top frame. The file:/// case is limited: the researcher states there is no way to retrieve the file data, so it can only be used to navigate to file:/// locations. The report does not describe an attack against a remote victim beyond these loading behaviours.

Fix

The report does not state what change was made.

Variants to test

  • Redirect a same-origin download to a view-source: URL and see whether the page loads instead of failing. A positive result is the source view appearing where a direct navigation would be blocked.
  • Redirect a same-origin download to a chrome-native:// URL. A positive result is the native page rendering.
  • Frame the test page and click a chrome-search:// link such as chrome-search://most-visited/edit.html. A positive result is that page loading inside the iframe while other links do not.
  • Load view-source:chrome://crashdump/ through the redirect. A positive result is a crash dump being created even though the view-source page never appears.
  • Open the new tab page, then navigate the window to a data: URL. A positive result is the data: URL loading in the top frame.
  • Attempt the view-source:file:/// rewrite against a path you can create, then navigate away and back. A positive result is the created file being loaded.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 13 min read.

What happened, in plain words

Your browser has a set of pages it treats as special. The new tab page, the page that shows the source code of a website (view-source:), and Chrome's own internal pages (chrome-native://) are all things you normally cannot reach just by typing an address or clicking a link. The browser deliberately blocks those routes, because those pages are more powerful than ordinary websites and letting a random site open them could be dangerous.

This report shows that one of those blocks can be walked around. If a same-origin download is redirected to one of those special addresses, Chrome follows the redirect and loads the special page anyway. The issue was classified as an inappropriate implementation in Navigation. The issue was tracked as CVE-2024-1674, classified as an inappropriate implementation in Navigation, rated medium severity, and a bounty of 1000.00 USD was paid. It was disclosed on 2024-02-20, and the reporter credited is David Erceg.

The researcher also notes that the issue was found as part of Chromium issue 966914.

A few words before we start, because the rest of the article leans on them:

  • A download is when the browser fetches a file and saves it rather than displaying it. A link can ask for this with the download attribute.
  • A redirect is a server telling the browser "not here, go to this other address instead". It does that with a status code (302 means "found elsewhere") and a Location header holding the new address.
  • Same-origin means the page and the thing it talks to share the same scheme, host and port, so the browser considers them part of the same site and trusts them to interact.
  • A query parameter is the part of a URL after a ?, made of name and value pairs, like ?location=something. Servers read these to decide what to do.

Setup

The testing was done on Chrome 74.0.3729.169 (stable) and 76.0.3804.1 (canary), on Windows 10 Pro version 1809. The stable channel is the normal release everyone gets; canary is an early, experimental build used to test upcoming changes.

The reproduction uses a small local website made of attached files. Download the files and place them in a directory, then start the bundled server from that directory:

Bash
python3 server.py 8080

Line by line:

  • python3 runs the Python 3 interpreter, a program for running scripts written in the Python language.
  • server.py is the script that was included with the test files. It acts as a tiny web server.
  • 8080 is the port number. A port is like a numbered door on your computer that network traffic can arrive at; 8080 is a common choice for local testing because it does not need special permissions.

So this command starts a small web server on your own machine that hands out the files in that directory over HTTP, the normal language of the web. The server matters because it does something special: it redirects requests for download.txt. The relevant part of server.py is:

Python
if self.path.startswith('/download.txt'):
    self.send_response(302)

    location = parse_qs(urlparse(self.path).query).get('location', None)
    self.send_header('Location', location[0])

    self.end_headers()

Line by line:

  • if self.path.startswith('/download.txt'): checks whether the address the browser asked for begins with /download.txt. If it does, the lines below run.
  • self.send_response(302) sends back the HTTP status code 302, which means "this resource is somewhere else, go there".
  • location = parse_qs(urlparse(self.path).query).get('location', None) takes the query string of the request (everything after the ?), splits it into name and value pairs, and pulls out the value named location. If there is no such value, it gets None.
  • self.send_header('Location', location[0]) adds a Location header to the response, containing that value. This is the address the browser is told to go to.
  • self.end_headers() finishes the response headers so the browser can act on them.

In plain terms: any request whose path starts with /download.txt gets a 302 response, and the Location header is taken from the location query parameter of the request. That gives the test page a way to make the browser follow a redirect to an arbitrary URL while the request is being treated as a download.

Finding it

The observation is that a download started from a same-origin page can be redirected to a privileged location, and the browser then loads that location instead of failing. The page under test does this by combining a link with the download attribute and a server-side redirect: the link points at download.txt with the target URL appended as a query parameter, JavaScript clicks the link, and the server answers with a 302 to the chosen URL. A normal navigation to something like a view-source: URL should fail; here the pages load.

Why does this matter? Think of the browser as a building with public rooms and locked staff rooms. Normally, walking up to a locked door and trying the handle gets you nowhere. This bug is like finding that if you arrive through the deliveries entrance (the download route), the door to the staff room is left unlocked. The lock exists, but it is not checked on that particular path.

Exploitation

Step 1: serve the test site

Place the attached files in a directory and run the server as shown above. The server's redirect behaviour for /download.txt is the mechanism the whole test relies on. Without it, the browser would just fetch a file and save it; with it, the browser is told to go somewhere else mid-request, and that is where the check is missed.

Step 2: open the test page

Navigate the browser to:

HTTP
http://localhost:8080/index.html

Line by line:

  • http:// is the scheme, telling the browser to speak the ordinary web protocol.
  • localhost means "this computer", so the browser talks to the server you just started rather than a machine on the internet.
  • :8080 is the port, matching the number you gave the server.
  • /index.html is the file being requested, the test page itself.

The page contains a number of sample links and an input form. You can pick a sample link or type a URL into the form, which makes it easy to check whether a particular URL will load. Once a URL is entered or selected, the page attempts to redirect to it. The form is there so you can try any address you like without editing files.

Step 3: trigger the download redirect

  1. The page includes a link with the download attribute set. That attribute tells the browser "treat this as a file to save", which is what puts the request on the download path.
  2. When you select a URL, it is appended to the link location as a query parameter, and the link is clicked with JavaScript. JavaScript is the programming language that runs inside web pages; here it is used to click the link for you, so the whole thing happens without a manual click.
  3. server.py redirects the request for that link to the URL you selected. The browser follows the redirect and the page loads.

For things like view-source: URLs this should fail, but instead the pages load. The sample links let you test the behaviour directly.

Step 4: load other page types

The same trick reaches more than the three page types above. Each of the following is a variation on the same theme: start a download, redirect it somewhere privileged, and watch what loads.

chrome-search:// pages in an iframe

An iframe is a frame inside a page that can display another page, like a small window embedded in a larger one. view-source: pages and chrome-native:// pages will not load in an iframe, but some chrome-search:// pages will. The new tab page itself will not load in a frame because it has X-Frame-Options set to DENY. X-Frame-Options is a response header a site can send to say "do not put me inside a frame"; DENY means never.

To test this, open:

HTTP
http://localhost:8080/iframe_parent.html

Line by line:

  • http://localhost:8080 is the same local server as before.
  • /iframe_parent.html is a page whose only job is to contain an iframe.

That page simply includes index.html in an iframe. Clicking the chrome-search://most-visited/edit.html link loads it, unlike the other links on the page. In other words, the frame restriction stops some privileged pages but not this one.

file:/// pages

A file:/// URL points at a file on your own disk rather than a website. As noted in Chromium issue 966914, file:/// pages can also be loaded using view-source: pages. This is not demonstrated in the reproduction, but it would work as follows. If you attempt to load view-source:file:///C:/non-existent.html, the request is rewritten to file:///C:/non-existent.html. If you can create that file (possible for files in the download directory), you then navigate the tab containing this page to another site and navigate back. The file, which now exists, is loaded, and if it is an HTML file you created, you can have it navigate to another file:/// location. The researcher considers this not very useful, because there is no way to retrieve the file data; it can really only be used to navigate to file:/// locations.

In everyday terms: you can make the browser walk to a local file, but you cannot read what is inside it and carry it back out. It is a door you can open, not a drawer you can empty.

Chrome debug URLs

Some Chrome debug URLs can be loaded indirectly using view-source. Debug URLs are internal addresses meant for developers and diagnostics. For example, loading view-source:chrome://crashdump/ creates a crash dump, even though the view-source page apparently never loads. A crash dump is a file Chrome writes when something goes wrong, containing information about the state of the browser at that moment.

data: URLs

A data: URL carries its content inside the address itself, rather than pointing at a server. A data: URL can be loaded in a top frame by first opening the new tab page and then navigating it. The top frame is the main window of the tab, as opposed to a frame inside it. To test this:

  1. Open a tab to any page and run the following in the DevTools console:
JavaScript
var newWindow = open("http://localhost:8080/index.html");

Line by line:

  • var newWindow = creates a variable, a named box for holding a value.
  • open(...) asks the browser to open a new window or tab at the address given.
  • "http://localhost:8080/index.html" is the test page on your local server.
  • The result is stored in newWindow, so later commands can refer to that window.

DevTools is the set of developer tools built into Chrome, opened with a keyboard shortcut; the console is the part where you can type JavaScript and run it immediately.

  1. Switch to the new window and click the chrome-search://local-ntp/local-ntp.html link. This puts the new window on a privileged page.

  2. Switch back to the original tab and run the following in the DevTools console:

JavaScript
newWindow.location.href = "data:text/html,<p>Test</p>";

Line by line:

  • newWindow is the window you opened in step 1.
  • .location.href is the address that window is currently showing. Assigning to it tells the browser to navigate there.
  • "data:text/html,<p>Test</p>" is a data: URL. text/html says the content is HTML, and everything after the comma is the content itself: a paragraph containing the word Test.

This loads a data: URL within the new window.

Root cause

The report describes the behaviour rather than the code behind it. What it establishes is that a redirect from a same-origin download to a privileged scheme results in the page being loaded. The report notes that these pages normally cannot be opened directly, and that the new tab page has X-Frame-Options set to DENY. The exact component at fault is not identified in the report; the classification is an inappropriate implementation in Navigation.

A useful comparison: a building might have a guard at the front door checking everyone's badge, but no guard at the loading bay. The badge check is real and works; it just is not applied at every entrance. Here, the navigation checks are the guard, and the download redirect is the loading bay.

Impact

The trick lets a page load the new tab page, view-source: pages and chrome-native:// pages, plus some chrome-search:// pages in an iframe, some Chrome debug URLs (for example creating a crash dump via view-source:chrome://crashdump/), and data: URLs in a top frame. The file:/// case is limited: the researcher states there is no way to retrieve the file data, so it can only be used to navigate to file:/// locations. The report does not describe an attack against a remote victim beyond these loading behaviours.

In other words, the main consequence is that pages the browser meant to keep out of reach can be made to appear. Whether that can be turned into something worse is not shown here.

Fix

The report does not state what change was made. In the building comparison, the fix is to put the same badge check at the loading bay that already exists at the front door.

Variants to test

If you want to explore this yourself, these are the variations worth trying. Each one starts from the same setup: the local server running, the test page open, and the redirect through download.txt in place.

  • Redirect a same-origin download to a view-source: URL and see whether the page loads instead of failing. A positive result is the source view appearing where a direct navigation would be blocked.
  • Redirect a same-origin download to a chrome-native:// URL. A positive result is the native page rendering.
  • Frame the test page and click a chrome-search:// link such as chrome-search://most-visited/edit.html. A positive result is that page loading inside the iframe while other links do not.
  • Load view-source:chrome://crashdump/ through the redirect. A positive result is a crash dump being created even though the view-source page never appears.
  • Open the new tab page, then navigate the window to a data: URL. A positive result is the data: URL loading in the top frame.
  • Attempt the view-source:file:/// rewrite against a path you can create, then navigate away and back. A positive result is the created file being loaded.

Glossary

  • 302: an HTTP status code meaning the requested resource is temporarily at another address, given in the Location header.
  • Bounty: a payment made by a company to someone who reports a security problem to it.
  • Canary: an early, experimental build of Chrome used to test changes before they reach everyone.
  • chrome-native://: a scheme for Chrome's own internal pages, which ordinary websites are not meant to open.
  • chrome-search://: a scheme for pages tied to Chrome's search and new tab features.
  • CVE: a public identifier given to a known security vulnerability so people can refer to it unambiguously.
  • CVSS: a scoring system for rating the severity of vulnerabilities; this report has no score recorded.
  • data: URL: a URL that contains its content directly in the address instead of pointing at a server.
  • Debug URL: an internal Chrome address used for diagnostics, such as creating a crash dump.
  • DevTools: the developer tools built into Chrome, including a console where JavaScript can be typed and run.
  • download attribute: an HTML attribute on a link that tells the browser to save the target as a file rather than display it.
  • file:///: a URL scheme that points at a file on the local disk.
  • HTTP: the protocol browsers and servers use to exchange web pages and files.
  • iframe: a frame embedded inside a page that displays another page.
  • Inappropriate implementation: a weakness category meaning the software does something in a way it was not intended to, rather than a classic memory or injection bug.
  • JavaScript: the programming language that runs inside web pages.
  • localhost: the name meaning "this computer", used to reach a server running on your own machine.
  • Location header: the part of a redirect response that tells the browser where to go next.
  • Navigation: the part of the browser that decides whether a navigation is allowed and where it ends up.
  • Origin: the combination of scheme, host and port that identifies a site; same-origin means two things share all three.
  • Port: a numbered endpoint on a computer that network traffic can arrive at, such as 8080.
  • Query parameter: a name and value pair after the ? in a URL, used to pass information to a server.
  • Redirect: a server response telling the browser to go to a different address instead.
  • Scheme: the first part of a URL, such as http, file or data, which says how to interpret the rest.
  • Stable: the normal release channel of Chrome that most people use.
  • view-source:: a scheme that shows the source code of a page instead of rendering it.
  • X-Frame-Options: a response header a site can send to control whether it may be displayed inside a frame; DENY forbids it entirely.

More by David Erceg

View all

65 more disclosed reports, best first.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.