-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

===========================================================================
             AUSCERT External Security Bulletin Redistribution

                               ESB-2021.1816
               Shibboleth Service Provider Security Advisory
                                27 May 2021

===========================================================================

        AusCERT Security Bulletin Summary
        ---------------------------------

Product:           Shibboleth SP
Publisher:         Shibboleth
Operating System:  Windows
                   UNIX variants (UNIX, Linux, OSX)
Impact/Access:     Execute Arbitrary Code/Commands -- Remote/Unauthenticated
                   Denial of Service               -- Remote/Unauthenticated
Resolution:        Patch/Upgrade
CVE Names:         CVE-2021-22901  

Original Bulletin: 
   https://curl.se/docs/CVE-2021-22901.html

- --------------------------BEGIN INCLUDED TEXT--------------------

TLS session caching disaster

Project curl Security Advisory, May 26th 2021 - Permalink

VULNERABILITY

libcurl can be tricked into using already freed memory when a new TLS session
is negotiated or a client certificate is requested on an existing connection.
For example, this can happen when a TLS server requests a client certificate on
a connection that was established without one. A malicious server can use this
in rare unfortunate circumstances to potentially reach remote code execution in
the client.

OpenSSL can declare a "new session" for different reasons, including the
initial TLS handshake completion, TLS 1.2 (or earlier) renegotiation, or TLS
1.3 client certificate requests. When libcurl at run-time sets up support for
session ID caching on a connection using OpenSSL, it stores pointers to the
transfer in-memory object for later retrieval when OpenSSL considers a new
session to be established.

However, if the connection is used by multiple transfers (like with a reused
HTTP/1.1 connection or multiplexed HTTP/2 connection) that first transfer
object might be freed before the new session is established on that connection
and then the function will access a memory buffer that might be freed. When
using that memory, libcurl might even call a function pointer in the object,
making it possible for a remote code execution if the server could somehow
manage to get crafted memory content into the correct place in memory.

We are not aware of any exploit of this flaw.

INFO

The flaw can only happen in libcurl built to use OpenSSL (or one of its forks).

This flaw has existed in curl since commit a304051620b92 in libcurl 7.75.0,
released on February 3, 2021.

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

CWE-416: Use After Free

Severity: High

Steps to remote code execution

 1. libcurl built to use OpenSSL (BoringSSL and libressl work the same)

 2. A multi interface using application

 3. One of the following:

  o create and use a first easy handle to do HTTP/1.1 over TLS to a malicious
    server

  o free that easy handle with curl_easy_cleanup()

  o create and use a second easy handle to do HTTP/1.1 over TLS with to the
    same server such that the TLS connection is reused

    or

  o more than one concurrent easy handle created that do HTTP/2 over a TLS
    connection to a malicious server,

  o the first easy handle to use the connection must be freed with
    curl_easy_cleanup()

  o at least one easy handle remaining in use of the same connection

 4. The attacking server needs to figure out heap address details in order to
    know what payload contents to provide

 5. The necessary exact memory address in the heap gets populated by memory
    contents controlled by the server

 6. The attacker starts a new handshake (on TLS 1.2 or earlier), or sends a TLS
    1.3 client certificate request, or otherwise triggers OpenSSL to consider a
    new session to be established

For a remote code execution, the client needs to perform (potentially many)
more transfers (and thus have more easy handles) to allow the server to place
crafted contents into heap memory. Instead of remote code execution, the client
could instead crash or otherwise experience undefined behaviour.

AFFECTED VERSIONS

  o Affected versions: curl 7.75.0 to and including 7.76.1
  o Not affected versions: curl < 7.75.0 and curl >= 7.77.0

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

THE SOLUTION

When the transfer is detached from the connection, it clears the association to
it from the session ID cache logic.

A fix for CVE-2021-22901

RECOMMENDATIONS

A - Upgrade curl to version 7.77.0

