Bug 743010 - (CVE-2011-3597) CVE-2011-3597 Perl Digest improper control of generation of code
CVE-2011-3597 Perl Digest improper control of generation of code
Status: CLOSED ERRATA
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
medium Severity medium
: ---
: ---
Assigned To: Red Hat Product Security
impact=moderate,public=20111002,repor...
: Security
Depends On: 743058 743092 743093 743094 743095 743096
Blocks: 743013
  Show dependency treegraph
 
Reported: 2011-10-03 11:13 EDT by Vincent Danen
Modified: 2011-12-08 17:01 EST (History)
18 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-12-08 17:01:20 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


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


External Trackers
Tracker ID Priority Status Summary Last Updated
CPAN 71390 None None None Never

  None (edit)
Description Vincent Danen 2011-10-03 11:13:18 EDT
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 11:19:06 EDT
If we go with AC:H, then CVSSv2 drops to 5.1 (and moderate impact).
Comment 2 Vincent Danen 2011-10-03 13:51:36 EDT
Created perl tracking bugs for this issue

Affects: fedora-all [bug 743058]
Comment 3 Ramon de C Valle 2011-10-03 15:07:27 EDT
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 05:41:59 EDT
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 06:07:31 EDT
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 09:11:13 EDT
Created attachment 526246 [details]
Fix for Perl 5.14.2
Comment 8 Fedora Update System 2011-10-24 19:03:24 EDT
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-24 23:40:07 EDT
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-02 20:22:38 EDT
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 16:48:11 EDT
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 14:06:23 EST
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.