Scott,

V1 has only in rar cases (MaxBytes) the complete mail in memory. It is not 
possible to unzip/untar/ungz/unlha ...
an incomplete attachment.

V2 has the AFC-Plugin, which is called at the 'complete mail' level,  
where it is possible to implement your script (or any other) in a filescanner 
command.

Thomas 

-----Scott Haneda <[email protected]> schrieb: -----
 
An: ASSP development mailing list <[email protected]>
Von: Scott Haneda <[email protected]>
Datum: 12.02.2010 22:08
Kopie: For Users of ASSP <[email protected]>
Betreff: [Assp-test] Feature request, if not already implemented,       fast 
zip file scanning for bad files/virus

Cross-posting to ass-user for user feedback please...

It can be used as a tactic to get nefarious files in email to take a exe, bat, 
or others, zip it up, and send it. &nbsp;As far as I know, ASSP will scan the 
base64 parts of an email, or perhaps just look at the filename attachment part 
in the content disposition, and block based on your known list.

This does not block hidden files inside zip files.

The next step would be to pass it off to clam or some other scanner, which I 
believe uncompress it, and then finds out what is inside of it. &nbsp;Any time 
anything hits an AV scanner, it is pretty deep into ASSP, and is going to come 
as a CPU hit, and a pretty hard one.

I also worry about http://en.wikipedia.org/wiki/Zip_bomb
Zip Bombs are bad files hidden in zips, or zips crafted in a way to create 
recursive unzipping, that can bring a server to it's knees.

&nbsp;&nbsp; I have used the below tactic for years, hit 2 false positives for 
&nbsp;&nbsp; nested zips in zips, which was promptly fixed, and have never once 
&nbsp;&nbsp; received a virus. &nbsp;This solved virus's if you are willing to 
block by 
&nbsp;&nbsp; attachment name, and does so with negligible CPU use/resources. 
&nbsp;To 
&nbsp;&nbsp; me, this is like 100% success with less than 1% CPU use, and 
happens 
&nbsp;&nbsp; first in line in the proxy, not last.

What if on the front end of ASSP, it took the attachment and:

&nbsp;&nbsp; $mkdir files

Copy a bunch of junk files into `files`
&nbsp;&nbsp; ATT00001
&nbsp;&nbsp; ATT00001-1
&nbsp;&nbsp; Default.aspx.html
&nbsp;&nbsp; fooo/ <- contains all files within this directory
&nbsp;&nbsp; mailstats.txt
&nbsp;&nbsp; test.exe <- Bad file, I want to block this

Now lets zip it up...
&nbsp;&nbsp; $cd ..
&nbsp;&nbsp; $zip files.zip files
$ls -la
&nbsp;&nbsp; 306 Feb 12 11:59 files
&nbsp;&nbsp; 615837 Feb 12 12:01 files.zip

Now we can look inside it, without even opening it...
65 files found, this is a lot because of how Mac OS X deals with resource forks 
and trying to maintain them with the "__MACOSX/" directory, which in this case, 
is of no issue at all, just data files, no care.

Output was too large, but here you are
http://pastie.org/822320

So now, we can list it, lets look for patterns...
&nbsp;&nbsp; * In this case, look for exe and html, case insensitive, just to 
illustrate how an OR can work.

&nbsp;&nbsp; $unzip -l files.zip | egrep -i "\.exe|\.html"

&nbsp;&nbsp; &nbsp; &nbsp; 28096 &nbsp;02-12-10 09:55 &nbsp; 
files/Default.aspx.html
&nbsp;&nbsp; &nbsp; &nbsp; 28096 &nbsp;02-12-10 09:55 &nbsp; 
files/fooo/Default.aspx.html
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1554 &nbsp;02-12-10 10:42 &nbsp; 
files/fooo/test.exe
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1201 &nbsp;02-12-10 10:42 &nbsp; 
__MACOSX/files/fooo/._test.exe
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1554 &nbsp;02-12-10 10:42 &nbsp; files/test.exe
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1201 &nbsp;02-12-10 10:42 &nbsp; 
__MACOSX/files/._test.exe

Seems to have found all the hits we wanted.

If you want to be Mac OS X prerry (for the logs), and ignore the files that 
could not hurt, but in reality, a crafty person could exploit the "__MACOSX" if 
the OS is not prepared for it, though I suspect it is...

&nbsp;&nbsp; $unzip -l files.zip | grep -v "__MACOSX/files" | egrep -i 
"\.exe|\.html"

&nbsp;&nbsp; &nbsp; &nbsp; 28096 &nbsp;02-12-10 09:55 &nbsp; 
files/Default.aspx.html
&nbsp;&nbsp; &nbsp; &nbsp; 28096 &nbsp;02-12-10 09:55 &nbsp; 
files/fooo/Default.aspx.html
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1554 &nbsp;02-12-10 10:42 &nbsp; 
files/fooo/test.exe
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1554 &nbsp;02-12-10 10:42 &nbsp; files/test.exe

In this case, we had hits on not only the main files but all the subdirectory 
of files. &nbsp;If you were to sprinkle a little recursions into the unzip 
command, or there may be a flag for the -l that also will -l sub zips, then we 
could take this to nested zips inside even more zips. &nbsp;If the resulting 
output was more than perhaps 5000 files, abort so there is no chance of runaway.

I think that is it, should be pretty easy to convert to perl, and replace the 
current method, which I do not believe looks inside the zip file attachment. 
&nbsp;If ASSP does look inside, then ignore the post entirely :)

Interested in your feedback.

-- 
Scott * If you contact me off list replace talklists@ with scott@ * 


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Assp-test mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/assp-test



DISCLAIMER:
*******************************************************
This email and any files transmitted with it may be confidential, legally 
privileged and protected in law and are intended solely for the use of the 
individual to whom it is addressed.
This email was multiple times scanned for viruses. There should be no known 
virus in this email!
*******************************************************


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Assp-test mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/assp-test

Reply via email to