Skip to content

Inclusion filter present security issue #386

Closed

Description

@offlinehacker

So let's say i have following relation user <-groupMembers-> group, now if i allow group owner to query users, he can also include all user tokens, and login as user, nice.

Activity

  1. raymondfeng commented on Jul 20, 2014

    @raymondfeng
    Member

    Hmm, this is serious. I think the ACL will have to check the permissions for the included relations.

  2. fabien commented on Aug 23, 2014

    @fabien
    Contributor

    @raymondfeng I believe this has been fixed, no?

  3. grosem commented on Mar 21, 2015

    @grosem

    @fabien & @raymondfeng

    I just tested it with the latest version and it is still possible. For example like this (manager is extending the User model):

    http://localhost:3000/api/events?filter={"where":{"nr":1},"include":{"relation":"manager","scope":{"include":[{"relation":"accessTokens"}]}}}

    https://groups.google.com/forum/#!topic/loopbackjs/8XmsoaHpNP4 seems to be the same problem.

  4. fabien commented on Mar 31, 2015

    @fabien
    Contributor
  5. bajtos commented on Apr 1, 2015

    @bajtos
    Member

    @raymondfeng mentioned in the mailing list that one can disable includes in model/relation settings using the option disableInclude: true. Does that fix the problem?

    Is it enough to change configuration of the built-in relation "User hasMany accessTokens" to prevent inclusion? Or is that just a workaround and we need to implement @raymondfeng proposal "the ACL will have to check the permissions for the included relations"?

  6. grosem commented on Apr 1, 2015

    @grosem

    From my point of view this should definitely covered by ACL.

  7. raymondfeng commented on Apr 14, 2015

    @raymondfeng
    Member

    @bajtos User.hasMany accessTokens probably should have disableInclude set to true by default.

  8. bajtos commented on Apr 30, 2015

    @bajtos
    Member

    Closing the issue as fixed by #1318.

  9. erikverheij commented on Aug 13, 2015

    @erikverheij

    The ability to access related objects via include is a large security hole. Essentially it makes the whole ACL useless as long as users can use the include filter.

    I suggest to add a big warning on the include documentation page. In fact I think filter.include should be disabled by default until ACL deals with it.

  10. fabien commented on Aug 13, 2015

    @fabien
    Contributor

    @erikverheij agreed, this should be handled with caution.

    @raymondfeng @bajtos what do you think?

    A workaround for now (from the top of my head) would be:

    Model.observe('access', function(ctx, next) {
      ctx.query.include = {}; // clear
      next();
    });
    
  11. Shyri commented on Sep 24, 2015

    @Shyri

    I totally agree with @erikverheij . Include feature is a nice way to avoid multiple requests from the frontend but it is a must to be handled by ACL in order to have decent security. At the moment the only solution I can see is to use "disableInclude" for all models that needs to be blocked to at least one role (other than $everyone or $unauthorized) and access them with specific requests only allowed for specific roles

  12. ben-girardet commented on Dec 19, 2015

    @ben-girardet

    Any chance that the ACL would handle this security issue in the future ?

  13. dmisdm commented on Mar 1, 2016

    @dmisdm

    Has this issue essentially moved to #1362 ??

  14. sebastianfelipe commented on Jan 19, 2018

    @sebastianfelipe

    Can this "disableInclude" feature affect the client calls only and not the back-end side? Thanks.

  15. bajtos commented on Jan 22, 2018

    @bajtos
    Member

    Can this "disableInclude" feature affect the client calls only and not the back-end side? Thanks.

    @sebastianfelipe I believe this flag affects all calls, including JavaScript API. If you suspect it's not working that way, then please open a new issue and provide us with a small app reproducing the problem - see http://loopback.io/doc/en/contrib/Reporting-issues.html#bug-report

  16. sebastianfelipe commented on Jan 22, 2018

    @sebastianfelipe

    I think it works it that way pretty well. But, I think it shouldn't be as well. It should block the include calls from the client calls, but not from the internal use. It could facilitates some operations a lot!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions