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][acl] ACL is skipped for accessing any properties of an object destructured into function arguments #331

Closed
t2ym opened this issue Feb 6, 2020 · 1 comment

Comments

@t2ym
Copy link
Owner

t2ym commented Feb 6, 2020

ACL is skipped for accessing any properties of an object destructured into function arguments

Root Cause

  • Destructured object property access in function arguments are not checked for ACL

Reproducible Code

function f({ caches: c }) { return c; } f(window);
/* variants
  function expression
  async function
  generator function
  arrow function
  async arrow function
  class constructor
  class static method
  class method
  object shorthand method
  etc.
*/

Fix

  • Check "*"(S_ALL) property access of each function argument object if it is destructured into object properties or array elements
  • Examples
  // original (function declaration)
  function f({caches: c}) { return c; }
  // hooked
  function f({caches: c}) {
    for (let arg of arguments)
      __hook__('#*', arg, [], _c_[0]);
    return __hook__(({caches: c}) => {
      return c;
    }, null, arguments, _c_[0]);
  }

  // original (arrow function)
  ({caches: c}) => c;
  // hooked
  (...args) => __hook__(({caches: c}) => c, null,
    args.map(arg => __hook__('#*', arg, [], _c_[0])), _c_[0]);

Notes

  • The ACL is always checked against all properties access "*" even when only specific properties are accessed in destructuring
@t2ym
Copy link
Owner Author

t2ym commented Feb 6, 2020

#328 was misused in the commit descriptions for this issue #331

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant