CVE-2011-2203: Null Pointer Dereference
hfsfindinit() is wrongly assuming that sb->exttree has already been opened and is not NULL but this function can be called when sb->exttree is currently being opened (NULL deref).
Indeed when we have the following call path, the NULL deref. occurs:
In hfsmdbget() we have (at this stage exttree == NULL):
HFSSB(sb)->exttree = hfsbtreeopen(sb, HFSEXTCNID, hfsextkeycmp);
hfsbtreeopen() is calling readmappingpage() which is indirectly a call to hfsreadpage(). Then hfsreadpage() can make the following calls:
hfsreadpage() -> hfsgetblock() -> allocbufferhead() -> hfsextreadextent()
Then hfsextreadextent() calls hfsfindinit() with an exttree == NULL. Then we have a NULL dereference in hfsfindinit().
ptr = kmalloc(tree->maxkeylen (...));
Due to the huge call stack from hfsbtreeopen() to hfsfindinit() there are many ways to fix this dereference but I can't find the proper way to fix it.
Moreover if we look at the code in hfsfindinit().
20 ptr = kmalloc(tree->maxkeylen 2 + 4, GFPKERNEL); 21 if (!ptr) 22 return -ENOMEM; 23 fd->searchkey = ptr; 24 fd->key = ptr + tree->maxkeylen + 2;
We can make "maxkeylen 2 + 4" wrap and have an fd->key pointing outside of the kmalloc()'ed space. Moreover we can make space in fd->searchkey lower than maxkeylen and bad things can occur.
Reference: https://lkml.org/lkml/2011/6/8/154
Acknowledgements:
Red Hat would like to thank Clement Lecigne for reporting this issue.
Other sources
The hfsfindinit function in the Linux kernel 2.6 allows local users to cause a denial of service (NULL pointer dereference and Oops) by mounting an HFS file system with a malformed MDB extent record.
— Launchpad
Affected Software
Remediation
Patch Available
Event History
Frequently Asked Questions
What is the severity of CVE-2011-2203?
CVE-2011-2203 is classified as a high severity vulnerability due to its potential to cause a NULL pointer dereference.
How do I fix CVE-2011-2203?
To fix CVE-2011-2203, you should upgrade to a patched version of the Linux kernel that addresses this vulnerability.
What systems are affected by CVE-2011-2203?
CVE-2011-2203 affects the Linux kernel version 2.6, particularly those configurations making use of the hfs file system.
What type of vulnerability is CVE-2011-2203?
CVE-2011-2203 is a NULL pointer dereference vulnerability that can lead to a denial of service.
How does CVE-2011-2203 impact system security?
CVE-2011-2203 can impact system security by potentially crashing the kernel when the affected function is invoked.