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

[vulnerability] Incorrect global object contexts are applied in self-assignment expressions #265

Closed
t2ym opened this issue May 10, 2018 · 0 comments

Comments

@t2ym
Copy link
Owner

t2ym commented May 10, 2018

[vulnerability] Incorrect global object contexts are applied in self-assignment expressions

Root Cause

  • context property of getter/setter functions of the wrapper property of $hook$.global().wrapperProperty is set before the assignment but modified to that for the RHS value during evaluation of the RHS, and then its ACL is applied on the assignment to the LHS property with the RHS context while the LHS context is expected.

Reproducible Code Example

/* /path.js */
var _global_A = 1;
({
  // /path.js,inaccessible should be applied 
  // but /path.js,inaccessible,accessible is actually applied
  inaccessible: _global_A = { 
    accessible: _global_A // RHS: /path.js,inaccessible,accessible
  }.accessible
});

Fix

  • Modify the $hook$.global() to assure the correct contexts are always applied
    • context is included in the wrapper property name
  • Before the fix
$hook$.global(__hook__, 'context', 'name', 'var')._p_name
  • After the fix
$hook$.global(__hook__, 'context', 'name', 'var')['_p_name;context']
t2ym added a commit that referenced this issue May 10, 2018
@t2ym t2ym closed this as completed in 168b44a May 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant