Bug 1060630 (CVE-2001-1593)

Summary: CVE-2001-1593 a2ps: insecure temporary file use
Product: [Other] Security Response Reporter: Murray McAllister <mmcallis>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED NOTABUG QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: jkurik, jrusnack, pertusus, pfrields, tremble, twaugh, vdanen
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-03 15:43:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1060632, 1060633    
Bug Blocks: 1060631    

Description Murray McAllister 2014-02-03 06:06:26 UTC
Jakub Wilk found that a2ps, a tool to convert text and other types of files to PostScript, insecurely used a temporary file in spy_user(). A local attacker could use this flaw to perform a symbolic link attack to modify an arbitrary file accessible to the user running a2ps.

The original report in the Debian bug tracking system (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=737385) notes the issue is in src/main.c:

559   tempname_ensure (job->tmp_filenames[0]);
560   spyname = job->tmp_filenames[0];
561   spy = fopen (spyname, "w");

And also notes there are other calls to tempname_ensure().

Comment 1 Murray McAllister 2014-02-03 06:15:42 UTC
CVE request: http://www.openwall.com/lists/oss-security/2014/02/03/9

Comment 3 Murray McAllister 2014-02-03 06:22:11 UTC
There are currently no patches available for this issue.

Comment 4 Murray McAllister 2014-02-03 06:27:41 UTC
Created a2ps tracking bugs for this issue:

Affects: fedora-all [bug 1060632]
Affects: epel-6 [bug 1060633]

Comment 5 Tim Waugh 2014-02-03 15:43:55 UTC
Not affected. This has been fixed since 2001 due to a2ps-4.13-security.patch being applied. This patch changes tempname_ensure() so that mkstemp() is used rather than tempnam().

It looks like this was the original patch:

* Fri Jan 05 2001 Preston Brown <pbrown>
- security patch for tmpfile creation from Olaf Kirch <okir>

followed the next month by a fix to that patch:

* Mon Feb 12 2001 Tim Waugh <twaugh>
- Fix tmpfile security patch so that it actually _works_ (bug #27155).

Comment 6 Tim Waugh 2014-02-03 15:44:54 UTC
Here's the actual patch:

Comment 7 Murray McAllister 2014-02-04 02:38:52 UTC
Thanks Tim, apologies for missing that.

Comment 8 Tomas Hoger 2014-02-14 22:52:26 UTC
Already fixed in all Red Hat Enterprise Linux and Fedora a2ps packages.