Skip to content
Heist/ feed
Back to feed
High

TLS session caching disaster

Type: advisorySources: OSV

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 runtime 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 accesses 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.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2021-22901
Confirmed fixed CVEs
Not specified
Updated in this feed
1 Nov 2026, 09:37 UTC · Revision 1

Source evidence

TLS session caching disaster

core-osv · Original source

Published 26 May 2021, 08:00 UTC

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 runtime 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 accesses 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.

osv:CURL-CVE-2021-22901
Complete source record
{
  "id": "a1018838015bf26a1bdcb59e0428ebe51fe492893e112a1df96706ece5394d6f",
  "url": "https://osv.dev/vulnerability/CURL-CVE-2021-22901",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "TLS session caching disaster",
    "summary": "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 runtime 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 accesses 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.",
    "evidence": "osv:CURL-CVE-2021-22901",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CURL-CVE-2021-22901",
      "aliases": [
        "CURL-CVE-2021-22901",
        "CVE-2021-22901"
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "SEMVER",
              "events": [
                {
                  "introduced": "7.75.0"
                },
                {
                  "fixed": "7.77.0"
                }
              ]
            },
            {
              "repo": "https://github.com/curl/curl.git",
              "type": "GIT",
              "events": [
                {
                  "introduced": "a304051620b92e12b6b1b4e19edc57b34ea332b6"
                },
                {
                  "fixed": "7f4a9a9b2a49547eae24d2e19bc5c346e9026479"
                }
              ]
            }
          ],
          "versions": [
            "7.76.1",
            "7.76.0",
            "7.75.0",
            "curl-7_76_1",
            "curl-7_76_0",
            "curl-7_75_0"
          ],
          "database_specific": {
            "source": "https://curl.se/docs/CURL-CVE-2021-22901.json",
            "vanir_signatures": [
              {
                "id": "CURL-CVE-2021-22901-0fc1a770",
                "digest": {
                  "length": 159,
                  "function_hash": "282527232010509207256326083520762769034"
                },
                "source": "https://github.com/curl/curl.git/commit/7f4a9a9b2a49547eae24d2e19bc5c346e9026479",
                "target": {
                  "file": "lib/multi.c",
                  "function": "Curl_detach_connnection"
                },
                "deprecated": false,
                "signature_type": "Function",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2021-22901-198d8964",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "222480428048420087676105947998287034698",
                    "1791862209004315891931085883200233347",
                    "335032092301468568357198521291765970795",
                    "163498262204948760416787486037998488372",
                    "86790545262539225571869431646476558833",
                    "102446219944222485332424481391822647475",
                    "301150589919494327216392615030845277105"
                  ]
                },
                "source": "https://github.com/curl/curl.git/commit/7f4a9a9b2a49547eae24d2e19bc5c346e9026479",
                "target": {
                  "file": "lib/vtls/schannel.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2021-22901-1cb97904",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "186219220524685466747730293319960369262",
                    "221885776772179948375588984335771599016",
                    "331942912995982428602909187462272364537"
                  ]
                },
                "source": "https://github.com/curl/curl.git/commit/7f4a9a9b2a49547eae24d2e19bc5c346e9026479",
                "target": {
                  "file": "lib/vtls/rustls.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2021-22901-2c9a09fe",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "117254624900286043914446684036232897839",
                    "278148543623425240728153472164075251212",
                    "313428367765666149420051287200382297935"
                  ]
                },
                "source": "https://github.com/curl/curl.git/commit/7f4a9a9b2a49547eae24d2e19bc5c346e9026479",
                "target": {
                  "file": "lib/vtls/gtls.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2021-22901-2cff4856",
                "digest": {
                  "length": 14664,
                  "function_hash": "308421803234990224094444390237334411602"
                },
                "source": "https://github.com/curl/curl.git/commit/7f4a9a9b2a49547eae24d2e19bc5c346e9026479",
                "target": {
                  "file": "lib/vtls/openssl.c",
                  "function": "ossl_connect_step1"
                },
                "deprecated": false,
                "signature_type": "Function",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2021-22901-54d606e4",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "155031123524163536542363547886908076616",
                    "241564592740147399037087761500264710056",
                    "224236323127553732321566263121395653926"
                  ]
                },
                "source": "https://github.com/curl/curl.git/commit/7f4a9a9b2a49547eae24d2e19bc5c346e9026479",
                "target": {
                  "file": "lib/vtls/mbedtls.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2021-22901-5846c4df",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "105711553773464346414647333756716138062",
                    "2904185772424648690614208022438633360",
                    "28943486962530006695741710418216306715"
                  ]
                },
                "source": "https://github.com/curl/curl.git/commit/7f4a9a9b2a49547eae24d2e19bc5c346e9026479",
                "target": {
                  "file": "lib/vtls/wolfssl.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2021-22901-7261e1dc",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "89438604099976147155922991379116780231",
                    "152200389674360309942177538872971541530",
                    "36458605533992043066698451277391902613"
                  ]
                },
                "source": "https://github.com/curl/curl.git/commit/7f4a9a9b2a49547eae24d2e19bc5c346e9026479",
                "target": {
                  "file": "lib/vtls/nss.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2021-22901-8a0bd020",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "93612680191468065498685381231912631392",
                    "172816224077672263565079124615633457341",
                    "316884559720800204945935234868905210031",
                    "293326983079720454113692492174647385498"
                  ]
                },
                "source": "https://github.com/curl/curl.git/commit/7f4a9a9b2a49547eae24d2e19bc5c346e9026479",
                "target": {
                  "file": "lib/vtls/sectransp.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2021-22901-a4ea2d7c",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "187473753366580240819143889369803023555",
                    "19947501796357691300854331411987220613",
                    "95654700292215788056874075044093236670",
                    "54945258926373500052511413367380796929",
                    "50910872226802818269537850369166031572",
                    "58240838674613881414058697592076492097",
                    "327008296953905714942243329393832476807",
                    "167690107269592290756581100018194607341",
                    "163502143684354781220170101016683290242"
                  ]
                },
                "source": "https://github.com/curl/curl.git/commit/7f4a9a9b2a49547eae24d2e19bc5c346e9026479",
                "target": {
                  "file": "lib/multi.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2021-22901-bfbf9dfc",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "220881515393441035084801830498670033932",
                    "174542894043304738129105816634116784620",
                    "783098884639603181500321915206659113",
                    "186219220524685466747730293319960369262",
                    "221885776772179948375588984335771599016",
                    "72703555703531540869677605507512220101",
                    "227890448358690435620343229236177822739"
                  ]
                },
                "source": "https://github.com/curl/curl.git/commit/7f4a9a9b2a49547eae24d2e19bc5c346e9026479",
                "target": {
                  "file": "lib/vtls/vtls.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2021-22901-caa43d76",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "17479791198913112085959967000244748158",
                    "122978703432319367585527440563987283441",
                    "108255278866082812394702543602527323182",
                    "63147417521427190620024285144529305281",
                    "281873735472492112698195639167232268211",
                    "274123850254446799268534801426234867900",
                    "83722995015177457113170279222513998005"
                  ]
                },
                "source": "https://github.com/curl/curl.git/commit/7f4a9a9b2a49547eae24d2e19bc5c346e9026479",
                "target": {
                  "file": "lib/vtls/vtls.h"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2021-22901-d29534ad",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "186219220524685466747730293319960369262",
                    "221885776772179948375588984335771599016",
                    "118420185482035953781785408918051443343"
                  ]
                },
                "source": "https://github.com/curl/curl.git/commit/7f4a9a9b2a49547eae24d2e19bc5c346e9026479",
                "target": {
                  "file": "lib/vtls/mesalink.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2021-22901-d4273870",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "73271168870267222109289255326453829008",
                    "73827907696276383707622611301589291798",
                    "211530242407209078484329373388314723108",
                    "188779164379214942689248499697233465740",
                    "85386975455582097309536242192917050731",
                    "245081344340155641301320834143844850881",
                    "62153286337341876067281988598850343391",
                    "121669162297169078699046718566740458729",
                    "215298610020151475422509359025881665450",
                    "160496096879707273982560064615393928037",
                    "262253162330575483615990927020006884742",
                    "207030032140940270196392569482197400507",
                    "52196972406707744499516007337590729723",
                    "310848303797566296324889670751101086331",
                    "222593396967390567450172725704753887575",
                    "235691541654497677847954641653469180817",
                    "58633988980821724765059247018395199889",
                    "25447831337023957638041419169130371823",
                    "147075429205132582405216565002123595763",
                    "159239750700783782352173299703698057266",
                    "3437427716754797935132463652839023737",
                    "127087658280103561645782008847134409151",
                    "75199286429243154010508244248962936561",
                    "244921248497977065595362047332805878839",
                    "335526394393619798921303958949091926921",
                    "142148865309299820369778016046747186849",
                    "36343027810611685258758416187132301997",
                    "145703898883617860025281749174947940817",
                    "49821058802725643425531673427781409057",
                    "49678742140860501719462917258286975569",
                    "63202482301952805327802201198622534649",
                    "293181921711569263243064672048373818969",
                    "133900923489114446296021898851185466508",
                    "36777361632708934694797056998674843243",
                    "11177419630060475881010668020085817087",
                    "303422892470415582204293820830754579527",
                    "286083972253237306490318597426997081139",
                    "261079382685828178432555473902036016734",
                    "279260391187534534676049212163993726371",
                    "329627646565725648632430807782727645922",
                    "79194766196837938283253745097174225478",
                    "5571743488213546801408132267818404860",
                    "130049941606887403578626904489921224945",
                    "178097734931733945871273233063040427391",
                    "216425396822114078519857436547106591880",
                    "285542075915533030311331310894582100597",
                    "181108455092571060169513480302647763308",
                    "201208934546635710539200215230233609237",
                    "13409051224758349761312328379615738889",
                    "299473193568500530537773344539589740788",
                    "152017765307026313653490870096797999253"
                  ]
                },
                "source": "https://github.com/curl/curl.git/commit/7f4a9a9b2a49547eae24d2e19bc5c346e9026479",
                "target": {
                  "file": "lib/vtls/openssl.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2021-22901-ee0f4a17",
                "digest": {
                  "length": 299,
                  "function_hash": "276203671696876119948010549383366377839"
                },
                "source": "https://github.com/curl/curl.git/commit/7f4a9a9b2a49547eae24d2e19bc5c346e9026479",
                "target": {
                  "file": "lib/multi.c",
                  "function": "Curl_attach_connnection"
                },
                "deprecated": false,
                "signature_type": "Function",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2021-22901-f92d7b8e",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "186219220524685466747730293319960369262",
                    "221885776772179948375588984335771599016",
                    "242092821167957799341998848306994961622"
                  ]
                },
                "source": "https://github.com/curl/curl.git/commit/7f4a9a9b2a49547eae24d2e19bc5c346e9026479",
                "target": {
                  "file": "lib/vtls/gskit.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              }
            ],
            "vanir_signatures_modified": "2026-10-25T01:04:44Z"
          }
        }
      ],
      "modified": "2026-10-25T01:04:44.135970851Z",
      "provider": "osv",
      "references": [],
      "provider_metadata": {
        "CWE": {
          "id": "CWE-416",
          "desc": "Use After Free"
        },
        "URL": "https://curl.se/docs/CVE-2021-22901.json",
        "www": "https://curl.se/docs/CVE-2021-22901.html",
        "award": {
          "amount": "2000",
          "currency": "USD"
        },
        "issue": "https://hackerone.com/reports/1180380",
        "affects": "both",
        "package": "curl",
        "severity": "High",
        "last_affected": "7.76.1"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2021-22901",
        "evidence": "/aliases"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/database_specific/severity"
  },
  "source_id": "core-osv",
  "document_id": 444283,
  "published_at": "2021-05-26T08:00:00+00:00"
}