Bug 1114674 (CVE-2018-18311) - VUL-0: CVE-2018-18311: perl: environment overflow
Summary: VUL-0: CVE-2018-18311: perl: environment overflow
Status: RESOLVED FIXED
Alias: CVE-2018-18311
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other Other
: P2 - High : Major
Target Milestone: ---
Assignee: Michael Schröder
QA Contact: Security Team bot
URL: https://smash.suse.de/issue/218664/
Whiteboard: CVSSv3:SUSE:CVE-2018-18311:7.4:(AV:L...
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-05 12:07 UTC by Marcus Meissner
Modified: 2024-07-25 15:16 UTC (History)
5 users (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
0001-Perl_my_setenv-handle-integer-wrap.patch (5.68 KB, patch)
2018-11-05 12:08 UTC, Marcus Meissner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Marcus Meissner 2018-11-05 12:08:05 UTC
Created attachment 788434 [details]
0001-Perl_my_setenv-handle-integer-wrap.patch

0001-Perl_my_setenv-handle-integer-wrap.patch
Comment 2 Marcus Meissner 2018-11-05 12:09:08 UTC
QA REPRODUCER:

perl -e '$inp = "A" x 0x7fffffff; $ENV{$inp} = $inp;'
Comment 3 Marcus Meissner 2018-11-09 07:08:49 UTC
CRD: 2018-11-29
Comment 4 Michael Schröder 2018-11-21 15:15:22 UTC
perl-5.18 seems to be affected. This is VUL-1, so we wait for the next security fix for SLE-12 and older?
Comment 6 Marcus Meissner 2018-11-30 09:50:22 UTC
is public

https://rt.perl.org/Public/Bug/Display.html?id=133204

Bug #133204 for perl5: [CVE-2018-18311] Integer overflow leading to buffer overflow

Hi,


As a part of an academic project, we have discovered an integer overflow in Perl which subsequently leads to a heap overflow.


The vulnerability is present in Perl_my_setenv @ util.c : 2070


2070: void Perl_my_setenv(pTHX_ const char *nam, const char *val) {

...

2166:         const int nlen = strlen(nam);

...

2171:         vlen = strlen(val);

2172:         new_env = (char*)safesysmalloc((nlen + vlen + 2) * sizeof(char));


Here, since the arguments nam and val are user controlled, the 32 bit integers nlen and vlen are also under the control of the attacker. Therefore, if nam and val are two very long strings, the addition at 2172 would result in an integer overflow.


The new_env would therefore be a chunk of a size which is smaller than the sum of the lengths of the two input strings.


This new_env is subsequently used in a call to memcpy to copy nlen bytes from nam and vlen bytes from val.

This results in a buffer overflow on the heap with attacker controlled input.


We have attached a perl script that demonstrates this vulnerability.

Regards
Jayakrishna Menon and Christophe Hauser
Information Sciences Institute
University of Southern California
Comment 7 Swamp Workflow Management 2018-12-19 14:15:07 UTC
SUSE-SU-2018:4187-1: An update that fixes four vulnerabilities is now available.

Category: security (moderate)
Bug References: 1114674,1114675,1114681,1114686
CVE References: CVE-2018-18311,CVE-2018-18312,CVE-2018-18313,CVE-2018-18314
Sources used:
SUSE Linux Enterprise Module for Development Tools 15 (src):    perl-5.26.1-7.6.1
SUSE Linux Enterprise Module for Basesystem 15 (src):    perl-5.26.1-7.6.1
Comment 8 Swamp Workflow Management 2018-12-22 23:11:42 UTC
openSUSE-SU-2018:4258-1: An update that fixes four vulnerabilities is now available.

Category: security (moderate)
Bug References: 1114674,1114675,1114681,1114686
CVE References: CVE-2018-18311,CVE-2018-18312,CVE-2018-18313,CVE-2018-18314
Sources used:
openSUSE Leap 15.0 (src):    perl-5.26.1-lp150.6.6.1
Comment 9 Marcus Meissner 2019-08-19 09:37:42 UTC
I would now like to see a SLE12 perl update for this.

It should probably have been VUL-0 from the beginning.
Comment 12 Swamp Workflow Management 2019-09-02 10:31:26 UTC
SUSE-SU-2019:2264-1: An update that fixes one vulnerability is now available.

Category: security (important)
Bug References: 1114674
CVE References: CVE-2018-18311
Sources used:
SUSE OpenStack Cloud Crowbar 8 (src):    perl-5.18.2-12.20.1
SUSE OpenStack Cloud 8 (src):    perl-5.18.2-12.20.1
SUSE OpenStack Cloud 7 (src):    perl-5.18.2-12.20.1
SUSE Linux Enterprise Server for SAP 12-SP3 (src):    perl-5.18.2-12.20.1
SUSE Linux Enterprise Server for SAP 12-SP2 (src):    perl-5.18.2-12.20.1
SUSE Linux Enterprise Server for SAP 12-SP1 (src):    perl-5.18.2-12.20.1
SUSE Linux Enterprise Server 12-SP5 (src):    perl-5.18.2-12.20.1
SUSE Linux Enterprise Server 12-SP4 (src):    perl-5.18.2-12.20.1
SUSE Linux Enterprise Server 12-SP3-LTSS (src):    perl-5.18.2-12.20.1
SUSE Linux Enterprise Server 12-SP3-BCL (src):    perl-5.18.2-12.20.1
SUSE Linux Enterprise Server 12-SP2-LTSS (src):    perl-5.18.2-12.20.1
SUSE Linux Enterprise Server 12-SP2-BCL (src):    perl-5.18.2-12.20.1
SUSE Linux Enterprise Server 12-SP1-LTSS (src):    perl-5.18.2-12.20.1
SUSE Linux Enterprise Desktop 12-SP5 (src):    perl-5.18.2-12.20.1
SUSE Linux Enterprise Desktop 12-SP4 (src):    perl-5.18.2-12.20.1
SUSE Enterprise Storage 5 (src):    perl-5.18.2-12.20.1
SUSE Enterprise Storage 4 (src):    perl-5.18.2-12.20.1
SUSE CaaS Platform 3.0 (src):    perl-5.18.2-12.20.1
HPE Helion Openstack 8 (src):    perl-5.18.2-12.20.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.