{"vuid":"VU#10277","idnumber":"10277","name":"Various shells create temporary files insecurely when using << operator","keywords":["sh","bash","tcsh","csh","ksh","<<","tmp","temporary","FI039-C"],"overview":"sh uses  /tmp files of a predictable name in creating files for input redirection using the << operator.","clean_desc":"When performing the \"<<\" redirection, /bin/sh creates a temporary file in /tmp with a name based on the process id, writes subsequent input out to that file, and then closes the file before re-opening it as the standard input of the command to be executed. At no stage are the results of the creat(), write(), or open() calls checked for an error status.","impact":"It is possible for another user to alter what is read from this file. If the sticky bit is not set on /tmp, the file can be simply removed, and a new file created in its place\nIf the sticky bit is set, then it is possible to guess what the file will be called and create it before /bin/sh does (the creat() call performed by the shell does not result in an open() call with O_EXCL set) and hence it is possible to maintain a handle on the underlying file. If a fifo is created in place of the temporary file it is particularly easy to insert an extra command into the input transparently, and without having to worry about ensuring the bug is exploited during the narrow window of time in which it occurs. Even without reading, creating this file may block the execution of commands using the << operator. It may also be possible to create a symbolic link named as the temporary file and pointed to any other file on the system writable by the user of the shell, which may lead to corruption of the file to which the link is pointed.","resolution":"Apply vendor patches; see the Systems Affected section below.","workarounds":"Avoid the use of << operator in cron jobs and similar administration scripts.","sysaffected":"","thanks":"The original discoverer of this vul was Gordon Irlam of the Univeristy of Adelaide, Australia.","author":"This document was written by James T. Ellis, modified by Tim Shimeall to reflect 2001 reporting","public":["http://www.securityfocus.com/bid/3996","http://www.securityfocus.com/bid/2006","ftp://patches.sgi.com/support/free/security/advisories/20011103-01-I"],"cveids":["CVE-2000-1134"],"certadvisory":"","uscerttechnicalalert":null,"datecreated":"1999-01-05T22:32:38Z","publicdate":"1991-07-17T00:00:00Z","datefirstpublished":"2001-07-02T21:03:59Z","dateupdated":"2007-04-24T18:02:24Z","revision":19,"vrda_d1_directreport":"1","vrda_d1_population":"3","vrda_d1_impact":"2","cam_widelyknown":"15","cam_exploitation":"0","cam_internetinfrastructure":"3","cam_population":"8","cam_impact":"8","cam_easeofexploitation":"8","cam_attackeraccessrequired":"10","cam_scorecurrent":"1.728","cam_scorecurrentwidelyknown":"2.208","cam_scorecurrentwidelyknownexploited":"4.128","ipprotocol":"","cvss_accessvector":"","cvss_accesscomplexity":"","cvss_authentication":null,"cvss_confidentialityimpact":"","cvss_integrityimpact":"","cvss_availabilityimpact":"","cvss_exploitablity":null,"cvss_remediationlevel":"","cvss_reportconfidence":"","cvss_collateraldamagepotential":"","cvss_targetdistribution":"","cvss_securityrequirementscr":"","cvss_securityrequirementsir":"","cvss_securityrequirementsar":"","cvss_basescore":"","cvss_basevector":"","cvss_temporalscore":"","cvss_environmentalscore":"","cvss_environmentalvector":"","metric":1.728,"vulnote":null}