RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1292815 - usermod -p allowing colon (ie. ':' ) in encrypted password which then breaks /etc/shadow
Summary: usermod -p allowing colon (ie. ':' ) in encrypted password which then breaks ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: shadow-utils
Version: 7.2
Hardware: All
OS: Linux
high
medium
Target Milestone: rc
: ---
Assignee: Tomas Mraz
QA Contact: Stefan Kremen
URL:
Whiteboard:
Depends On:
Blocks: 1203710 1296594 1313485
TreeView+ depends on / blocked
 
Reported: 2015-12-18 12:24 UTC by Tomas Mraz
Modified: 2019-10-10 10:44 UTC (History)
6 users (show)

Fixed In Version: shadow-utils-4.1.5.1-19.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 1220504
Environment:
Last Closed: 2016-11-04 03:41:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 1444893 0 None None None 2015-12-18 12:24:59 UTC
Red Hat Product Errata RHBA-2016:2322 0 normal SHIPPED_LIVE shadow-utils bug fix and enhancement update 2016-11-03 13:43:15 UTC

Description Tomas Mraz 2015-12-18 12:24:59 UTC
Description of problem:
usermod -p allowing colon (ie. ':' ) in encrypted password which then breaks /etc/shadow


Version-Release number of selected component (if applicable):
shadow-utils-4.1.4.2-19.el6_6.1.x86_64

How reproducible:
VERY

Steps to Reproduce:
1. Create test user
# useradd test
# passwd test
# grep ^test: /etc/shadow
test:$6$ziMs4I5K$yh6QO6q4siNK8j.CMxCBO.hjF75XlQZzl7I2dXIJqnANNvhMwFtdDY2obXOjGnniPcVTpSazk5REcTKGHVEUb1:16566:0:99999:7:::

2. Modify user password with usermod and include colon
# usermod -p 'sstest:123' test

3. Now see that the ':' was accepted even though it is really a delimiter for the file
# grep ^test: /etc/shadow
test:sstest:123:16566:0:99999:7:::


Actual results:
# grep ^test: /etc/shadow
test:sstest:123:16566:0:99999:7:::


Expected results:
A failure like you get on RHEL 7
# usermod -p 'sstest:123' test
usermod: failure while writing changes to /etc/shadow


Additional info:
If you run the usermod again you start adding duplicate lines:

# usermod -p 'sstest:123' test
# grep ^test: /etc/shadow
test:sstest:123:16566:0:99999:7:::
test:sstest:123:16566:0:99999:7:::

Comment 2 James Hartsock 2015-12-18 15:25:41 UTC
I opened the RHEL 6 verstion of the BZ, and included in the Expected results above is that RHEL 7 already warns of this issue.  So not sure this BZ is needed for RHEL 7...


# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.2 (Maipo)
# grep ^test: /etc/shadow
test:$6$iimWa/Hp$h2Vx0aM1WD/Z.khihwBnpRocSLTc8PgVNIwFjRejYpp74JxToLo6IrgaT.1CZDrbw9cYXfLt494aDQsweU6/60:16787:0:99999:7:::
# usermod -p 'sstest:123' test
usermod: failure while writing changes to /etc/shadow
# grep ^test: /etc/shadow
test:$6$iimWa/Hp$h2Vx0aM1WD/Z.khihwBnpRocSLTc8PgVNIwFjRejYpp74JxToLo6IrgaT.1CZDrbw9cYXfLt494aDQsweU6/60:16787:0:99999:7:::



Now with colon removed on RHEL 7 (so seems the colon is cause of failure):
# usermod -p 'sstest123' test
# grep ^test: /etc/shadow
test:sstest123:16787:0:99999:7:::

Comment 3 Tomas Mraz 2015-12-21 09:56:13 UTC
Hmm, you're right that there is additional check when writing the shadow entry. However the error message is not completely clear so it is better to include the explicit check for ':' which will be in RHEL-6.8.

Comment 8 errata-xmlrpc 2016-11-04 03:41:12 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://rhn.redhat.com/errata/RHBA-2016-2322.html


Note You need to log in before you can comment on or make changes to this bug.