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

CVE-2016-7047: API leaks any MiqReportResult #15472

Merged
merged 12 commits into from
Jun 30, 2017

Conversation

isimluk
Copy link
Member

@isimluk isimluk commented Jun 29, 2017

A flaw was found in the CloudForms API. A user with permissions to use the MiqReportResults capability within the API could potentially view data from other tenants or groups to which they should not have access.

Further, the attacker was able to schedule MiqReport run, thus they are in control (to extent) of what leaks.

https://access.redhat.com/security/cve/CVE-2016-7047

@miq-bot
Copy link
Member

miq-bot commented Jun 29, 2017

Some comments on commits isimluk/manageiq@80eff5a~...36e042b

spec/requests/api/reports_spec.rb

  • ⚠️ - 67 - Detected allow_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.
  • ⚠️ - 98 - Detected allow_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.

@miq-bot
Copy link
Member

miq-bot commented Jun 29, 2017

Checked commits isimluk/manageiq@80eff5a~...36e042b with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
8 files checked, 0 offenses detected
Everything looks fine. 🍪

@martinpovolny
Copy link
Member

@abellotti: this looks good to me, but there are also API changes. Please, merge if it looks ok to you.

@isimluk
Copy link
Member Author

isimluk commented Jun 29, 2017

It's better merge as it is.

We have this backported to 5.7.z already. If we are going to make changes to this, they should go to separate pr, so they don't get lost.

@isimluk isimluk changed the title CVE-2016-7047 cfme: API leaks any MiqReportResult; CVE-2016-7047: API leaks any MiqReportResult Jun 29, 2017
@chessbyte chessbyte assigned gtanzillo and unassigned martinpovolny Jun 29, 2017
@Fryguy
Copy link
Member

Fryguy commented Jun 30, 2017

Merging as this has already been pushed to euwe.

@Fryguy Fryguy merged commit a13b67b into ManageIQ:master Jun 30, 2017
@Fryguy Fryguy added this to the Sprint 64 Ending Jul 3, 2017 milestone Jun 30, 2017
@Fryguy
Copy link
Member

Fryguy commented Jun 30, 2017

euwe commit is 6c833cc

cc @imtayadeway

simaishi pushed a commit that referenced this pull request Jun 30, 2017
@simaishi
Copy link
Contributor

Fine backport details:

$ git log -1
commit 4db12743ddefaec40b4597cf88a034faf55e6e87
Author: Jason Frey <fryguy9@gmail.com>
Date:   Fri Jun 30 11:41:48 2017 -0400

    Merge pull request #15472 from isimluk/CVE-2016-7047-final
    
    CVE-2016-7047: API leaks any MiqReportResult
    (cherry picked from commit a13b67bb6d508c1118bf65661cb4d41d14470725)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1450493

gtanzillo added a commit to gtanzillo/manageiq that referenced this pull request Dec 21, 2017
This change expands the existing scope of the current user's group to the current user's tenant
allowing visibility to all reports created by users within the tenant.

The scope was changed in ManageIQ#15472 but was too restrictive

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1526058
gtanzillo added a commit to gtanzillo/manageiq that referenced this pull request Jan 2, 2018
This change expands the existing scope of the current user's group to the current user's tenant
allowing visibility to all reports created by users within the tenant.

The scope was changed in ManageIQ#15472 but was too restrictive

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1526058
gtanzillo added a commit to gtanzillo/manageiq that referenced this pull request Jan 4, 2018
This change expands the existing scope of the current user's group to the current user's tenant
allowing visibility to all reports created by users within the tenant.

The scope was changed in ManageIQ#15472 but was too restrictive

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1526058
gtanzillo added a commit to gtanzillo/manageiq that referenced this pull request Jan 4, 2018
This change expands the existing scope of the current user's group to the current user's tenant
allowing visibility to all reports created by users within the tenant.

The scope was changed in ManageIQ#15472 but was too restrictive

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1526058
gtanzillo added a commit to gtanzillo/manageiq that referenced this pull request Jan 4, 2018
This change expands the existing scope of the current user's group to the current user's tenant
allowing visibility to all reports created by users within the tenant.

The scope was changed in ManageIQ#15472 but was too restrictive

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1526058
gtanzillo added a commit to gtanzillo/manageiq that referenced this pull request Jan 4, 2018
This change expands the existing scope of the current user's group to the current user's tenant
allowing visibility to all reports created by users within the tenant.