B - Apply the patch to your local version

C - Build libcurl to use another TLS backend

TIMELINE

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

This advisory was posted on May 26, 2021.

CREDITS

This issue was reported by Harry Sintonen. Patched by Harry Sintonen and Daniel
Stenberg. Help and research by Brad Spencer.

Thanks a lot!

- --------------------------END INCLUDED TEXT--------------------

You have received this e-mail bulletin as a result of your organisation's
registration with AusCERT. The mailing list you are subscribed to is
maintained within your organisation, so if you do not wish to continue
receiving these bulletins you should contact your local IT manager. If
you do not know who that is, please send an email to auscert@auscert.org.au
and we will forward your request to the appropriate person.

NOTE: Third Party Rights
This security bulletin is provided as a service to AusCERT's members.  As
AusCERT did not write the document quoted above, AusCERT has had no control
over its content. The decision to follow or act on information or advice
contained in this security bulletin is the responsibility of each user or
organisation, and should be considered in accordance with your organisation's
site policies and procedures. AusCERT takes no responsibility for consequences
which may arise from following or acting on information or advice contained in
this security bulletin.

NOTE: This is only the original release of the security bulletin.  It may
not be updated when updates to the original are made.  If downloading at
a later date, it is recommended that the bulletin is retrieved directly
from the author's website to ensure that the information is still current.

Contact information for the authors of the original document is included
in the Security Bulletin above.  If you have any questions or need further
information, please contact them directly.

Previous advisories and external security bulletins can be retrieved from:

        https://www.auscert.org.au/bulletins/

===========================================================================
Australian Computer Emergency Response Team
The University of Queensland
Brisbane
Qld 4072

Internet Email: auscert@auscert.org.au
Facsimile:      (07) 3365 7031
Telephone:      (07) 3365 4417 (International: +61 7 3365 4417)
                AusCERT personnel answer during Queensland business hours
                which are GMT+10:00 (AEST).
                On call after hours for member emergencies only.
===========================================================================
-----BEGIN PGP SIGNATURE-----
Comment: http://www.auscert.org.au/render.html?it=1967

iQIVAwUBYK8DIeNLKJtyKPYoAQg6qQ//bv6wiRatlPLPJQG7lMTPHgDL5WIqOvcO
2//8S+6jrtVqWV6jkx+N0mkCVyLOHDdFuK9ao1gnWvakpIjYb9C0CfZFT+Ng31gD
d47eRvGO9lNu84gicaJVWoWUAZCKcg2X1uFboDYY2Q8h/EpLpQAR57koNFoo0jCx
xfbpj2r3TIcNOOFyAZKZ7m0AI5+NNY80rWClz4v4Ann0hcH3djinoaAxg0fzjso3
Vsih4xzL/68ZCghJ3Mk4HO2Lzi1UrQXg30y+lLLn02yIeGrC8q1IcRuq6HZBOXMr
oJAzl146J+FHbkl9XbiK2ta4okll8zuT6M01JjE/pejKfzi5cRdoxR5Le9ZWpP/+
EV1MjYNTqILD3kV5KnmW8/bIuaysY4dOCzjJoBukAszkjrsLQlemdUW/A/an+SBD
c5fmS8K7mpFoCuzavq4qLT/3o4B8EvxOrTFRyPbJJe5jFdP3VKSUyeOEjy0y8ERp
ucziZq9J6HQXU/0djyyLykRBc4Nebvh27Cgz4Y9a7LvFZ4Qf/myzWYiQPvpt1QS9
6HA2h2YTumGlilMmlsGNbjaoklxGNIlOgmxUujxy8B4k8wmhQfoj/JX/ekzMnCOD
0jQdIx5d0IVUASKccLZITCskCPhzvhtGTDjL2nvKrOijizGUATF9EUwjx/N1cIj7
dstnOnh5Htg=
=eaTa
-----END PGP SIGNATURE-----