CVE-2011-2939: Buffer Overflow
Off-by-one error in the decodexs function in Unicode/Unicode.xs in the Encode module before 2.44, as used in Perl before 5.15.6, might allow context-dependent attackers to cause a denial of service (memory corruption) via a crafted Unicode string, which triggers a heap-based buffer overflow.
Other sources
Perl bundles Encode' module (http://search.cpan.org/~dankogai/Encode/) that contains Unicode.xs' file where a heap overflow bug has been fixed recently (http://cpansearch.perl.org/src/DANKOGAI/Encode-2.44/Changes):
$Revision: 2.44 $ $Date: 2011/08/09 07:49:44 $ ! Unicode/Unicode.xs Addressed the following: Date: Fri, 22 Jul 2011 13:58:43 +0200 From: Robert Zacek <zacek> To: perl5-security-report Subject: Unicode.xs!decodexs n-byte heap-overflow
The patch has been merged into perl development tree (http://perl5.git.perl.org/perl.git/commitdiff/e46d973584785af1f445c4dedbee4243419cb860#patch5):
diff --git a/cpan/Encode/Unicode/Unicode.xs b/cpan/Encode/Unicode/Unicode.xs
index 16f4cd1..039f155 100644 (file)
--- a/cpan/Encode/Unicode/Unicode.xs +++ b/cpan/Encode/Unicode/Unicode.xs @@ -1,5 +1,5 @@ / - $Id: Unicode.xs,v 2.7 2010/12/31 22:48:48 dankogai Exp $ + $Id: Unicode.xs,v 2.8 2011/08/09 07:49:44 dankogai Exp dankogai $ / #define PERLNOGETCONTEXT @@ -256,7 +256,10 @@ CODE: This prevents allocating too much in the rogue case of a large input consisting initially of long sequence uft8-byte unicode chars followed by single utf8-byte chars. / - STRLEN remaining = (e - s)/usize; + / +1 + fixes Unicode.xs!decodexs n-byte heap-overflow + / + STRLEN remaining = (e - s)/usize + 1; / +1 to avoid the leak / STRLEN maxalloc = remaining + (810241024); STRLEN estalloc = remaining UTF8MAXLEN; STRLEN newlen = SvLEN(result) + / min(maxalloc, estalloc) /
Debian has applied the fix for Perl 5.12 and 5.14 versions (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=637376) so far but recognized the bug in all Perl releases since 5.10.0.
No reproducer or other details are known now. This flaw is public. Non-replied question has been post to perl-ports mailing list (http://permalink.gmane.org/gmane.comp.lang.perl.perl5.porters/98004).
— Red Hat
Affected Software
Remediation
Patch Available
Patch Available
Event History
Frequently Asked Questions
What is the severity of CVE-2011-2939?
CVE-2011-2939 is considered a moderate severity vulnerability due to its potential to cause a denial of service via a memory corruption issue.
How do I fix CVE-2011-2939?
To fix CVE-2011-2939, you should upgrade the Encode module to version 2.44 or later.
Which versions are affected by CVE-2011-2939?
CVE-2011-2939 affects the Encode module versions prior to 2.44 and Perl versions prior to 5.15.6.
What type of vulnerability is CVE-2011-2939?
CVE-2011-2939 is categorized as a heap-based buffer overflow caused by an off-by-one error.
Can CVE-2011-2939 be exploited remotely?
Yes, CVE-2011-2939 can potentially be exploited by context-dependent attackers through specially crafted Unicode strings.