what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

e-matters.fetchmail.txt

e-matters.fetchmail.txt
Posted Oct 2, 2002
Authored by Stefan Esser | Site security.e-matters.de

E-Matters security advisory - Several buffer overflows have been found in fetchmail versions prior to 6.1.0. Overflows in the readheaders() and getmxrecord() function can be used in remote denial of service attacks that may cause data loss. An overflow found in the parse_received() function allows remote code execution and may be used to compromise an affected host.

tags | remote, denial of service, overflow, code execution
SHA-256 | 1c6a40ce9f52ec5bad26332b8020746c2492bdf33417e8c825422b64fdfc8d11

e-matters.fetchmail.txt

Change Mirror Download
                           e-matters GmbH
www.e-matters.de

-= Security Advisory =-

Advisory: Fetchmail remote vulnerabilities
Release Date: 2002/09/29
Last Modified: 2002/09/29
Author: Stefan Esser [s.esser@e-matters.de]

Application: Fetchmail <= 6.0.0
Severity: Several vulnerabilities within Fetchmail could
allow remote compromise.
Risk: Critical
Vendor Status: Vendor released version 6.1.0
Reference: http://security.e-matters.de/advisories/032002.html

Overview:

We have discovered several bufferoverflows and a broken boundary check
within Fetchmail. If Fetchmail is running in multidrop mode these flaws
can be used by remote attackers to crash it or to execute arbitrary
code with the permissions of the user running fetchmail. Depending on
the configuration this allows a remote root compromise.


Details:

While auditing Fetchmail we found several places within the header
parsing function readheaders() where user supplied email addresses
are copied into stack or heap buffers without proper size checking.
nxtaddr() limits the length of such addresses to BUFSIZ bytes. This
constant is defined within the stdio.h header file and is usually
defined as 1024. However systems running glibc like linux define it
as 8192. The destination buffers are around 1 kb in size which means
they will overflow with about 7 kb on linux. Luckily those overflows
are not exploitable because of the fact that 7kb are not enough to
overwrite important control structures. I do not believe that there
exists any system that defines BUFSIZ higher than 8192 but f.e. a
value of 9000 would be enough to exploit one of the bugs...

Unfourtunately there are two more bugs which are related to the
header parsing code and that can be exploited remotely if Fetchmail
is used in multidrop mode. The first one is a broken boundary check
within getmxrecord() that can be used to crash Fetchmail remotely.
To accomplish this an attacker must be able to send a big specially
crafted dns packet to the victim. This is very simple if you are
able to forge the answers of the used dns server but an attacker
can also force Fetchmail to ask for the mx record of a domain he
has control over. It will be trickier but is should be possible to
create a legal dns packet that will pass through bind and will crash.
If Fetchmail receives such a packet it will calculate the end of the
packet wrong and will crash when it tries to read data from above
the top of the Stack.

The last bug is the most dangerous one, because successfully
exploited it allows to execute arbitrary code on the victim's system.
This bug is within the way Fetchmail parses "Received:" headers
within the parse_received() function. Within this function parts
of the "Received:" headerline gets copied into a heap buffer
without any size check. A specially crafted "Received:" header
will overflow the heap with an arbitrary number of bytes. If you
overflow the buffer with enough bytes you can change some pointers
that get free()d/realloc()ated later or you can change the malloc()
control data on the heap directly.

Finally it is important to mention that an attacker does not need
to spoof dns records, or control the mailserver to exploit the last
bug. It is usually enough to deliver a mail that contains such a
specially crafted "Received:" header line to the mailserver.


Proof of Concept:

e-matters is not going to release an exploit for this vulnerability to
the public.


Vendor Response:

22. September 2002 - A patch that fixes this vulnerabilites was mailed
to the vendor.

Vendor released a new version (6.1.0) and asked me
to delay announcing this vulnerability for one week.

Recommendation:

If you are running Fetchmail in multidrop mode you should upgrade to a new
or patched version as soon as possible.


GPG-Key:

http://security.e-matters.de/gpg_key.asc

pub 1024D/75E7AAD6 2002-02-26 e-matters GmbH - Securityteam
Key fingerprint = 43DD 843C FAB9 832A E5AB CAEB 81F2 8110 75E7 AAD6

Copyright 2002 Stefan Esser. All rights reserved.


Login or Register to add favorites

File Archive:

August 2024

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