[UNIX] Fetchmail Remote Vulnerability (Localhost @)

From: support@securiteam.com
Date: 12/15/02

  • Next message: support@securiteam.com: "[NEWS] Multiple Mambo Site Server Security Weaknesses"
    From: support@securiteam.com
    To: list@securiteam.com
    Date: 15 Dec 2002 23:32:36 +0200
    
    

    The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
    - - promotion

    Beyond Security would like to welcome Tiscali World Online
    to our service provider team.
    For more info on their service offering IP-Secure,
    please visit http://www.worldonline.co.za/services/work_ip.asp
    - - - - - - - - -

      Fetchmail Remote Vulnerability (Localhost @)
    ------------------------------------------------------------------------

    SUMMARY

    In the light of recent discoveries e-Matters reaudited Fetchmail and found
    another buffer overflow within the default configuration. This heap
    overflow can be used by remote attackers to crash it or to execute
    arbitrary code with the privileges of the user running fetchmail.
    Depending on the configuration this allows a remote root compromise.

    DETAILS

    Vulnerable systems:
     * Fetchmail version 6.1.3 and prior

    When Fetchmail retrieves a mail it performs the so called reply-hack. This
    basically means that all headers that contain addresses are searched for
    local addresses (without @domain part). When such an address is found,
    Fetchmail appends a @ and the hostname of the mail server to it. To avoid
    unnecessary reallocating of the output buffer during this process
    Fetchmail counts the number of addresses within the headerline first. Then
    it reserves enough space for the case that all addresses are locals.
    Unfortunately this calculation is wrong because it counts:
    A) To many addresses and
    B) Only takes the hostname in count and not the extra @ which is also
    appended.

    This means at the moment where you have enough (due to a) local addresses
    within the headerline every additional address will overflow the buffer by
    one byte. This results in an arbitrary size heap overflow, which was
    proved to be exploitable on our Linux boxes. Due to the fact that this
    heap overflow occurs in malloc()ed areas we believe that BSD systems can
    only be crashed with this bug.

    Finally it is important to mention that an attacker does not need to spoof
    dns records, or control the mail server to exploit this bug. It is usually
    enough to send a mail to the victim that contains specially crafted header
    lines.
     
    Vendor Response:
    08. December 2002 A patch that fixes this vulnerability was mailed to the
    vendor.
    13. December 2002 Vendor released Fetchmail v6.2.0 which fixes this
    vulnerability.

    Recommendation:
    If you are running Fetchmail we suggest to upgrade to a new or patched
    version as soon as possible.

    ADDITIONAL INFORMATION

    The original advisory can be downloaded by going to:
     <http://security.e-matters.de/advisories/052002.html>
    http://security.e-matters.de/advisories/052002.html

    The information has been provided by <mailto:s.esser@e-matters.de> Stefan
    Esser of e-Matters.

    ========================================

    This bulletin is sent to members of the SecuriTeam mailing list.
    To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
    In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

    ====================
    ====================

    DISCLAIMER:
    The information in this bulletin is provided "AS IS" without warranty of any kind.
    In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.



    Relevant Pages

    • Re: getmail configuration (How to run fetchmail as daemon at startup)
      ... Or does fetchmail also do reinjection in a mail queue? ... instead is feeding it back to a mail server through port 25. ... IMAP stands for Internet Message Access Protocol. ...
      (Debian-User)
    • Re: is exim attempting to relay ???
      ... > fetchmail gets an email message from one of my many remote mail servers, ... Keep in mind that there are SMTP envelope MAIL FROM and RCPT TO ... the mail server at "helices.org" accepted it ... It tried to send this bounce by connecting to your localhost's SMTP ...
      (Debian-User)
    • Re: Spam and virus filter for mailserver
      ... Have you looked at fetchmail? ... and IMAP accounts, forwarding everything to sendmail. ... On my own mail server, I set up an IMAP server for my clients using Cyrus: ...
      (freebsd-questions)
    • Re: SMTP error: 550 Administrative prohibition
      ... In trying to configure my exim4 to use spamassassin, ... At first, all downloaded messages were ... deleted as spam, and as I fiddled, fetchmail could not download messages ... authenticated at the mail server. ...
      (Debian-User)
    • Re: How to Install Mail Hub ( Relay ) on DMZ
      ... In my view the fetchmail solution is not very secure and/or it requires more ... The firewall needs to be ... > Set up a real mail server - dedicated on the DMZ, ...
      (comp.os.linux.security)