[CFRG] Re: Comment on AES-GCM-SST

Yehuda Lindell <yehuda.lindell@gmail.com> Mon, 06 May 2024 15:47 UTC

Return-Path: <yehuda.lindell@gmail.com>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 06C05C14F616 for <cfrg@ietfa.amsl.com>; Mon, 6 May 2024 08:47:53 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.994
X-Spam-Level:
X-Spam-Status: No, score=-6.994 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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, HTTPS_HTTP_MISMATCH=0.1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oFdS5oX77dg1 for <cfrg@ietfa.amsl.com>; Mon, 6 May 2024 08:47:49 -0700 (PDT)
Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 49BE7C14F693 for <cfrg@irtf.org>; Mon, 6 May 2024 08:47:49 -0700 (PDT)
Received: by mail-qk1-x732.google.com with SMTP id af79cd13be357-7928c8379f6so242319185a.3 for <cfrg@irtf.org>; Mon, 06 May 2024 08:47:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715010468; x=1715615268; darn=irtf.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=y11IZamRNlNb0Ekf/r3EWzGJLNth66Ln3Iejt7Qg3MY=; b=mC3NbSSnYmkLvF3zHlHijrkxI+3kB/N9YgTv4XDW0WUpC1ngSoYjupY+y1mCRTvB9i 0f3BCHfb2O1GErZ/bJABLKXyddatsHAmtyUPjtNXVdAKqLiMLk9Y9x00lV3yu/8Z1cUS 9uKCR3LhNxP+VyMUm/SDraVdws7ooCFC6zXxlqmuE6sIeYGa2IKVcqz3OHCeHuxIlr2N YADUdn5dnnJNTjZsYX5A6shw2UlqJ944lsC19s2Hua3fUO/HzHeEeOOUg/mkZiNiwLyN RTs2NjNeGn+EgNkFzsP1J+rQuBey858ytQHXk5lf3CvAI5H8whB/wCuuyMtaCOK0uBDE pHmg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715010468; x=1715615268; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=y11IZamRNlNb0Ekf/r3EWzGJLNth66Ln3Iejt7Qg3MY=; b=rMtqENdeh1lNY1fibpPQxD9IxdcEWi3O4wvNVqpPVG6AAdKwZpOEcDBVbETu1w/TSK LV3yeWQdJy9QtJ4NNVg62sxEK6MBXv+aD5k6DFKJpPnmzTjBh5oDnngcjrP565jqgY+S 1mSV0uspF/WPAFO5EJ92/GMDVb/jf2Mw8dIQhBBCP1Og8+OTKo2ZA25f7H2S2Fp5H5Mf DJIYFcXupz4Abkh5F7lTVBZs4CmoMLVpgZyA/DTiOV06Y1NJwiT2l6v4Vw5HMtwZeRGl 1W1oaqUh14eq8iOk+43VWhJIfxFurbpSCW38ytsFVDr5VtQl9xgi3gpU8U6CcpQ0aCQ6 yh5w==
X-Forwarded-Encrypted: i=1; AJvYcCWSqJnsoOlovuD5jyJY61BTAWYLSTcjCSvC23boT+Z7O82jKZdx/eYPnIIDjLBWklrek/C0D2dbnXN+C26w
X-Gm-Message-State: AOJu0Yx7M6KdeXzC43W5d+yMw0HweZ94xVL1PxtwEJX2NHMilMBFRnRe Pyvn8XrM5AYOCTI3T/Hw50oWUX/wd4LQ3i/tlXdeuiwqQIpdlOQx
X-Google-Smtp-Source: AGHT+IHfGHyC6HjM5QLMYz8LJaNfHo5HHm9ySrF04EDzjaFQXcPgFW1bZ30qa9aKZDzg5yxdpIkndA==
X-Received: by 2002:a05:620a:3952:b0:78e:5148:b04f with SMTP id qs18-20020a05620a395200b0078e5148b04fmr16120304qkn.61.1715010467549; Mon, 06 May 2024 08:47:47 -0700 (PDT)
Received: from smtpclient.apple ([147.235.213.12]) by smtp.gmail.com with ESMTPSA id z17-20020a05620a101100b0079299e0be9fsm1025764qkj.15.2024.05.06.08.47.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 May 2024 08:47:47 -0700 (PDT)
From: Yehuda Lindell <yehuda.lindell@gmail.com>
Message-Id: <CEB929A2-33C9-4978-896F-A81FD215B2CC@gmail.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_F7646A96-5E2B-45C4-B9DD-B43A9261EFDF"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\))
Date: Mon, 06 May 2024 18:47:28 +0300
In-Reply-To: <GVXPR07MB9678F598C96A3CA68C47428F891C2@GVXPR07MB9678.eurprd07.prod.outlook.com>
To: John Mattsson <john.mattsson@ericsson.com>
References: <85926AD9-298F-47BB-93F5-0B6D8D180D80@gmail.com> <CH0PR11MB54441BD2D75B084A56D67B83C11C2@CH0PR11MB5444.namprd11.prod.outlook.com> <GVXPR07MB9678F598C96A3CA68C47428F891C2@GVXPR07MB9678.eurprd07.prod.outlook.com>
X-Mailer: Apple Mail (2.3774.500.171.1.1)
Message-ID-Hash: DKQSXW6CTETUMJT47PHX5ERHPIL6VJBK
X-Message-ID-Hash: DKQSXW6CTETUMJT47PHX5ERHPIL6VJBK
X-MailFrom: yehuda.lindell@gmail.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-cfrg.irtf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: "Scott Fluhrer (sfluhrer)" <sfluhrer=40cisco.com@dmarc.ietf.org>, "cfrg@irtf.org" <cfrg@irtf.org>
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [CFRG] Re: Comment on AES-GCM-SST
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/i90QeEjXp0iULuwIEgKtSbHTmFE>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Owner: <mailto:cfrg-owner@irtf.org>
List-Post: <mailto:cfrg@irtf.org>
List-Subscribe: <mailto:cfrg-join@irtf.org>
List-Unsubscribe: <mailto:cfrg-leave@irtf.org>

