{"vuid":"VU#866472","idnumber":"866472","name":"MIT Kerberos 5 ASN.1 decoding function krb5_rd_cred() insecurely deallocates memory (double-free)","keywords":["MIT","Kerberos","double-free","arbitrary code execution","krb5_rd_cred()","asn.1","decode_krb5_enc_cred_part()"],"overview":"The krb5_rd_cred() function in the MIT Kerberos 5 library does not securely deallocate heap memory when decoding ASN.1 structures, resulting in a double-free vulnerability. A remote, authenticated attacker could execute arbitrary code or cause a denial of service on any system running an application that calls krb5_rd_cred(). This includes Kerberos application servers and other applications that process Kerberos authentication via the MIT Kerberos 5 library, GSSAPI, and other libraries.","clean_desc":"As described on the MIT Kerberos web site:  \"Kerberos is a network authentication protocol. It is designed to provide strong authentication for client/server applications by using secret-key cryptography.\"  MIT Kerberos code is used in network applications from a variety of different vendors and is included in many UNIX and Linux distributions. Kerberos 5 protocol messages are defined using Abstract Syntax Notation One (ASN.1). When handling an error condition, the function krb5_rd_cred() free()s a memory reference returned from the ASN.1 decoding function decode_krb5_enc_cred_part(). As part of its own error handling process, the decoding function already free()d the memory reference, therefore the second free() can corrupt heap memory management structures, possibly manipulating heap memory to execute arbitrary code. This is a double-free vulnerability. Note that this vulnerability was addressed in kbr5-1.3.2. From MITKRB5-SA-2004-002: Implementations of krb5_rd_cred() prior to the krb5-1.3.2 release\ncontained code to explicitly free the buffer returned by the ASN.1\ndecoder function decode_krb5_enc_cred_part() when the decoder returns\nan error. This is another double-free, since the decoder would itself\nfree the buffer on error. Since decode_krb5_enc_cred_part() does not\nget called unless the decryption of the encrypted part of the KRB-CRED\nis successful, the attacker needs to have authenticated. This code\nwas corrected in the krb5-1.3.2 release. MIT notes that Kerberos applications that call krb5_rd_cred() to process forwarded credentials are affected: Applications calling the krb5_rd_cred() function in releases prior\nto krb5-1.3.2. Such applications in the MIT krb5 releases include\nthe remote login daemons (krshd, klogind, and telnetd) and the FTP\ndaemon. The krb5_rd_cred() function decrypts and decodes forwarded\nKerberos credentials. Third-party applications calling this\nfunction directly or indirectly (by means of the GSSAPI or other\nlibraries) are vulnerable.","impact":"A remote, authenticated attacker could execute arbitrary code on a vulnerable Kerberos application server or cause a denial of service.","resolution":"Apply a patch\nApply the appropriate patch(es) referenced in MITKRB5-SA-2004-002 or specified by your vendor. Note that this vulnerability does not exist in krb5-1.3.2 and later. Upgrade According to MITKRB5-SA-2004-002, \"The upcoming krb5-1.3.5 release will contain fixes for these problems.\"","workarounds":"Restrict access Depending on network architecture and application requirements, it may be practical to restrict access to Kerberos application servers from untrusted networks such as the Internet. While this will help to limit the source of attacks, it will not prevent attacks from trusted hosts or networks or attackers who can successfully spoof their source addresses.","sysaffected":"","thanks":"Thanks to Tom Yu and the MIT Kerberos Development Team for reporting this vulnerability and coordinating with vendors. MITKRB5-SA-2004-002 acknowledges Joseph Galbraith and John Hawkinson","author":"This document was written by Art Manion.","public":["http://web.mit.edu/kerberos/advisories/MITKRB5-SA-2004-002-dblfree.txt","http://web.mit.edu/kerberos/www/","http://www.cmf.nrl.navy.mil/CCS/people/kenh/kerberos-faq.html#asn1","http://www.itu.int/ITU-T/asn1/","http://www.itu.int/ITU-T/studygroups/com10/languages/","http://www.cmf.nrl.navy.mil/CCS/people/kenh/kerberos-faq.html#gssapi","http://www.ietf.org/rfc/rfc2743.txt","http://www.ietf.org/rfc/rfc1964.txt","http://www.securitytracker.com/alerts/2004/Aug/1011106.html"],"cveids":["CVE-2004-0643"],"certadvisory":"","uscerttechnicalalert":null,"datecreated":"2004-07-16T13:01:20Z","publicdate":"2004-08-31T00:00:00Z","datefirstpublished":"2004-09-02T06:33:54Z","dateupdated":"2004-09-03T20:21:43Z","revision":30,"vrda_d1_directreport":"","vrda_d1_population":"","vrda_d1_impact":"","cam_widelyknown":"15","cam_exploitation":"0","cam_internetinfrastructure":"14","cam_population":"18","cam_impact":"20","cam_easeofexploitation":"7","cam_attackeraccessrequired":"8","cam_scorecurrent":"10.962","cam_scorecurrentwidelyknown":"12.852","cam_scorecurrentwidelyknownexploited":"20.412","ipprotocol":"","cvss_accessvector":"","cvss_accesscomplexity":"","cvss_authentication":null,"cvss_confidentialityimpact":"","cvss_integrityimpact":"","cvss_availabilityimpact":"","cvss_exploitablity":null,"cvss_remediationlevel":"","cvss_reportconfidence":"","cvss_collateraldamagepotential":"","cvss_targetdistribution":"","cvss_securityrequirementscr":"","cvss_securityrequirementsir":"","cvss_securityrequirementsar":"","cvss_basescore":"","cvss_basevector":"","cvss_temporalscore":"","cvss_environmentalscore":"","cvss_environmentalvector":"","metric":10.962,"vulnote":null}