__________________________________________________________ The U.S. Department of Energy Computer Incident Advisory Capability ___ __ __ _ ___ / | /_\ / \___ __|__ / \ \___ __________________________________________________________ INFORMATION BULLETIN Sudo Environment Cleaning Vulnerability [Sudo Announcement] November 15, 2004 18:00 GMT Number P-037 ______________________________________________________________________________ PROBLEM: A flaw exists in sudo's environment sanitizing when running bash scripts. The /bin/sh shell on most (if not all) Linux systems is bash. PLATFORM: Sudo versions prior to 1.6.8.p2 DAMAGE: An attacker with sudo access to a shell script that uses bash may run arbitrary commands. SOLUTION: The bug is fixed in sudo 1.6.8.p2 ______________________________________________________________________________ VULNERABILITY The risk is MEDIUM. Local users could possibly get root ASSESSMENT: privileges. ______________________________ ________________________________________________ LINKS: CIAC BULLETIN: http://www.ciac.org/ciac/bulletins/p-037.shtml ORIGINAL BULLETIN: http://www.sudo.ws/sudo/alerts/bash_functions.html ______________________________________________________________________________ [***** Start Sudo Announcement *****] Bash scripts run via Sudo can be subverted Summary: A flaw in exists in sudo's environment sanitizing prior to sudo version 1.6.8p2 that could allow a malicious user with permission to run a shell script that utilized the bash shell to run arbitrary commands. The /bin/sh shell on most (if not all) Linux systems is bash. Sudo versions affected: All versions prior to 1.6.8p2. Details: When it starts up, bash searches the environment for variables with a value beginning with "()". For each environment variables that matches, a function with the same name as the corresponding variable is created (with the function body filled in from the environment variable's value). A malicious user with sudo access to a shell script that uses bash can use this feature to substitute arbitrary commands for any non-fully qualified programs called from the script. Impact: Exploitation of the bug requires that the bash shell be installed on the machine and that users be granted sudo access to run scripts written in bash. On most (if not all) Linux systems, /bin/sh is bash so /bin/sh scripts are affected by this as well. Wordaround: The administrator can add a line to the sudoers file: Defaults env_reset that will reset the environment to only contain the variables HOME, LOGNAME, PATH, SHELL, TERM, and USER, preventing this attack. Fix: The bug is fixed in sudo 1.6.8p2. Credit: This problem was brought to my attention by Liam Helmer. Copyright © 2004 GratiSoft, Inc. [***** End Sudo Announcement *****] _______________________________________________________________________________ CIAC wishes to acknowledge the contributions of GratiSoft, Inc. for the information contained in this bulletin. _______________________________________________________________________________ CIAC, the Computer Incident Advisory Capability, is the computer security incident response team for the U.S. Department of Energy (DOE) and the emergency backup response team for the National Institutes of Health (NIH). CIAC is located at the Lawrence Livermore National Laboratory in Livermore, California. CIAC is also a founding member of FIRST, the Forum of Incident Response and Security Teams, a global organization established to foster cooperation and coordination among computer security teams worldwide. CIAC services are available to DOE, DOE contractors, and the NIH. CIAC can be contacted at: Voice: +1 925-422-8193 (7x24) FAX: +1 925-423-8002 STU-III: +1 925-423-2604 E-mail: ciac@ciac.org Previous CIAC notices, anti-virus software, and other information are available from the CIAC Computer Security Archive. World Wide Web: http://www.ciac.org/ Anonymous FTP: ftp.ciac.org PLEASE NOTE: Many users outside of the DOE, ESnet, and NIH computing communities receive CIAC bulletins. If you are not part of these communities, please contact your agency's response team to report incidents. Your agency's team will coordinate with CIAC. The Forum of Incident Response and Security Teams (FIRST) is a world-wide organization. A list of FIRST member organizations and their constituencies can be obtained via WWW at http://www.first.org/. This document was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government nor the University of California nor any of their employees, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights. Reference herein to any specific commercial products, process, or service by trade name, trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement, recommendation or favoring by the United States Government or the University of California. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or the University of California, and shall not be used for advertising or product endorsement purposes. LAST 10 CIAC BULLETINS ISSUED (Previous bulletins available from CIAC) P-027: Sun Java System Web Proxy Server Buffer Overflow Vulnerability P-028: Cisco Vulnerability in Cisco Secure Access Control Server (ACS) EAP-TLS Authentication P-029: libxml and libxml2 Buffer Overflow P-030: Local Volume Manager (LVM) Vulnerability P-031: HP OpenView Operations (OVO) Remote Privilege Elevation Vulnerability P-032: GZIP Insecure Temporary Files P-033: "libgd" Integer Overflows P-034: Cisco IOS DHCP Blocked Interface Denial-of-Service P-035: iPlanet/Sun ONE Messaging Server Webmail Vulnerability