Block/Detect mangled zip files

Matt Selsky selsky at gmail.com
Thu Sep 3 05:43:49 CEST 2015


I'm running amavisd-new 1:2.7.1-2 on Debian wheezy.

I'm receiving zip files that are mangled.  unzip isn't able to read the
file:

$ unzip -l /tmp/malware.zip
Archive:  /tmp/malware.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of /tmp/malware.zip or
        /tmp/malware.zip.zip, and cannot find /tmp/malware.zip.ZIP, period.

clamav is able to open the zip file, but doesn't detect the virus:

$ clamscan -a -v /tmp/malware.zip
Scanning /tmp/malware.zip
Scanning /tmp/malware.zip!ZIP:jeffry_boyersunt.quia.exe
/tmp/malware.zip: OK

----------- SCAN SUMMARY -----------
Known viruses: 5963596
Engine version: 0.98.7
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 0.01 MB
Data read: 0.01 MB (ratio 1.00:1)
Time: 8.012 sec (0 m 8 s)


My site's policy is to block all .exe extensions, including within zip
files, but zip files are generally allowed if they only contain allowed
extensions.

I switched over to 7zip (9.38.1 built from source) and now amavis reports
(debugging enabled):
2015-09-03T03:40:14.680+00:00 example.com amavis[4654]: (04654-02) do_7zip:
member:
 "/var/lib/amavis/tmp/amavis-20150903T033951-04654-lnscgKNE/parts/p002",
 bytes
2015-09-03T03:40:14.680+00:00 example.com amavis[4654]: (04654-02) do_7zip:
member:  "jeffry_boyersunt.quia.exe", 45568 bytes
2015-09-03T03:40:14.682+00:00 example.com amavis[4654]: (04654-02)
(!)Decoding of p002 (Zip archive data, at least v2.0 to extract) failed,
leaving it unpacked: do_7zip: can't get a list of archive members: exit 2;
Errors: 1

Do the parsed members of the zip file get thrown away from the zip error is
encountered?  Does it make sense to ignore the errors in order to block
these mangled zip files?

Cheers,
-Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.amavis.org/pipermail/amavis-users/attachments/20150902/98112e19/attachment.html>


More information about the amavis-users mailing list