Bug 743010 (CVE-2011-3597) - CVE-2011-3597 Perl Digest improper control of generation of code
Summary: CVE-2011-3597 Perl Digest improper control of generation of code
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2011-3597
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: 743058 743092 743093 743094 743095 743096
Blocks: 743013
TreeView+ depends on / blocked
 
Reported: 2011-10-03 15:13 UTC by Vincent Danen
Modified: 2019-09-29 12:48 UTC (History)
18 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-08 22:01:20 UTC
Embargoed:


Attachments (Terms of Use)
Fix for Perl 5.14.2 (843 bytes, patch)
2011-10-04 13:11 UTC, Petr Pisar
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
CPAN 71390 0 None None None Never
Red Hat Product Errata RHSA-2011:1424 0 normal SHIPPED_LIVE Moderate: perl security update 2011-11-04 00:47:59 UTC
Red Hat Product Errata RHSA-2011:1797 0 normal SHIPPED_LIVE Moderate: perl security update 2011-12-09 00:04:00 UTC

Description Vincent Danen 2011-10-03 15:13:18 UTC
A flaw was reported [1] in perl Digest module's "Digest->new()" function, which did not properly sanitize input before using it in an eval() call, which could possibly be exploited to inject and execute arbitrary perl code.

The flaw is fixed in version 1.17 [2] and affects at least as far back as perl 5.8.5.

The following patch will correct the flaw (selectively taken from upstream's 1.16->1.17 differences):

--- Digest.pm.org       2011-10-03 09:10:29.019681252 -0600
+++ Digest.pm   2011-10-03 09:11:18.630250656 -0600
@@ -35,7 +35,9 @@ sub new
        ($class, @args) = @$class if ref($class);
        no strict 'refs';
        unless (exists ${"$class\::"}{"VERSION"}) {
-           eval "require $class";
+           my $pm_file = $class . ".pm";
+           $pm_file =~ s{::}{/}g;
+           eval { require $pm_file };
            if ($@) {
                $err ||= $@;
                next;

[1] https://secunia.com/advisories/46279/
[2] http://cpansearch.perl.org/src/GAAS/Digest-1.17/Changes

Comment 1 Vincent Danen 2011-10-03 15:19:06 UTC
If we go with AC:H, then CVSSv2 drops to 5.1 (and moderate impact).

Comment 2 Vincent Danen 2011-10-03 17:51:36 UTC
Created perl tracking bugs for this issue

Affects: fedora-all [bug 743058]

Comment 3 Ramon de C Valle 2011-10-03 19:07:27 UTC
To successfully exploit this vulnerability, the attacker must already be able to execute Perl code or be able to set the algorithm name to be used by the constructor in the form "$ctx = Digest->new(XXX => $arg,...)", which is very unlikely to happen.

For additional information, refer to:
http://perldoc.perl.org/Digest.html

Comment 5 Petr Pisar 2011-10-04 09:41:59 UTC
The code in comment #3 assumes attacker can insert his own Digest::XXX module into Perl search path which itself is more serious problem.

Original test case in CPAN RT (https://rt.cpan.org/Public/Bug/Display.html?id=71390#txn-983600) does not need such privilege.

Comment 6 Tomas Hoger 2011-10-04 10:07:31 UTC
This can be triggered when deserializing specially-crafted input using Data::Serializer.  Not sure if that actually makes any real difference.  In several serialization frameworks, it is assumed you should not deserialize any untrusted input, as that can lead to code execution.  Data::Serializer documentation does not seem to mention that in any way.

Comment 7 Petr Pisar 2011-10-04 13:11:13 UTC
Created attachment 526246 [details]
Fix for Perl 5.14.2

Comment 8 Fedora Update System 2011-10-24 23:03:24 UTC
perl-5.12.4-162.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2011-10-25 03:40:07 UTC
perl-5.14.1-188.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2011-11-03 00:22:38 UTC
perl-5.12.4-147.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 errata-xmlrpc 2011-11-03 20:48:11 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 6

Via RHSA-2011:1424 https://rhn.redhat.com/errata/RHSA-2011-1424.html

Comment 12 errata-xmlrpc 2011-12-08 19:06:23 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 4
  Red Hat Enterprise Linux 5

Via RHSA-2011:1797 https://rhn.redhat.com/errata/RHSA-2011-1797.html


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