Bug 1434094

Summary: com.redhat.RHSM1.Config.Set is accessible by non-root users
Product: Red Hat Enterprise Linux 7 Reporter: Kevin Howell <khowell>
Component: subscription-managerAssignee: Kevin Howell <khowell>
Status: CLOSED ERRATA QA Contact: Sean Toner <stoner>
Severity: high Docs Contact:
Priority: high    
Version: 7.4CC: jmolet, redakkan, skallesh, stoner
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 19:21:47 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:

Description Kevin Howell 2017-03-20 17:19:17 UTC
Description of problem:
com.redhat.RHSM1.Config.Set can be called by any user.


How reproducible: 100%


Steps to Reproduce:
1. As non-root execute ex. gdbus call --system --dest=com.redhat.RHSM1 -o /com/redhat/RHSM1/Config -m com.redhat.RHSM1.Config.Set server.port "<'444'>"

Actual results:
Observe that port in rhsm.conf is changed


Expected results:
Non-root should not be able to alter rhsm.conf this way.

Comment 3 Sean Toner 2017-04-17 19:20:09 UTC
Tested this out on subscription-manager-1.19.7

Checked what the current port is:
=================================
[stoner@stoner-rhel-74 root]$ cat /etc/rhsm/rhsm.conf | grep "port ="
port = 443
proxy_port =

Switched to a non-root user
===========================
[stoner@stoner-rhel-74 root]$ su robin
Password: 
[robin@stoner-rhel-74 root]$ groups
robin

Tried to call config set service
================================
[robin@stoner-rhel-74 root]$ gdbus call --system --dest=com.redhat.RHSM1 -o /com/redhat/RHSM1/Config -m com.redhat.RHSM1.Config.Set server.port "<'444'>"
Error: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 3 matched rules; type="method_call", sender=":1.37940" (uid=1002 pid=12886 comm="gdbus call --system --dest=com.redhat.RHSM1 -o /co") interface="com.redhat.RHSM1.Config" member="Set" error name="(unset)" requested_reply="0" destination="com.redhat.RHSM1" (uid=0 pid=12113 comm="python /usr/libexec/rhsm-service ")

Switched to root, and checked that the conf file didn't change
==============================================================
[robin@stoner-rhel-74 root]$ su
Password: 
[root@stoner-rhel-74 ~]# cat /etc/rhsm/rhsm.cond | grep "port ="
cat: /etc/rhsm/rhsm.cond: No such file or directory
[root@stoner-rhel-74 ~]# cat /etc/rhsm/rhsm.conf | grep "port ="
port = 443
proxy_port =

As root, called the same command to set the port
================================================
[root@stoner-rhel-74 ~]# gdbus call --system --dest=com.redhat.RHSM1 -o /com/redhat/RHSM1/Config -m com.redhat.RHSM1.Config.Set server.port "<'444'>"
()

Verified the port was set as root user
======================================
[root@stoner-rhel-74 ~]# cat /etc/rhsm/rhsm.conf | grep "port ="
port = 444
proxy_port =

Comment 4 errata-xmlrpc 2017-08-01 19:21:47 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, 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/RHBA-2017:2083