Bug 512885 (CVE-2009-2407) - CVE-2009-2407 kernel: ecryptfs heap overflow in parse_tag_3_packet()
Summary: CVE-2009-2407 kernel: ecryptfs heap overflow in parse_tag_3_packet()
Alias: CVE-2009-2407
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
Depends On: 512886 512887
TreeView+ depends on / blocked
Reported: 2009-07-21 08:25 UTC by Eugene Teo (Security Response)
Modified: 2023-05-13 01:43 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2010-12-21 18:04:28 UTC

Attachments (Terms of Use)
[PATCH 2/2] eCryptfs: parse_tag_3_packet check tag 3 packet encrypted key size (1.07 KB, patch)
2009-07-21 08:29 UTC, Eugene Teo (Security Response)
no flags Details | Diff

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2009:1193 0 normal SHIPPED_LIVE Important: kernel security and bug fix update 2009-08-04 13:15:15 UTC

Description Eugene Teo (Security Response) 2009-07-21 08:25:48 UTC
Description of problem:
Ramon de Carvalho Valle was testing eCryptfs with fsfuzzer and ran across a
stack overflow bug.  At the beginning of each eCryptfs file, metadata is stored
containing things like encrypted file encryption key (EFEK), key signature of
key used to decrypt the EFEK, etc.  This metadata is stored in "packets", as
per RFC 2440 - OpenPGP Message Format.

The header of each packet contains a packet length field.  As the eCryptfs
kernel module reads the packet contents, it uses that packet length field in a
memcpy() to the destination buffer.  However, no checks existed to make sure
the buffer was big enough to hold the entire packet contents.

A malicious user on the system that has permissions to perform an eCryptfs
mount (root or setuid mount helper needed) can modify the metadata using
hexedit and specify a bigger packet size than what the destination buffer can
hold and also modify the packet contents, which would probably allow them to
handcraft the data used to overwrite the stack.

Comment 3 Eugene Teo (Security Response) 2009-07-21 08:29:03 UTC
Created attachment 354440 [details]
[PATCH 2/2] eCryptfs: parse_tag_3_packet check tag 3 packet	encrypted key size

Comment 11 Eugene Teo (Security Response) 2009-07-29 01:56:31 UTC
Upstream commit:

Comment 12 Fedora Update System 2009-07-29 22:26:11 UTC
kernel- has been submitted as an update for Fedora 11.

Comment 13 Vincent Danen 2009-07-31 19:36:39 UTC
Common Vulnerabilities and Exposures assigned an identifier CVE-2009-2407 to
the following vulnerability:

Name: CVE-2009-2407
URL: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-2407
Assigned: 20090709
Reference: BUGTRAQ:20090728 [RISE-2009003] Linux eCryptfs parse_tag_3_packet Encrypted Key Buffer Overflow Vulnerability
Reference: URL: http://www.securityfocus.com/archive/1/archive/1/505337/100/0/threaded
Reference: MISC: http://risesecurity.org/advisories/RISE-2009003.txt
Reference: CONFIRM: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f151cd2c54ddc7714e2f740681350476cda03a28
Reference: CONFIRM: http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-
Reference: DEBIAN:DSA-1844
Reference: URL: http://www.debian.org/security/2009/dsa-1844
Reference: DEBIAN:DSA-1845
Reference: URL: http://www.debian.org/security/2009/dsa-1845
Reference: UBUNTU:USN-807-1
Reference: URL: http://www.ubuntu.com/usn/usn-807-1
Reference: BID:35850
Reference: URL: http://www.securityfocus.com/bid/35850
Reference: SECUNIA:35985
Reference: URL: http://secunia.com/advisories/35985
Reference: SECUNIA:36045
Reference: URL: http://secunia.com/advisories/36045
Reference: SECUNIA:36051
Reference: URL: http://secunia.com/advisories/36051
Reference: SECUNIA:36054
Reference: URL: http://secunia.com/advisories/36054
Reference: VUPEN:ADV-2009-2041
Reference: URL: http://www.vupen.com/english/advisories/2009/2041

Heap-based buffer overflow in the parse_tag_3_packet function in
fs/ecryptfs/keystore.c in the eCryptfs subsystem in the Linux kernel
before allows local users to cause a denial of service
(system crash) or possibly gain privileges via vectors involving a
crafted eCryptfs file, related to a large encrypted key size in a Tag
3 packet.

Comment 14 Fedora Update System 2009-08-03 16:59:05 UTC
kernel- has been submitted as an update for Fedora 10.

Comment 15 errata-xmlrpc 2009-08-04 13:15:42 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 5

Via RHSA-2009:1193 https://rhn.redhat.com/errata/RHSA-2009-1193.html

Comment 16 Fedora Update System 2009-08-05 00:30:24 UTC
kernel- has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 17 Fedora Update System 2009-08-05 00:35:48 UTC
kernel- has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 21 Vincent Danen 2013-09-27 17:53:19 UTC

Red Hat would like to thank Ramon de C. Valle for reporting this issue.

Note You need to log in before you can comment on or make changes to this bug.