Skip to content

Bypass using object with no contentWindow #96

Closed

Description

@mmndaniel
var obj = document.createElement('object');
Object.defineProperty(obj, 'contentWindow', { value: null });
document.body.appendChild(obj);
obj.data = '/';
obj.contentDocument.defaultView.alert(1);

Basically workaround chromium_bug_workaround.js :) should be easy to fix using this

Activity

  1. mmndaniel commented on Jun 15, 2023

    @mmndaniel
    ContributorAuthor

    turns out it even works without Object.defineProperty(obj, 'contentWindow', { value: null }); (which make sense, there's no contentWindow before the obj.data = '/';)!

  2. weizman commented on Jun 15, 2023

    @weizman
    Member

    yea this doesn't seem to be a chromium_bug_workaround.js problem even, there's just something off with reloading an already attached object to the same origin.. not sure why...

  3. weizman commented on Jun 15, 2023

    @weizman
    Member

    I'd expect the load listener to fire but with object it doesn't for some reason

  4. mmndaniel commented on Jun 15, 2023

    @mmndaniel
    ContributorAuthor

    Seems like this is the same root cause?

    var d = document.createElement('div');
    document.body.appendChild(d);
    d.innerHTML = `<embed id="tst"></embed>`;
    setTimeout(()=>{ tst.src='about:blank'; setTimeout(()=>frames[0].alert(1), 100);},100);
    
  5. weizman commented on Jun 18, 2023

    @weizman
    Member
  6. weizman commented on Jun 18, 2023

    @weizman
    Member

    researching #96 (comment) more i learned something sad about objects.
    They behave different then iframes, changing their data prop resets the window to an about:blank window synchronously. if the prop was reseted to a "legit" url, the listener will fire afterwards, but that doesn't change the fact that this object resets synchronously to an about:blank window every time data prop is being set and its load event does not fire..
    can't think of a solution other than hooking into attributes setting which is something i really don't want to get into...

  7. mmndaniel commented on Jun 19, 2023

    @mmndaniel
    ContributorAuthor

    Well, one (risky, non-performant, buggy) hack I can think of is to use mutation events, but that's really not a good idea (they are deprecated for good reasons).

  8. weizman commented on Jun 19, 2023

    @weizman
    Member

    Are they synchronous? Because if not they are no help unfortunately

  9. mmndaniel commented on Jun 20, 2023

    @mmndaniel
    ContributorAuthor

    yes they are, they are really terrible

  10. weizman commented on Jun 20, 2023

    @weizman
    Member

    yea I'm starting to recall these... I'd like to avoid that if possible :(

  11. added
    vulnerability
    on Jun 22, 2023
  12. weizman commented on Jul 17, 2023

    @weizman
    Member

    not scared of objects/embeds anymore thanks to #118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vulnerability

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions