Bug 491254 (CVE-2009-0787) - CVE-2009-0787 kernel: ecryptfs file header infoleak
Summary: CVE-2009-0787 kernel: ecryptfs file header infoleak
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2009-0787
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 491255 491256
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-03-20 03:46 UTC by Eugene Teo (Security Response)
Modified: 2021-11-12 19:56 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-04-08 17:31:37 UTC
Embargoed:


Attachments (Terms of Use)
Proposed upstream patch (4.55 KB, patch)
2009-03-20 06:56 UTC, Eugene Teo (Security Response)
no flags Details | Diff
Upstream patch (5.08 KB, patch)
2009-03-23 04:35 UTC, Eugene Teo (Security Response)
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2009:0473 0 normal SHIPPED_LIVE Important: kernel security and bug fix update 2009-05-07 10:53:11 UTC

Comment 4 Eugene Teo (Security Response) 2009-03-20 04:29:46 UTC
Reported by Florian Streibelt. When allocating the memory used to store the eCryptfs header contents, a single, zeroed page was being allocated with get_zeroed_page(). However, the size of an eCryptfs header is either PAGE_CACHE_SIZE or ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE (8192), whichever is larger, and is stored in the file's private_data->crypt_stat->num_header_bytes_at_front field.

ecryptfs_write_metadata_to_contents() was using num_header_bytes_at_front to decide how many bytes should be written to the lower filesystem for the file header.  Unfortunately, at least 8K was being written from the page, despite the chance of the single, zeroed page being smaller than 8K.  This resulted in random areas of kernel memory being written between the 0x1000 and 0x1FFF bytes offsets
in the eCryptfs file headers if PAGE_SIZE was 4K.

The vuln was introduced in upstream commit 87b811c3f9, and it affects upstream kernels version 2.6.28 onwards.

Reference:
https://bugs.launchpad.net/ecryptfs/+bug/345544

Comment 5 Eugene Teo (Security Response) 2009-03-20 04:43:25 UTC
eCryptfs is a Technology Preview feature in Red Hat Enterprise Linux 5.3, and it is not a default configuration - http://markmail.org/message/n2acz2wv7b5xkb2o.

Comment 6 Eugene Teo (Security Response) 2009-03-20 06:56:29 UTC
Created attachment 335965 [details]
Proposed upstream patch

Comment 8 Eugene Teo (Security Response) 2009-03-23 04:35:31 UTC
Created attachment 336239 [details]
Upstream patch

Comment 10 Tomas Hoger 2009-03-25 11:31:14 UTC
Encrypted files that were created on systems running vulnerable version of the ecryptfs may contain leaked data in the ecryptfs file headers.   ecryptfs-utils upstream developers created a script that can be used to re-encrypt files inside of ecryptfs mount by making a temporary copy of the file and replacing original with the copy, causing the file to be re-created / re-encrypted on the lower ecryptfs filesystem too.  Script is available in the ecryptfs-utils source code repository:

http://bazaar.launchpad.net/~ecryptfs/ecryptfs/ecryptfs-utils/annotate/head:/src/utils/ecryptfs-rewrite-file
http://bazaar.launchpad.net/~ecryptfs/ecryptfs/ecryptfs-utils/annotate/head:/doc/manpage/ecryptfs-rewrite-file.1

Further information about its use is in the upstream bug report:

https://bugs.launchpad.net/ecryptfs/+bug/345544/comments/5

This approach, however, has limitations, as ecryptfs files and mounts are under the control of the individual users.  Script is meant to be used on files inside of an ecryptfs mount.  Therefore, it can not be used to fully "resolve" the consequences this leak under all circumstance, as non-privileged users can not use it to remove "their" data leaked into other users' ecryptfs files, and system administrators can only use it on ecryptfs mounts that are mounted or have pass phrases known to them.  This script may appear in the future updates of the ecryptfs-utils packages.

Comment 11 Eugene Teo (Security Response) 2009-05-06 03:12:44 UTC
More info: http://kbase.redhat.com/faq/docs/DOC-16748

Comment 12 errata-xmlrpc 2009-05-07 10:53:21 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 5

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


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