what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

unzip552.txt

unzip552.txt
Posted Aug 5, 2005
Authored by Imran Ghory

If a malicious local user extracts a file using unzip 5.52 in a directory that they have write access to, a TOCTOU bug can be exploited to change the permission of any file belonging to that user.

tags | advisory, local
SHA-256 | 55b2c4f64e7c54f23df8ac2775729729ccfb5e0dccfe171b11c2faff2adf5173

unzip552.txt

Change Mirror Download
[Another compression utility with the same race condition issue as bzip2
(CAN-2005-0953), gzip (CAN-2005-0988) and cpio (CAN-2005-1111) - the
file is extracted and file descriptor closed before the file is
chmod'ed]

================================
unzip TOCTOU file-permissions vulnerability
================================

Software: unzip
Version: 5.52
Software URL: <http://www.info-zip.org/pub/infozip/UnZip.html>
Platform: Unix, Linux.
Vulnerability type: Time-of-Check-Time-Of-Use
Severity: Low, local user, badly set permissions.

Vulnerable software
====================

unzip 5.52 and previous versions running on unix.

Vulnerability
==============

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.

Workaround
========

Ensure that any directory which is being used by unzip to
decompress files is only writeable by the user or
alternatively set the sticky bit on the directory's permissions.

---
Imran Ghory
Login or Register to add favorites

File Archive:

August 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Aug 1st
    15 Files
  • 2
    Aug 2nd
    22 Files
  • 3
    Aug 3rd
    0 Files
  • 4
    Aug 4th
    0 Files
  • 5
    Aug 5th
    15 Files
  • 6
    Aug 6th
    11 Files
  • 7
    Aug 7th
    43 Files
  • 8
    Aug 8th
    42 Files
  • 9
    Aug 9th
    36 Files
  • 10
    Aug 10th
    0 Files
  • 11
    Aug 11th
    0 Files
  • 12
    Aug 12th
    0 Files
  • 13
    Aug 13th
    0 Files
  • 14
    Aug 14th
    0 Files
  • 15
    Aug 15th
    0 Files
  • 16
    Aug 16th
    0 Files
  • 17
    Aug 17th
    0 Files
  • 18
    Aug 18th
    0 Files
  • 19
    Aug 19th
    0 Files
  • 20
    Aug 20th
    0 Files
  • 21
    Aug 21st
    0 Files
  • 22
    Aug 22nd
    0 Files
  • 23
    Aug 23rd
    0 Files
  • 24
    Aug 24th
    0 Files
  • 25
    Aug 25th
    0 Files
  • 26
    Aug 26th
    0 Files
  • 27
    Aug 27th
    0 Files
  • 28
    Aug 28th
    0 Files
  • 29
    Aug 29th
    0 Files
  • 30
    Aug 30th
    0 Files
  • 31
    Aug 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close