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 619293 - sudo: reset $HOME by default
Summary: sudo: reset $HOME by default
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: sudo
Version: 6.0
Hardware: All
OS: Linux
high
medium
Target Milestone: rc
: ---
Assignee: Daniel Kopeček
QA Contact: Eduard Benes
URL:
Whiteboard:
Depends On:
Blocks: 614877
TreeView+ depends on / blocked
 
Reported: 2010-07-29 07:57 UTC by Tomas Hoger
Modified: 2010-11-10 21:40 UTC (History)
5 users (show)

Fixed In Version: sudo-1.7.2p2-8.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-11-10 21:40:40 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
proposed patch (952 bytes, patch)
2010-08-03 09:38 UTC, Daniel Kopeček
no flags Details | Diff
proposed patch (955 bytes, patch)
2010-08-03 11:22 UTC, Daniel Kopeček
no flags Details | Diff

Description Tomas Hoger 2010-07-29 07:57:37 UTC
Description of problem:
In the default configuration, sudo does not reset $HOME environment variable when switching to other user.  Commands run via sudo may use $HOME to search for configuration files or additional modules to load and can have security implications in setups where users are only allowed to run certain specific commands via sudo, but are not granted full shell access to the target user.

This issue has re-surfaced recently for python scripts.  Python 2.6 adds a "Per user site-packages directory" feature (PEP 370):
  http://www.python.org/dev/peps/pep-0370/

Python interpreter searches user home directories for additional modules to load.  When python script is run via sudo and $HOME is not reset to point to target user's home directory, modules can be loaded form source user's home directory, possibly bypassing intended restrictions.

Note: $PYTHONPATH is reset by sudo by default.

We should use safer default, users that prefer to keep $HOME unchanged can adjust sudoers configuration accordingly.  We can either default to always_set_home, or use the upstream change slated for the next upstream version 1.7.4, which no longer preserves $HOME by default during env_reset (env_reset is used by default in RHEL/Fedora sudo packages).

Related upstream commits:
  http://www.sudo.ws/repos/sudo/rev/18223dfd1ac3
  http://www.sudo.ws/repos/sudo/rev/0f7e08f09b9f

Comment 3 Daniel Kopeček 2010-08-03 09:38:14 UTC
Created attachment 436226 [details]
proposed patch

Comment 4 Daniel Kopeček 2010-08-03 11:22:13 UTC
Created attachment 436250 [details]
proposed patch

"use" -> "use it"

Comment 7 releng-rhel@redhat.com 2010-11-10 21:40:40 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.


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