Bug 164928 - CAN-2005-2475 TOCTOU issue in unzip
Summary: CAN-2005-2475 TOCTOU issue in unzip
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: unzip
Version: 4
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Ivana Varekova
QA Contact: Ben Levenson
URL:
Whiteboard: impact=low,public=20050802,reported=2...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-08-02 19:18 UTC by Josh Bressers
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-09-09 15:51:42 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Josh Bressers 2005-08-02 19:18:57 UTC
+++ This bug was initially created as a clone of Bug #164927 +++

This issue was posted to bugtraq by Imran Ghory
http://marc.theaimsgroup.com/?l=bugtraq&m=112300046224117&w=2


If a malicious local user has write access to a directory in which a
target user is using unzip to extract a file to then a
TOCTOU bug can be exploited to change the permission of any file
belonging to that user.

On decompressing unzip copies the permissions from the compressed
 file to the uncompressed file. However there is a gap between the
uncompressed file being written (and it's file handler being close)
and the permissions of the file being changed.

During this gap a malicious user can remove the decompressed file and
replace it with a hard-link to another file belonging to the user.
unzip will then change the permissions on the  hard-linked file to be
the same as that of the compressed file.

The vulnerable line of code can be found on line 1160 of the file
unix.c where chmod is used (rather than fchmod). unzip also use's
chmod in a number of other places which may also be vulnerable to
exploitation.

Comment 1 Josh Bressers 2005-08-02 19:19:33 UTC
This issue should also affect FC3

Comment 2 Ivana Varekova 2005-08-03 14:53:17 UTC
This bug is fixed in devel (5.51-12).


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