|
|
|
|
| |
"Clam AntiVirus is a GPL anti-virus toolkit for UNIX."
Exploitation of a design error in Clam AntiVirus ClamAV allows attackers to cause a denial of service (DoS) condition. |
| |
Credit:
The information has been provided by iDEFENSE Labs .
The original article can be found at: http://www.idefense.com/application/poi/display?id=333&type=vulnerabilities,
http://www.idefense.com/application/poi/display?id=334&type=vulnerabilities
|
| |
Vulnerable Systems:
* ClamAV version 0.86.1
Immune Systems:
* ClamAV version 0.87.1
Cabinet-file DoS:
The vulnerability specifically exists with the libmspack library, which is included in ClamAV. The vulnerability can be found in the cabd_find function within mspack/cabd.c:
for (offset = 0; offset < flen; offset += length) {
length = flen - offset;
[... read length from file ...]
for (p = &buf[0], pend = &buf[length]; p < pend; ) {
switch (state) {
[ ... ]
case 19:
-> header has been completely read, cablen has been read from bytes 8-11
[...]
/* likely cabinet found -- try reading it */
cab = sys->alloc(sys, sizeof(struct mscabd_cabinet_p); => an mscabd_cabinet_p entry will be allocated each time
/* cabinet read correctly! */
offset = caboff + cablen;
-> if cablen (and caboff) == 0, offset will be equal to 0
[...]
/* restart search */
[...]
length = 0;
p = pend;
state = 0;
-> if offset == 0, we will restart at the beginning of the file => (because length == 0, so offset will still be zero in the next iteration)
break;
}
}
}
If this function is called with a length value of zero, an infinite loop occurs. The comments above explain the scenario.
Successful exploitation requires an attacker to send a specially constructed CAB file through a mail gateway or personal anti-virus client utilizing the ClamAV scanning engine.
The infinite loop will cause the ClamAV software to use all available processor resources, resulting in a denial of service or severe degradation of system performance. Ultimately, the OOM handler will terminate a task in order to alleviate the stress on the system.
tnef_attachment() DoS:
Remote exploitation of a design error in Clam AntiVirus ClamAV allows attackers to cause a denial of service (DoS) condition.
The vulnerability specifically exists in the tnef_attachment function within tnef.c. A user controlled value is used to fseek into the file that is being processed; this allows a user to specify the same block
for scanning repeatedly, thus leading to an infinite loop. The following one line code snippet from the tnef processor demonstrates the flaw:
fseek(fp, (long)(offset + length), SEEK_SET); /* shouldn't be needed */
When this code is reached, length is supplied by the file being processed. This makes it possible to seek back to the previous header, causing the infinite loop to begin. Furthermore, if the block is marked as an attachment, the data that is repeatedly read will be added to a dynamically allocated memory buffer, making memory exhaustion trivial.
Successful exploitation requires an attacker to send a specially constructed CAB file through a mail gateway or personal anti-virus client utilizing the ClamAV scanning engine.
The infinite loop will cause the ClamAV software to use all available processor resources, resulting in a DoS or severe degradation of system performance. Ultimately, the OOM handler will terminate a task to alleviate the stress on the system.
Workaround:
Archive file analysis can be disabled (--no-archive) but this can have severe impacts on the virus detection functionality.
Vendor Response:
The vendor has released clamav 0.87.1 to address this vulnerability. It is available for download at: http://prdownloads.sourceforge.net/clamav/clamav-0.87.1.tar.gz?download
Disclosure Timeline:
10/07/2005 Initial vendor notification
10/12/2005 Initial vendor response
11/04/2005 Coordinated public disclosure
|
|
|
|
|