snow icon indicating copy to clipboard operation
snow copied to clipboard

Snow can by bypassed with polluting NodeList.prototype.length

Open terjanq opened this issue 2 years ago • 2 comments

PoC:

Object.defineProperty(NodeList.prototype, 'length', {value:0});
document.body.innerHTML = '<iframe name=iframe>';
iframe.alert(1337);

Vulnerable path:

  1. getFramesArray called in https://github.com/LavaMoat/snow/blob/1c8faa81291e6f6dffe62b7106eff2492213375d/src/inserters.js#L29
  2. slice() called on the results from querySelectorAll in https://github.com/LavaMoat/snow/blob/1c8faa81291e6f6dffe62b7106eff2492213375d/src/utils.js#L111-L113 produces an empty array because of the length 0.

terjanq avatar Oct 02 '23 14:10 terjanq

Thanks for contributing. The main maintainer of this project is temporary unavailable, but we'll definitely get back to this. The plan is to tighten some limitations on DOM usage that Snow already introduces and fixing the missing overrides where possible. Some of the work has started (see PR tab)

Meanwhile we're also working with W3C to propose a basic building block of Snow getting introduced into the browser so that all of the monkey-patching can be eliminated in the future. https://www.w3.org/2023/03/secure-the-web-forward/talks/realms.html

Feel free to update this issue with comments on how you think it should be addressed. We may reach out with questions later.

naugtur avatar Nov 02 '23 09:11 naugtur

Thanks for contributing. The main maintainer of this project is temporary unavailable, but we'll definitely get back to this. The plan is to tighten some limitations on DOM usage that Snow already introduces and fixing the missing overrides where possible. Some of the work has started (see PR tab)

Meanwhile we're also working with W3C to propose a basic building block of Snow getting introduced into the browser so that all of the monkey-patching can be eliminated in the future. https://www.w3.org/2023/03/secure-the-web-forward/talks/realms.html

Feel free to update this issue with comments on how you think it should be addressed. We may reach out with questions later.

naugtur avatar Nov 02 '23 09:11 naugtur