Block/Detect mangled zip files

Matt Selsky selsky at
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

$ unzip -l /tmp/
Archive:  /tmp/
  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/ or
        /tmp/, and cannot find /tmp/, period.

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

$ clamscan -a -v /tmp/
Scanning /tmp/
Scanning /tmp/!ZIP:jeffry_boyersunt.quia.exe
/tmp/ 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

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 amavis[4654]: (04654-02) do_7zip:
2015-09-03T03:40:14.680+00:00 amavis[4654]: (04654-02) do_7zip:
member:  "jeffry_boyersunt.quia.exe", 45568 bytes
2015-09-03T03:40:14.682+00:00 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?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the amavis-users mailing list