The scope was changed in ManageIQ#15472 but was too restrictive

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1526058
NickLaMuro added a commit to NickLaMuro/manageiq-api that referenced this pull request Dec 5, 2018
The fix here simply matches up the `if` checks used in:

- `Api::ReportsController#reports_search_conditions`
- `MiqReport.for_user`

to both use `User#report_admin_user?`

* * *

Further background info:

This bug is the result of a collision between the following two PRs:

- ManageIQ/manageiq#15472
- ManageIQ/manageiq#17444

The first PR, ManageIQ/manageiq#15472, introduces:

`Api::ReportsController#reports_search_conditions`

Which uses `unless User.current_user.admin?` to check if it should use
the `where_clause` from the `MiqReport.for_user` for the search
conditions (passed into a `ActiveRecord` `.where` farther up the stack).
The idea for this initial check is building this where clause only makes
sense if it isn't an `all`, otherwise where it is used will cause an
error in Postgres syntax because of `... WHERE ()` being passed

This, however, doesn't match the `user.admin_user?`(at the time of
ManageIQ/manageiq#15472) check that is done in `.for_user` method,
which means it would be called for users that don't match the `admin`
username, but still are part of either of the following roles

- `"EvmRole-super_administrator"`
- `"EvmRole-administrator"`

The bug in question:

https://bugzilla.redhat.com/show_bug.cgi?id=1650531

tested this with a custom role, which doesn't match either of those two
roles, so the `User#admin?` check and `User#admin_user?` check happened
to be equivalent in `5.9` (see comment ManageIQ#4 in BZ link), but not `5.10`.
But, if the replication steps had instead said to:

- Create a user, "User1", that is part of the "EvmGroup-administrator"
  group

This would have also failed in the same way on `5.9` as it does on
`5.10` currently.

This fails on 5.10, though, because in ManageIQ/manageiq#17444, the
`admin_user?` method changes to `report_admin_user?`, and it's
functionality also now checks if the role is valid for querying the
group role's product features the user has access to, and it only has an
eject for the role that happens to be `admin?`.  Meaning that the
`admin` "super user" still has no problem with this query, but any other
user that could still count as a `report_admin_user?` would (both users
in the `EvmGroup-administrator` role and just having the proper features
enabled)
NickLaMuro added a commit to NickLaMuro/manageiq-api that referenced this pull request Dec 5, 2018
The fix here simply matches up the `if` checks used in:

- `Api::ReportsController#reports_search_conditions`
- `MiqReport.for_user`

to both use `User#report_admin_user?`

* * *

Further background info:

This bug is the result of a collision between the following two PRs:

- ManageIQ/manageiq#15472
- ManageIQ/manageiq#17444

The first PR, ManageIQ/manageiq#15472, introduces:

`Api::ReportsController#reports_search_conditions`

Which uses `unless User.current_user.admin?` to check if it should use
the `where_clause` from the `MiqReport.for_user` for the search
conditions (passed into a `ActiveRecord` `.where` farther up the stack).
The idea for this initial check is building this where clause only makes
sense if it isn't an `all`, otherwise where it is used will cause an
error in Postgres syntax because of `... WHERE ()` being passed

This, however, doesn't match the `user.admin_user?`(at the time of
ManageIQ/manageiq#15472) check that is done in `.for_user` method,
which means it would be called for users that don't match the `admin`
username, but still are part of either of the following roles

- `"EvmRole-super_administrator"`
- `"EvmRole-administrator"`

The bug in question:

https://bugzilla.redhat.com/show_bug.cgi?id=1650531

tested this with a custom role, which doesn't match either of those two
roles, so the `User#admin?` check and `User#admin_user?` check happened
to be equivalent in `5.9` (see comment ManageIQ#4 in BZ link), but not `5.10`.
But, if the replication steps had instead said to:

- Create a user, "User1", that is part of the "EvmGroup-administrator"
  group

This would have also failed in the same way on `5.9` as it does on
`5.10` currently.

This fails on 5.10, though, because in ManageIQ/manageiq#17444, the
`admin_user?` method changes to `report_admin_user?`, and it's
functionality also now checks if the role is valid for querying the
group role's product features the user has access to, and it only has an
eject for the role that happens to be `admin?`.  Meaning that the
`admin` "super user" still has no problem with this query, but any other
user that could still count as a `report_admin_user?` would (both users
in the `EvmGroup-administrator` role and just having the proper features
enabled)

Fixes:  https://bugzilla.redhat.com/show_bug.cgi?id=1650531
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants