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 2211666 - Ignore TERMINFO and HOME environment variables in setuid binaries
Summary: Ignore TERMINFO and HOME environment variables in setuid binaries
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: ncurses
Version: 9.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Miroslav Lichvar
QA Contact: Ondrej Mejzlik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-01 11:46 UTC by Miroslav Lichvar
Modified: 2023-11-07 11:39 UTC (History)
1 user (show)

Fixed In Version: ncurses-6.2-10.20210508.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-07 08:56:14 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-158800 0 None None None 2023-06-01 11:48:26 UTC
Red Hat Product Errata RHSA-2023:6698 0 None None None 2023-11-07 08:56:19 UTC

Description Miroslav Lichvar 2023-06-01 11:46:02 UTC
Description of problem:
ncurses uses the TERMINFO and HOME environment variables to search for terminfo entries. If there is a bug in parsing or handling (e.g. CVE-2023-29491), it can be exploited for setuid applications.

ncurses has configure option --disable-root-environ to not use there variables when running as root.

Consider building ncurses with this option to avoid this class of security issues.

How reproducible:
always

Steps to Reproduce:
1. TERMINFO="/tmp/terminfo" strace bash -i -c true |& grep terminfo

Actual results:
stat("/tmp/terminfo", 0x55b8e99c2900)   = -1 ENOENT (No such file or directory)
stat("/root/.terminfo", 0x55b8e99c2900) = -1 ENOENT (No such file or directory)
stat("/etc/terminfo", {st_mode=S_IFDIR|0755, st_size=6, ...}) = 0
stat("/usr/share/terminfo", {st_mode=S_IFDIR|0755, st_size=195, ...}) = 0
access("/etc/terminfo/s/screen", R_OK)  = -1 ENOENT (No such file or directory)
access("/usr/share/terminfo/s/screen", R_OK) = 0
openat(AT_FDCWD, "/usr/share/terminfo/s/screen", O_RDONLY) = 3


Expected results:
No access to /tmp/terminfo and /root/.terminfo is observed

Additional info:

Comment 10 Miroslav Lichvar 2023-08-21 14:07:34 UTC
The solution was changed to ignore the TERMINFO and HOME variables only for setuid, setgid, or capability binaries. The root user will still be able to use its own private terminfo.

Comment 16 errata-xmlrpc 2023-11-07 08:56:14 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 (Moderate: ncurses security and bug fix 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/RHSA-2023:6698


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