From: Tal Zussman <tz2294@columbia.edu>
To: Tyler Hicks <code@tyhicks.com>, Erez Zadok <ezk@cs.sunysb.edu>,
Phillip Hellewell <phillip@hellewell.homeip.net>,
Badari Pulavarty <pbadari@us.ibm.com>,
Theodore Ts'o <tytso@mit.edu>,
Andrew Morton <akpm@linux-foundation.org>
Cc: ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Stephan Mueller <smueller@chronox.de>,
Adrian Bunk <bunk@stusta.de>,
Michael Halcrow <mhalcrow@us.ibm.com>,
Randy Dunlap <rdunlap@infradead.org>,
stable@vger.kernel.org, Sashiko <sashiko-bot@kernel.org>,
Tal Zussman <tz2294@columbia.edu>
Subject: [PATCH v3 02/10] ecryptfs: reject zero-length encrypted session keys
Date: Mon, 16 Nov 2026 17:08:08 -0500 [thread overview]
Message-ID: <20261116-ecryptfs-folio-v3-2-1aba8e620eda@columbia.edu> (raw)
In-Reply-To: <20261116-ecryptfs-folio-v3-0-1aba8e620eda@columbia.edu>
parse_tag_1_packet() and parse_tag_3_packet() accept a packet that
contains no key, leaving encrypted_key_size at 0. The decrypt path then
fails its scatterlist check but returns 0 anyway, so the file ends up
with an all-zero session key. Since file headers are attacker
controlled, someone without the passphrase can plant a file that reads
as plaintext of their choosing and encrypts anything written to it
under a known key. Reject these packets.
Fixes: 237fead61998 ("[PATCH] ecryptfs: fs/Makefile and fs/Kconfig")
Cc: stable@vger.kernel.org
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20261014-ecryptfs-folio-v1-0-f4412187b1d3%40columbia.edu?part=4
Signed-off-by: Tal Zussman <tz2294@columbia.edu>
---
fs/ecryptfs/keystore.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index c2ba230c71fd..a0989e3c8aef 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -1250,7 +1250,7 @@ parse_tag_1_packet(struct ecryptfs_crypt_stat *crypt_stat,
"rc = [%d]\n", rc);
goto out_free;
}
- if (unlikely(body_size < (ECRYPTFS_SIG_SIZE + 2))) {
+ if (unlikely(body_size <= (ECRYPTFS_SIG_SIZE + 2))) {
printk(KERN_WARNING "Invalid body size ([%td])\n", body_size);
rc = -EINVAL;
goto out_free;
@@ -1384,7 +1384,7 @@ parse_tag_3_packet(struct ecryptfs_crypt_stat *crypt_stat,
rc);
goto out_free;
}
- if (unlikely(body_size < (ECRYPTFS_SALT_SIZE + 5))) {
+ if (unlikely(body_size <= (ECRYPTFS_SALT_SIZE + 5))) {
printk(KERN_WARNING "Invalid body size ([%td])\n", body_size);
rc = -EINVAL;
goto out_free;
--
2.39.5
next prev parent reply other threads:[~2026-11-16 22:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 22:08 [PATCH v3 00/10] ecryptfs: remove the remaining struct page usage Tal Zussman
2026-11-16 22:08 ` [PATCH v3 01/10] ecryptfs: write from the right offset in ecryptfs_write_lower_page_segment() Tal Zussman
2026-11-16 22:08 ` Tal Zussman [this message]
2026-11-16 22:08 ` [PATCH v3 03/10] ecryptfs: keep the folio locked while ecryptfs_write() writes it out Tal Zussman
2026-11-16 22:08 ` [PATCH v3 04/10] ecryptfs: remove struct ecryptfs_page_crypt_context Tal Zussman
2026-11-16 22:08 ` [PATCH v3 05/10] ecryptfs: use a folio and a buffer in crypt_extent() Tal Zussman
2026-11-16 22:08 ` [PATCH v3 06/10] ecryptfs: use kzalloc() for the header buffer Tal Zussman
2026-11-16 22:08 ` [PATCH v3 07/10] ecryptfs: use sg_init_one() instead of virt_to_scatterlist() Tal Zussman
2026-11-16 22:08 ` [PATCH v3 08/10] ecryptfs: zero the tail of the last folio in place on truncate Tal Zussman
2026-11-16 22:08 ` [PATCH v3 09/10] ecryptfs: rename functions to refer to folios Tal Zussman
2026-11-16 22:08 ` [PATCH v3 10/10] ecryptfs: refer to folios in comments and printk strings Tal Zussman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261116-ecryptfs-folio-v3-2-1aba8e620eda@columbia.edu \
--to=tz2294@columbia.edu \
--cc=akpm@linux-foundation.org \
--cc=bunk@stusta.de \
--cc=code@tyhicks.com \
--cc=ecryptfs@vger.kernel.org \
--cc=ezk@cs.sunysb.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=mhalcrow@us.ibm.com \
--cc=pbadari@us.ibm.com \
--cc=phillip@hellewell.homeip.net \
--cc=rdunlap@infradead.org \
--cc=sashiko-bot@kernel.org \
--cc=smueller@chronox.de \
--cc=stable@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®