Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2115789

Summary: sudo digest check fails incorrectly for certain file sizes (SHA512/SHA384)
Product: Red Hat Enterprise Linux 9 Reporter: Dalibor Pospíšil <dapospis>
Component: sudoAssignee: Radovan Sroka <rsroka>
Status: CLOSED ERRATA QA Contact: Dalibor Pospíšil <dapospis>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.1CC: bstinson, dapospis, jwboyer, qe-baseos-security, rsroka, saroy, security-response-team, tshearer
Target Milestone: rcKeywords: AutoVerified, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sudo-1.9.5p2-8.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: 2114576 Environment:
Last Closed: 2023-05-09 08:25:10 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 Dalibor Pospíšil 2022-08-05 11:45:10 UTC
+++ This bug was initially created as a clone of Bug #2114576 +++

Flagging as a security issue because it relates to sudo/authentication/privileged access.

Description of problem:
The sudoers file can be used to store the SHA2 hash of an executable, along with the users (or groups) permitted to execute it. This hash is used by sudo to verify whether the binary has been modified/tampered, and if so, users are prevented from exexuting it.

However, the digest is calculated incorrectly for SHA384 and SHA512 functions with files that are sized
   (n*8) mod 1024 == 896
where n is the file size in bytes.

This causes sudo to falsely prevent the execution of unmodified files.

Version-Release number of selected component:
sudo-1.9.5p2-7.el9.x86_64

How reproducible:
  - Every time, as long as the file size matches the criteria above.

Steps to Reproduce:
# As root, create a 240 byte test executable:
dd if=/dev/zero of=/opt/testexec bs=1 count=240 iflag=fullblock && chmod 744 /opt/testexec
# Add a new user:
adduser testusr
# Create a digest entry in sudoers:
echo "testusr ALL=(ALL) NOPASSWD: sha512:$(sha512sum /opt/testexec | awk '{ print $1 }') /opt/testexec *" > /etc/sudoers.d/testdigest
# Attempt to execute the application as the "testusr" user:
sudo -u testusr sudo /opt/testexec

Actual results:
  User prompted for password (if logging is enabled, a "sha512 digest mismatch" error is reported in /var/log/sudo_debug.log)

Expected results:
  User is authorized to execute file without password prompt, which is what happens if the file is 239 or 241 bytes long.

Comment 11 errata-xmlrpc 2023-05-09 08:25:10 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 (sudo bug fix and enhancement update), 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-2023:2564