From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A71327FB18 for ; Mon, 1 Jun 2026 06:19:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780294782; cv=none; b=WAi1Lc1kktJqcd2Qbx8+qZYvwsc25yffyDl8kLFOj+yLQOQRmrkuy5HZAGq2y5EhhVkscDklBI3ZfO6fEF+nAWxjYfHTVNOGfmRcwH3OB4G9IZI/516bBsfJdPmgKZduUYOvvXAY2HELhb2oiL2gh4Lw21OIVMEWVewOw3nE6Yw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780294782; c=relaxed/simple; bh=xbeToUepAAOXhby3WplNhTH1RuFEQW+9jpccaYH95eE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=t/JKhLfmh8aDpUG1ysPg/ygONyKwtVNwobm8gbYCVP+xKMZfJGkg7xQCcguu9MHFFGQgS6EyK4aD+wwIkP73y21Wne838IwY1spUMF9EzGpSdnCTfm+WD4po46ignJC4iIeYaFjfs/mDON8asXxceX8C/v0WRMgpySTxCtHAvzY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=LXfcE/Ho; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=3aB0hBmI; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=AZ7agGnV; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=4cYIG6pk; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="LXfcE/Ho"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="3aB0hBmI"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="AZ7agGnV"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="4cYIG6pk" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 12B5E67FE6; Mon, 1 Jun 2026 06:19:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1780294779; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TXRXEQf/nRa17XmwGzcQ02I9v+pXoFho2XQT7cZB3sQ=; b=LXfcE/HolnHW721n/QU2wH9DQPGhNLCra/yOcHe+0xO/C0AB8BkGkVbGzbpiDov7mBipgW uLn/a3rp21tlMo4kKNXq8TfXHdNK3+9NblpW9uKR691q5UZpGoMTIzf66XF5mpgUbc07SV zF/rgtLIwvDHjrr5GaWoTl8HqmaEidw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1780294779; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TXRXEQf/nRa17XmwGzcQ02I9v+pXoFho2XQT7cZB3sQ=; b=3aB0hBmILa7yEqhQBv8lZf7rbNH4kX5d6qltiVKV6axOLsw7aoMAAfo+G0b9WIrrVwejsn SGjn4LvaEb5rj4Aw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1780294778; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TXRXEQf/nRa17XmwGzcQ02I9v+pXoFho2XQT7cZB3sQ=; b=AZ7agGnVIYHJoPFkpDVDbLw/oypozXrRsCGKRqmfrJ8IpEHSoLYuQFS9l7FchG/0LnzKWL m+KmPYZ8u2fiel04WT0ZuiG3dXpikrfOOPPl8JaynOlLnMHjS1u+hRaujQJ/GsZNSN/hhE Mgku+G0Z7FXxjj1PURyYfb+ruuCgJ1A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1780294778; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TXRXEQf/nRa17XmwGzcQ02I9v+pXoFho2XQT7cZB3sQ=; b=4cYIG6pko2tCvl9M4uGEihcfrlOtfNmLsuDqxVKp/JnEByXGii1m10rmoIG/Tup6QAok48 BRQDcOgwG8XAnSBQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D2703779A7; Mon, 1 Jun 2026 06:19:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id aoXIMXkkHWqcEQAAD6G6ig (envelope-from ); Mon, 01 Jun 2026 06:19:37 +0000 Message-ID: <959eccd1-38eb-407d-92f3-96ec54a7d85a@suse.de> Date: Mon, 1 Jun 2026 08:19:37 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] nvmet-auth: validate reply message payload bounds against transfer length To: Tianchu Chen , hch@lst.de, sagi@grimberg.me, kch@nvidia.com Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org References: Content-Language: en-US From: Hannes Reinecke In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Level: X-Spam-Score: -4.30 X-Spam-Flag: NO X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.996]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_TWO(0.00)[2]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[tencent.com:email,imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid] On 5/29/26 16:18, Tianchu Chen wrote: > From: Tianchu Chen > > nvmet_auth_reply() accesses the variable-length rval[] array using > attacker-controlled hl (hash length) and dhvlen (DH value length) fields > without verifying they fit within the allocated buffer of tl bytes. > > A malicious NVMe-oF initiator can craft a DHCHAP_REPLY message with a > small transfer length but large hl/dhvlen values, causing out-of-bounds > heap reads when the target processes the DH public key (rval + 2*hl) or > performs the host response memcmp. > > With DH authentication configured, the OOB pointer is passed directly to > sg_init_one() and read by crypto_kpp_compute_shared_secret(), reaching > up to 526 bytes past the buffer. This is exploitable pre-authentication. > > Add bounds validation ensuring sizeof(*data) + 2*hl + dhvlen <= tl before > any access to the variable-length fields. > > Discovered by Atuin - Automated Vulnerability Discovery Engine. > > Fixes: db1312dd9548 ("nvmet: implement basic In-Band Authentication") > Cc: stable@vger.kernel.org > Signed-off-by: Tianchu Chen > --- > drivers/nvme/target/fabrics-cmd-auth.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > Reviewed-by: Hannes Reinecke Cheers, hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich