Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bypass 002: Function("return this")() d'oh! #11

Closed
natevw opened this issue Jul 18, 2013 · 1 comment
Closed

Bypass 002: Function("return this")() d'oh! #11

natevw opened this issue Jul 18, 2013 · 1 comment
Labels

Comments

@natevw
Copy link
Owner

natevw commented Jul 18, 2013

Welp, this one is too easy:
http://natevw.github.io/evel/challenge.html#Function(%22return%20this%22)()

Credit: https://twitter.com/wisecwisec/status/357861675782770689

Need to dive into the spec and figure out why Function breaks out of strict mode while eval doesn't — this could be intentional and if so we're ± hosed? We could pass in evel.Function as Function, but I suspect it's trivial to get the original back via primitives and any other exposed methods.

@natevw
Copy link
Owner Author

natevw commented Jul 18, 2013

After a bit more convo with Stefano, it's not looking good to me, e.g. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function#Description says:

Note: Functions created with the Function constructor do not create closures to their creation contexts; they always run in the window context (unless the function body starts with a "use strict"; statement, in which case the context is undefined).

So not only is the window context leaked, but even if this could be avoided all the globals we've masked via closure would become available again.

Not quite ready to wave the white flag, but I suspect this is gonna be a losing battle.

kumavis added a commit to kumavis/evel that referenced this issue Nov 24, 2013
kumavis added a commit to kumavis/evel that referenced this issue Nov 24, 2013
@natevw natevw closed this as completed in 25f1a43 Nov 24, 2013
natevw added a commit that referenced this issue Nov 24, 2013
Plug security holes - Fixes #10 Fixes #11 Fixes #14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant