Bug 1410916

Summary: Should only be able to add repositories you have access to
Product: Red Hat Satellite Reporter: Stuart Auchterlonie <sauchter>
Component: RepositoriesAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Stephen Wadeley <swadeley>
Severity: high Docs Contact:
Priority: high    
Version: 6.2.6CC: andrew.schofield, anrussel, avroy, baitken, bbuckingham, bkearney, bmidwood, christian.klier, cmarinea, dhlavacd, ehelms, iballou, jsherril, jturel, kabbott, kdixon, rjerrido, suarora
Target Milestone: 6.8.0Keywords: PrioBumpGSS, Security, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-katello-3.16.0-0.16.rc4.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1436209 1862235 (view as bug list) Environment:
Last Closed: 2020-10-27 12:57:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1316897, 1434106, 1436209    

Description Stuart Auchterlonie 2017-01-06 20:44:23 UTC
Description of problem:

When using a user with restricted rights I can add repositories
that I should not be allowed to.

Version-Release number of selected component (if applicable):

6.2.2 - 6.2.6

How reproducible:

100%

Steps to Reproduce:
1. The role assigned to the user has the following permission set

# hammer -u admin -p redhat role filters --id=22
----|-------------------------|-----------------------------------------------------------------|------------|---------|---------------------------------------------------------------------------------
ID  | RESOURCE TYPE           | SEARCH                                                          | UNLIMITED? | ROLE    | PERMISSIONS                                                                     
----|-------------------------|-----------------------------------------------------------------|------------|---------|---------------------------------------------------------------------------------
167 | Katello::Product        | name ~ "Test_*" || name ~ "rhel7*"                              | no         | Limited | view_products, create_products, edit_products, destroy_products, sync_product...
168 | Katello::System         | host_collection ~ "Test_*_Dev" || host_collection ~ "Test_*_QA" | no         | Limited | view_content_hosts, edit_content_hosts                                          
169 | Katello::ContentView    | name ~ "Test_*" || name ~ "rhel7*"                              | no         | Limited | view_content_views, create_content_views, edit_content_views, destroy_content...
170 | Host                    | host_collection ~ "Test_*_Dev" || host_collection ~ "Test_*_QA" | no         | Limited | view_hosts, edit_hosts                                                          
171 | Katello::HostCollection | name ~ "Test_*_Dev" || name ~ "Test_*_QA"                       | no         | Limited | view_host_collections, edit_host_collections                                    
172 | JobInvocation           | none                                                            | yes        | Limited | create_job_invocations, view_job_invocations                                    
173 | Katello::KTEnvironment  | name ~ Dev || name ~ QA                                         | no         | Limited | view_lifecycle_environments, edit_lifecycle_environments, promote_or_remove_c...
174 | Katello::ActivationKey  | name ~ ak_test                                                  | no         | Limited | view_activation_keys, create_activation_keys, edit_activation_keys, destroy_a...
176 | Organization            | none                                                            | yes        | Limited | view_organizations, assign_organizations, view_subscriptions, attach_subscrip...
----|-------------------------|-----------------------------------------------------------------|------------|---------|---------------------------------------------------------------------------------

2. Identify a repo which does not meet the above filter

# hammer -u admin -p redhat repository list | grep ^4
4   | Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server x86_6... | Red Hat Software Collections for RHEL Server | yum          | https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/rhscl/1/os     

3. Verify the user cannot see it

# hammer -u limited -p redhat repository list | grep ^4
<no output> as this repository doesn't match the search filter

4. Add the repository to the content view

# hammer -u limited -p redhat content-view add-repository --repository-id=4 --name Test_A_QA --organization ACME
The repository has been associated

Actual results:

Step 4 succeeds in adding a repository that doesn't match the search filter

Expected results:

Step 4 should fail since the repository doesn't match the search filter

Additional info:

5. # hammer -u limited -p redhat repository list | grep ^4
4   | Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server x86_6... | Red Hat Software Collections for RHEL Server | yum          | https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/rhscl/1/os  

Not only has it been associated, it's now returned in the list of repositories,
again despite it not matching the search filter.

Comment 3 Brad Buckingham 2017-01-11 16:46:13 UTC
Created redmine issue http://projects.theforeman.org/issues/18035 from this bug

Comment 4 Djebran Lezzoum 2017-05-11 16:07:19 UTC
*** Bug 1429590 has been marked as a duplicate of this bug. ***

Comment 5 Satellite Program 2017-07-27 20:12:39 UTC
Upstream bug assigned to bbuckingham

Comment 6 Satellite Program 2017-07-27 20:12:42 UTC
Upstream bug assigned to bbuckingham

Comment 7 Jonathon Turel 2017-08-14 16:26:39 UTC
Thank you for reporting this issue. I've been able to reproduce it and make some determinations about what is happening.

The resource described (repository) is part of Katello. Unfortunately, it appears that all Katello resources would exhibit this behavior due to the fact that we are not completely integrated with the Foreman authentication scheme (or any other scheme would would verify the user's role 'search' filters).

Getting this working, though we've identified a feasible approach, requires a wide and significant number of changes. Due to the timing and risk I'm setting this back to NEW until we can figure out when to address the problem.

Comment 8 Jonathon Turel 2017-08-14 16:27:33 UTC
*** Bug 1467291 has been marked as a duplicate of this bug. ***

Comment 14 Karl Abbott 2018-02-13 16:04:12 UTC
I'd like to ask that we consider this for a 6.3.z release formally.

This does make our RBAC controls look rather ineffective as this exploit directly ignores them. Given that we want people to trust our RBAC controls, I think that we need to consider the perception issue here and push to get this fixed asap.

I understand that this is a LOW vulnerability due to the fact that it's unlikely to be exploited in any meaningful way, but there is definitely a perception issue that is caused by this ignorance of the Satellite RBAC model.

Cheers,
Karl

Comment 15 Brad Buckingham 2018-03-15 12:34:51 UTC
Karl,

Unfortunately, due to the extent of the changes that are going to be required to address this, 6.3.z is very unlikely.  That said, once we have a fix in place we can assess the feasibility of backporting.

Comment 18 Brad Buckingham 2018-04-06 13:01:06 UTC
*** Bug 1436209 has been marked as a duplicate of this bug. ***

Comment 20 Bryan Kearney 2018-07-18 17:49:45 UTC
*** Bug 1276769 has been marked as a duplicate of this bug. ***

Comment 26 Bryan Kearney 2020-06-16 16:05:56 UTC
Upstream bug assigned to jsherril

Comment 27 Bryan Kearney 2020-06-16 16:05:59 UTC
Upstream bug assigned to jsherril

Comment 31 errata-xmlrpc 2020-10-27 12:57:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Satellite 6.8 release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:4366