Hi John,

Indeed, it does require the decryptor to allow repeated nonces. However, it is very hard to prevent this. The reason why the encryptor can in general prevent nonce-reuse is by choosing nonces at random. If it’s a stateful machine, then it can also increment (but this limits usability and is a pain). However, the decryptor cannot verify that a nonce has not been used without storing previous nonces which isn’t practical. In a single session, this can of course be done, but that again is very limiting, and would be hard to enforce. It is also very error prone, so wouldn’t be recommended for a stand-alone mode of operation (in contrast to within a protocol like TLS/IPsec where you can include that).

Best,

Yehuda

> On 6 May 2024, at 17:41, John Mattsson <john.mattsson@ericsson.com> wrote:
> 
> Hi Yehuda,
>  
> Thanks for the analysis.
>  
> I have not looked into the details of solving the suggested equations but it seems like the attack idea relies on the decryption function allowing nonce reuse. I.e., the attack is not possible when GCM-SST is used in a security protocol with replay protection, which is how it is intended to be used in mobile systems and media encryption. I think the problem goes away if a requirement is added that the nonces in both the encryption and decryption function must be unique. As long as the decryption function rejects nonces that has sucessfully been decrypted before, a single forgery does not help with multi-forgery as the the subkeys from one nonce does not help the attacker to get subkeys for other nonces.
>  
> Cheers,
> John
>  
> From: CFRG <cfrg-bounces@irtf.org> on behalf of Scott Fluhrer (sfluhrer) <sfluhrer=40cisco.com@dmarc.ietf.org>
> Date: Monday, 6 May 2024 at 15:43
> To: Yehuda Lindell <yehuda.lindell@gmail.com>, cfrg@irtf.org <cfrg@irtf.org>
> Subject: Re: [CFRG] Comment on AES-GCM-SST
> 
> I believe this attack needs to be rewritten a bit before it works.
> 
> The issue is that X is a function of the message; X is a complex function of the message.  You could recover the truncated tag (and hence some information on Q*X) for a single message, however once you switch to another message, X changes.
> 
> A more correct way of stating it is to expand T to:
>         T = Q * H * S[z-1] + Q * H^2 * S[z-2] + const
> Where the attacker modifies S[z-1], S[z-2] (the last two message blocks) and keeps everything else (other than the guessed tag) constant.  Fortunately, H^2 is a bitwise linear function of H, and so the original attack based on expanding quadratic terms still works (and once the attacker recovers H, Q for this nonce, it's game over).
> 
> On the other hand, we should remember that this O(2^40) attack involves throwing 2^40 messages at the decryptor (and the vast majority of them will be rejected as invalid).  This is considerably more difficult than, say, breaking 40 bit DES given a plaintext/ciphertext pair; we need to assume that the device under attack won't realize that, after a massive number of decryption failures, that something is up.  We might not want to make such an assumption on the application, however we should be aware of the difference between an attack that the attacker can perform on his own, and one where he needs to interact with a legitimate party...
> 
> > -----Original Message-----
> > From: CFRG <cfrg-bounces@irtf.org> On Behalf Of Yehuda Lindell
> > Sent: Sunday, May 5, 2024 9:55 AM
> > To: cfrg@irtf.org
> > Subject: [CFRG] Comment on AES-GCM-SST
> > 
> > I've taken a look at AES-GCM-SST, and have a couple of comments.
> > 
> > First, I think that I have found another attack that doesn't require nonce-
> > reuse. It has a higher complexity but as stated works without nonce reuse,
> > and provides key extraction and thus a universal forgery.
> > 
> > By the standard,
> > 
> > X = POLYVAL(H, S[0], S[1], ..., S[m + n - 1]) T = POLYVAL(Q, X XOR S[m + n]) XOR
> > M
> > 
> > The POLYVAL in computing T is a single multiplication, and so we have T = Q *
> > (X XOR S[m+n]) XOR M = Q * X + Q * S[m+n] + M
> > 
> > For the same nonce (and the attacker can always use the same nonce) and
> > same-length messages, it follows that Q * S[m+n] + M is constant, and
> > therefore it remains to learn Q * X. This is a quadratic equation with 128
> > variables and so can be rewritten as a linear equation with 128-choose-2 ~
> > 2^13 new variables.
> > 
> > Consider a 32-bit tag. In each equation with tag=0 we obtain 32=2^5 linear
> > equations. Therefore we need 2^8 such equations. Each equation takes
> > expected 2^32 queries, and therefore with expected 2^40 queries we can
> > learn the key, and from then on forge any message desired.
> > 
> > Therefore the standard doesn't meet its stated goal which is to achieve
> > forgery probabilities close to ideal. Specifically, although it should be possible
> > to forge a single message with 2^32 queries, it should not be possible to
> > obtain a universal forgery in time 2^40.
> > 
> > As a second comment, in general, I believe that a proposal for a mode of
> > operation that aims to achieve something like the above needs to have a full
> > proof of security with concrete bounds. Otherwise we can expect to cat-and-
> > mouse finding and fixing attacks, like the one described by Scott Fluhrer and
> > the one above.
> > 
> > Best,
> > 
> > Yehuda
> > _______________________________________________
> > CFRG mailing list
> > CFRG@irtf.org
> > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.irtf.org%2Fmailman%2Flistinfo%2Fcfrg&data=05%7C02%7Cjohn.mattsson%40ericsson.com%7C44c2f762c8074bb1b7c808dc6dd273f9%7C92e84cebfbfd47abbe52080c6b87953f%7C0%7C0%7C638505997859334216%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=3WDmJA07tiAAAqpxJHxyx4Z96EueRQ1FFLlqd3vu4cU%3D&reserved=0 <https://mailman.irtf.org/mailman/listinfo/cfrg>
> 
> _______________________________________________
> CFRG mailing list
> CFRG@irtf.org
> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.irtf.org%2Fmailman%2Flistinfo%2Fcfrg&data=05%7C02%7Cjohn.mattsson%40ericsson.com%7C44c2f762c8074bb1b7c808dc6dd273f9%7C92e84cebfbfd47abbe52080c6b87953f%7C0%7C0%7C638505997859341664%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=Cub0LO4C9XjszrMOdRT0UQxxZFcS6jpBZBYrxiwjvn4%3D&reserved=0 <https://mailman.irtf.org/mailman/listinfo/cfrg>