Bug 1186114 (CVE-2021-22898)

Summary: VUL-0: CVE-2021-22898: curl: TELNET stack contents disclosure (1/2)
Product: [Novell Products] SUSE Security Incidents Reporter: Robert Frohl <rfrohl>
Component: IncidentsAssignee: Security Team bot <security-team>
Status: RESOLVED FIXED QA Contact: Security Team bot <security-team>
Severity: Normal    
Priority: P3 - Medium CC: abergmann, hhetter, meissner, pmonrealgonzalez
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: Other   
URL: https://smash.suse.de/issue/284454/
Whiteboard: CVSSv3.1:SUSE:CVE-2021-22898:5.3:(AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N)
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Comment 12 Marcus Meissner 2021-05-26 07:44:02 UTC
public via oss-sec

TELNET stack contents disclosure
================================

Project curl Security Advisory, May 26th 2021 -
[Permalink](https://curl.se/docs/CVE-2021-22898.html)

VULNERABILITY
-------------

curl supports the `-t` command line option, known as `CURLOPT_TELNETOPTIONS`
in libcurl. This rarely used option is used to send variable=content pairs to
TELNET servers.

Due to flaw in the option parser for sending `NEW_ENV` variables, libcurl
could be made to pass on uninitialized data from a stack based buffer to the
server. Therefore potentially revealing sensitive internal information to the
server using a clear-text network protocol.

This could happen because curl did not check the return code from a
`sscanf(command, "%127[^,],%127s")` function invoke correctly, and would leave
the piece of the send buffer uninitialized for the value part if it was
provided longer than 127 bytes. The buffer used for this is 2048 bytes big and
the *variable* part of the *variable=content* pairs would be stored correctly
in the send buffer, making curl sending "interleaved" bytes sequences of stack
contents. A single curl TELNET handshake could then be made to send off a
total of around 1800 bytes of (non-contiguous) stack contents in this style:

     [control byte]name[control byte]
     stack contents
     [control byte]name[control byte]
     stack contents
     ...

An easy proof of concept command line looks like this:

     curl telnet://example.com -tNEW_ENV=a,bbbbbb (256 'b's)

We are not aware of any exploit of this flaw.

INFO
----

This flaw has existed in curl since commit
[a1d6ad2610](https://github.com/curl/curl/commit/a1d6ad2610) in libcurl 7.7,
released on March 22, 2001.

The Common Vulnerabilities and Exposures (CVE) project has assigned the name
CVE-2021-22898 to this issue.

CWE-457: Use of Uninitialized Variable

Severity: Medium

AFFECTED VERSIONS
-----------------

- Affected versions: curl 7.7 to and including 7.76.1
- Not affected versions: curl < 7.7 and curl >= 7.77.0

Also note that libcurl is used by many applications, and not always advertised
as such.

THE SOLUTION
------------

Use sscanf() properly and only use properly filled-in buffers.

A [fix for CVE-2021-22898](https://github.com/curl/curl/commit/39ce47f219b09c380b81f89fe54ac586c8db6bde)

RECOMMENDATIONS
--------------

  A - Upgrade curl to version 7.77.0

  B - Apply the patch to your local version

  C - Avoid using `CURLOPT_TELNETOPTIONS`

TIMELINE
--------

This issue was reported to the curl project on April 27, 2021.

This advisory was posted on May 26, 2021.

CREDITS
-------

This issue was reported and patched by Harry Sintonen.

Thanks a lot!

-- 

  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://www.wolfssl.com/contact/
Comment 13 Pedro Monreal Gonzalez 2021-05-26 08:57:03 UTC
Curl update to 7.77.0, submitted here:
   https://build.opensuse.org/request/show/895500
Comment 15 Swamp Workflow Management 2021-05-26 16:19:46 UTC
SUSE-SU-2021:1763-1: An update that fixes one vulnerability, contains one feature is now available.

Category: security (moderate)
Bug References: 1186114
CVE References: CVE-2021-22898
JIRA References: SLE-17954
Sources used:
SUSE Linux Enterprise Software Development Kit 12-SP5 (src):    curl-7.60.0-11.18.1
SUSE Linux Enterprise Server 12-SP5 (src):    curl-7.60.0-11.18.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.
Comment 16 Swamp Workflow Management 2021-05-26 16:20:50 UTC
SUSE-SU-2021:14735-1: An update that fixes one vulnerability is now available.

Category: security (moderate)
Bug References: 1186114
CVE References: CVE-2021-22898
JIRA References: 
Sources used:
SUSE Linux Enterprise Server 11-SECURITY (src):    curl-openssl1-7.37.0-70.63.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.
Comment 17 Swamp Workflow Management 2021-05-26 16:23:07 UTC
SUSE-SU-2021:1762-1: An update that fixes one vulnerability, contains one feature is now available.

Category: security (moderate)
Bug References: 1186114
CVE References: CVE-2021-22898
JIRA References: SLE-17956
Sources used:
SUSE MicroOS 5.0 (src):    curl-7.66.0-4.17.1
SUSE Linux Enterprise Module for Basesystem 15-SP3 (src):    curl-7.66.0-4.17.1
SUSE Linux Enterprise Module for Basesystem 15-SP2 (src):    curl-7.66.0-4.17.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.
Comment 18 Swamp Workflow Management 2021-05-27 19:29:30 UTC
SUSE-SU-2021:1786-1: An update that solves 6 vulnerabilities and has one errata is now available.

Category: security (moderate)
Bug References: 1175109,1177976,1179398,1179399,1179593,1183933,1186114
CVE References: CVE-2020-8231,CVE-2020-8284,CVE-2020-8285,CVE-2020-8286,CVE-2021-22876,CVE-2021-22898
JIRA References: 
Sources used:
SUSE OpenStack Cloud Crowbar 9 (src):    curl-7.60.0-4.20.1
SUSE OpenStack Cloud 9 (src):    curl-7.60.0-4.20.1
SUSE Linux Enterprise Server for SAP 12-SP4 (src):    curl-7.60.0-4.20.1
SUSE Linux Enterprise Server 12-SP4-LTSS (src):    curl-7.60.0-4.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.
Comment 19 Swamp Workflow Management 2021-05-29 19:15:51 UTC
openSUSE-SU-2021:0808-1: An update that fixes one vulnerability, contains one feature is now available.

Category: security (moderate)
Bug References: 1186114
CVE References: CVE-2021-22898
JIRA References: SLE-17956
Sources used:
openSUSE Leap 15.2 (src):    curl-7.66.0-lp152.3.18.1, curl-mini-7.66.0-lp152.3.18.1
Comment 20 Swamp Workflow Management 2021-05-31 19:16:29 UTC
SUSE-SU-2021:1809-1: An update that solves two vulnerabilities, contains one feature and has one errata is now available.

Category: security (moderate)
Bug References: 1177976,1183933,1186114
CVE References: CVE-2021-22876,CVE-2021-22898
JIRA References: SLE-13843
Sources used:
SUSE Manager Server 4.0 (src):    curl-7.60.0-3.42.1
SUSE Manager Retail Branch Server 4.0 (src):    curl-7.60.0-3.42.1
SUSE Manager Proxy 4.0 (src):    curl-7.60.0-3.42.1
SUSE Linux Enterprise Server for SAP 15-SP1 (src):    curl-7.60.0-3.42.1
SUSE Linux Enterprise Server for SAP 15 (src):    curl-7.60.0-3.42.1
SUSE Linux Enterprise Server 15-SP1-LTSS (src):    curl-7.60.0-3.42.1
SUSE Linux Enterprise Server 15-SP1-BCL (src):    curl-7.60.0-3.42.1
SUSE Linux Enterprise Server 15-LTSS (src):    curl-7.60.0-3.42.1
SUSE Linux Enterprise High Performance Computing 15-SP1-LTSS (src):    curl-7.60.0-3.42.1
SUSE Linux Enterprise High Performance Computing 15-SP1-ESPOS (src):    curl-7.60.0-3.42.1
SUSE Linux Enterprise High Performance Computing 15-LTSS (src):    curl-7.60.0-3.42.1
SUSE Linux Enterprise High Performance Computing 15-ESPOS (src):    curl-7.60.0-3.42.1
SUSE Enterprise Storage 6 (src):    curl-7.60.0-3.42.1
SUSE CaaS Platform 4.0 (src):    curl-7.60.0-3.42.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.
Comment 24 Swamp Workflow Management 2021-06-30 19:22:38 UTC
SUSE-SU-2021:14760-1: An update that fixes one vulnerability is now available.

Category: security (moderate)
Bug References: 1186114
CVE References: CVE-2021-22898
JIRA References: 
Sources used:
SUSE Linux Enterprise Server 11-SP4-LTSS (src):    curl-7.37.0-70.66.1
SUSE Linux Enterprise Server 11-SECURITY (src):    curl-openssl1-7.37.0-70.66.1
SUSE Linux Enterprise Point of Sale 11-SP3 (src):    curl-7.37.0-70.66.1
SUSE Linux Enterprise Debuginfo 11-SP4 (src):    curl-7.37.0-70.66.1
SUSE Linux Enterprise Debuginfo 11-SP3 (src):    curl-7.37.0-70.66.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.
Comment 25 Swamp Workflow Management 2021-07-10 23:20:06 UTC
openSUSE-SU-2021:1762-1: An update that fixes one vulnerability, contains one feature is now available.

Category: security (moderate)
Bug References: 1186114
CVE References: CVE-2021-22898
JIRA References: SLE-17956
Sources used:
openSUSE Leap 15.3 (src):    curl-7.66.0-4.17.1, curl-mini-7.66.0-4.17.1
Comment 26 Marcus Meissner 2021-08-05 13:24:36 UTC
done