[TLS] Re: Security Concern in TLS 1.3 and OpenSSL Implementation

Muhammad Usama Sardar <muhammad_usama.sardar@tu-dresden.de> Tue, 18 November 2025 09:43 UTC

Return-Path: <muhammad_usama.sardar@tu-dresden.de>
X-Original-To: tls@mail2.ietf.org
Delivered-To: tls@mail2.ietf.org
Received: from localhost (localhost [127.0.0.1]) by mail2.ietf.org (Postfix) with ESMTP id 7C4C98BA022B for <tls@mail2.ietf.org>; Tue, 18 Nov 2025 01:43:59 -0800 (PST)
X-Virus-Scanned: amavisd-new at ietf.org
X-Spam-Flag: NO
X-Spam-Score: -4.397
X-Spam-Level:
X-Spam-Status: No, score=-4.397 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: mail2.ietf.org (amavisd-new); dkim=pass (2048-bit key) header.d=tu-dresden.de
Received: from mail2.ietf.org ([166.84.6.31]) by localhost (mail2.ietf.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id H2cQNq9-aiDs for <tls@mail2.ietf.org>; Tue, 18 Nov 2025 01:43:58 -0800 (PST)
Received: from mailout3.zih.tu-dresden.de (mailout3.zih.tu-dresden.de [141.30.67.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail2.ietf.org (Postfix) with ESMTPS id EA5DA8BA0221 for <tls@ietf.org>; Tue, 18 Nov 2025 01:43:57 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tu-dresden.de; s=dkim2022; h=Content-Type:In-Reply-To:From:References:CC:To :Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YLpm/4NYdV9dlWfdVQ1fVvtJD7/Ou6HgUfXvSc1gg/8=; b=Sjfnfgc0PAxFxJXSICpOQN/ske nDlTsPnxpn4/xg+5pbyV/KV+Bckk2yiCg2kbuTiYXr6SGsVT5Hv7ABPhlZqILcDpmy8Xz7lt/LByw up/VWzsxlKkawz25w/svr53PDKHJhRhkz6pEAcvJnWHRcQ9D/TydNxfSiS4wYvSGUjDe2zOW5etoc XjVhcN5mig6D6/QmtT3dzYlcDPDbV3c1f2YjawJ7mQ/k4PjbWv9g9//gCwQfxJatvEumYKhoEsOP0 teJRURKazMLRhFzItube23mRcnV+JpPloMMLihAlngSlPEE2U+ExRudxuq0+78trVR0TKszlUMmpx vULB8lRA==;
Received: from msx-t422.msx.ad.zih.tu-dresden.de ([172.26.35.139] helo=msx.tu-dresden.de) by mailout3.zih.tu-dresden.de with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from <muhammad_usama.sardar@tu-dresden.de>) id 1vLIFg-006YPe-6N; Tue, 18 Nov 2025 10:43:56 +0100
Received: from [10.12.5.228] (141.76.13.149) by msx-t422.msx.ad.zih.tu-dresden.de (172.26.35.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Tue, 18 Nov 2025 10:43:41 +0100
Message-ID: <88f7650d-dd84-497f-bc22-7b839e9887c9@tu-dresden.de>
Date: Tue, 18 Nov 2025 10:43:39 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: "H.Rafiee" <ietf@rozanak.com>
References: <7f563479-c1ac-4678-9d96-f8a0d8fb0e69@rozanak.com> <a649b086-9c38-4e06-bf06-0b5f57e0e9cb@tu-dresden.de> <b77d26df-0a68-423e-b4d7-651b1421e9a7@rozanak.com>
Content-Language: en-US
From: Muhammad Usama Sardar <muhammad_usama.sardar@tu-dresden.de>
In-Reply-To: <b77d26df-0a68-423e-b4d7-651b1421e9a7@rozanak.com>
Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg="sha-512"; boundary="------------ms050405070007090806050807"
X-ClientProxiedBy: MSX-L422.msx.ad.zih.tu-dresden.de (172.26.34.142) To msx-t422.msx.ad.zih.tu-dresden.de (172.26.35.139)
X-TUD-Virus-Scanned: mailout3.zih.tu-dresden.de
Message-ID-Hash: VXVA6UIAXNGZNIJWOYYVJTNYGOJWETQ7
X-Message-ID-Hash: VXVA6UIAXNGZNIJWOYYVJTNYGOJWETQ7
X-MailFrom: muhammad_usama.sardar@tu-dresden.de
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-tls.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: tls@ietf.org
X-Mailman-Version: 3.3.9rc6
Precedence: list
Subject: [TLS] Re: Security Concern in TLS 1.3 and OpenSSL Implementation
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <tls.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/17zIQeq9mE0TUXQip1OSTg_l_pg>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tls>
List-Help: <mailto:tls-request@ietf.org?subject=help>
List-Owner: <mailto:tls-owner@ietf.org>
List-Post: <mailto:tls@ietf.org>
List-Subscribe: <mailto:tls-join@ietf.org>
List-Unsubscribe: <mailto:tls-leave@ietf.org>

Hi Hosnieh,

Please understand that once the early secret for PSK-only mode or the 
main secret for ECDHE-mode is compromised, the system is compromised 
already and no randomness can prevent you in such a case.

Also please understand that not all the keys have to be random. I would 
once again recommend to read Section 1.3 in [0] carefully.

See inline:

On 18.11.25 09:16, H.Rafiee wrote:
>
>>
>> On 17.11.25 17:40, H.Rafiee wrote:
>>> In short, TLS 1.3 uses 0-RTT to improve performance. To achieve this, it derives a key from the pre-shared key (PSK or master key)
>> I am not sure why you call it "master key". Such a key name does not 
>> exist in TLS 1.3 specs (neither RFC8446 nor RFC8446bis). There was 
>> "Master secret" in RFC8446 which is now "Main secret" in RFC8446bis 
>> but that's a completely different key compared to PSK. And "Main 
>> secret" is generated very late in the key schedule, which seems 
>> irrelevant to your explanation.
> I think the name of the key should not matter here :) as long as the 
> main message can be received. it meant as well master secret or main 
> secret. 
I fully disagree. As I said, PSK and Main Secret are two *very 
different* *keys* in the TLS 1.3 key schedule. Main Secret has nothing 
to do with 0-RTT, which was your original concern.
>>> , called the early secret (in OpenSSL). This early secret is derived in a very simple way
>> What do you mean by "very simple way"? What in addition to 
>> HKDF-Extract were you expecting to generate Early Secret from PSK?
>
> Yes, You extract the key from the master secret or main secret with 
> HKDF-Extract function.
>
See my above message.
>
> But the value is not random.
>
It is by design.
>
> That means from the same key it generates the same early secret 
> everytime the system starts the communication with new entities that 
> the same master secret exists or even if the client or server of the 
> communication is restarted.
>
I couldn't parse this. Would you mind rephrasing?
>
> In other word, your earlysecret  ist not random.
>
It is by design!
>
> This is the first security concern which I mentioned, by having that, 
> it is similar to having the master secret.
>
It is by design!
>
> Because the rest of keys are generated by this key.
>
> I explain why it is concert later please then wait :)
>
>
>>> and is used for encrypting and authenticating the first communications.
>>
>> That's actually not correct. Early Secret itself is never used except 
>> for generating three other keys via application of Derive-Secret in 
>> the first stage of derivation. One of those three keys is 
>> client_early_traffic_secret, which is then used to generate 
>> client_write_key via application of HKDF-Expand-Label in the second 
>> stage of derivation. client_write_key is the one used for encrypting 
>> 0-RTT data.
>>
> For generation of three other keys such as binder_key the function has 
> statric inputs including earlysecret and a startic string.
>
Please use proper terminology from TLS specs. By static string, you are 
referring to "labels", right?
>
> The value of this key is as well not random and not changed
>
This is by design.
>
> client_early-traffic_secret: the value of this key is random because 
> the inputs are random
>
Are you calling state of handshake (i.e., ClientHello message) as random?
>
> early_export_master_secret: although there are some staric string, but 
> there is one random value in the input of the function of HKDF-Expand 
> which makes the value random
>
Same question as above
>
> derivedearlysecret: static string as input plus the early secret which 
> was not random, as a result the output is not random
>
There is no key with the name "derivedearlysecret" in TLS 1.3 specs. Did 
you mean key labelled as "salt1" in [0]? If so, this is by design and 
does not have to be random.
>
> HandshakreSecret: in case of PSK_DHE is used and the input is 
> derivedearlySecret which is not random
>
> in other words, many keys here are not random.
>
This is by design!
>>> The main concern is that this early secret is neither randomized nor changed after system startup.
>> This is because the assumption is that PSK remains secret. Could you 
>> please clarify what do you mean by "system startup"? Are you resuming 
>> connections multiple times with the same PSK?
>
> In IT systems that use an HSM, Trusted Zone, or TPM, the main master 
> key is stored in the HSM. The idea is that if the system is 
> compromised (for example, due to a vulnerability in OpenSSL or a TLS 
> library implementation), the master secret will not be exposed or 
> lost. This avoids the need to re‑exchange the master secret with all 
> communication partners.
>
> However, when the early secret is derived deterministically from the 
> master secret (without random input),
>
Early Secret is derived from PSK and not directly from master secret.
>
> the rest of the communication no longer depends on the PSK (master 
> secret).
>
PSK != master secret
>
> The early secret is always available to generate handshake keys (which 
> I will call session keys for simplicity).
>
No, this is not only confusing but also wrong. So please don't use such 
simplicity. If you want TLS WG to help you, you have to use the 
terminology that we have in the key schedule in RFC8446(bis).
>
> If the system or TLS library is compromised, the early secret is lost. 
> It cannot be stored in the HSM, because TLS requires it dynamically 
> for key generation during communication.
>
> In other words, once the system is compromised, the early secret is 
> already exposed. Since this secret is derived in a predictable way 
> from the same master secret, with little randomness, an attacker does 
> not even need access to the master secret itself.
>
Randomness cannot protect a system which is already compromised.
>
>
>>> For subsequent session keys, a static value is also used as input to the session key generation function, along with a few random values.
>>
>> I am a bit lost in your terminology here. Which "static value"? Are 
>> you referring to the /label/ inputs for Derive-Secret?
>>
>> Which "few random values"? Are you referring to the state of the 
>> handshake used as input in Derive-Secret? If so, there is nothing 
>> more than ClientHello available at the time when this key is 
>> generated, so I am not sure how one can add more "randomness".
>>
> I am refering to the functions such as HKDF-Expand that receives 
> inputs for deriving the key.
>
HKDF-Expand is used several times in the key schedule. So you have to be 
precise which key exactly.
>>> As a result, the session key may not be sufficiently random.
>> Which "session key" exactly?
> handshake secret and and I refer you to above that I listed not 
> randomized and randomized key. 
Randomness in handshake secret comes from shared DH secret (g^xy).
>>> Questions to the community:
>>>
>>> Is this an OpenSSL implementation issue, or a protocol-level security problem?
>>> Were there any tests conducted for the protocol before its release?
>>> Is this issue already known?
>> I don't think it's an issue but I may be missing something. Please 
>> provide answers to my questions.
>>> Security risks:
>>> If there is a bug in the system or the early secret is not well protected in memory (it cannot be stored in an HSM or trusted environment because it needs to be readily available to TLS library), an attacker could reproduce or decrypt communication in case of vulnerabilities in one of the communicating systems.
>> Sure, if Early Secret is not protected, there is nothing preventing 
>> 0-RTT data. That is by design.
>
> with the way is early secret always needed, you may be only able to 
> protect the whole TLS libarary in a kind of sandbox but you cannot put 
> it in HSM or Trusted zone because
>
> 1- the whole TLS library cannot run in HSM --> it causes performance 
> problem and delay in communication
>
But you can run the TLS library in Trusted Execution Environment with 
good-enough performance, no?
>
> 2- You will be limited to the resources of HSM which is not usually 
> enough. although, if you have hardware accellerator.
>
> Therefore, by compromised TLS library for any vulnerabilities there, 
> then the attacker has access to this name early secret. That means 
> your protection does not fully protect your key which is in the same 
> level as your master secret and by having that , it is like you have 
> the master secret.
>
Yes, this is by design.

-Usama

>>> Even if the TLS library uses isolated memory space, any bug in OpenSSL could expose the secret.
>> Same applies here.
>>> Since the early secret lacks sufficient randomness, it seems necessary to change the PSK to prevent attackers from establishing secure communication.
>>
>> Again, please clarify "randomness". Where would that random value be 
>> stored? Imagine somehow the randomness is there, if attacker has 
>> access to memory, can't it get that random value too?
>>
>>> Generally speaking, the role of the PSK is weak here. Even if it is well protected, as long as the early secret is poorly protected, knowing the early secret compromises the entire system.
>>
>> Yes, that is by design. PSK-only does not have the same properties as 
>> the full handshake with ECDHE. In particular, losing Early Secret in 
>> PSK-only breaks all guarantees for 0-RTT data.
>>
>> In general, you may find Section 1.3 in [0] helpful for general 
>> understanding of TLS key schedule.
>>
>> -Usama
>>
>> [0] 
>> https://www.researchgate.net/publication/396245726_Perspicuity_of_Attestation_Mechanisms_in_Confidential_Computing_Validation_of_TLS_13_Key_Schedule
>>