From: Adriano Cordova <adrianox@gmail.com>
To: Tyler Hicks <code@tyhicks.com>
Cc: Nguyen Duy Nhat Anh <neganhat@gmail.com>,
ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Adriano Cordova <adrianox@gmail.com>,
stable@vger.kernel.org,
syzbot+03c68e42ce4b33f7ce9b@syzkaller.appspotmail.com
Subject: [PATCH v3 2/2] ecryptfs: bound session_key_encryption_key_bytes in auth tok
Date: Fri, 16 Oct 2026 14:06:33 -0300 [thread overview]
Message-ID: <20261016170633.1415240-2-adrianox@gmail.com> (raw)
In-Reply-To: <20261016170633.1415240-1-adrianox@gmail.com>
Let ecryptfs_verify_auth_tok_from_key() validate the password's
session_key_encryption_key_bytes length. When it is larger than
ECRYPTFS_MAX_KEY_BYTES, md5() reads past session_key_encryption_key[].
Reject such auth toks.
Fixes: 9c79f34f7ee7 ("eCryptfs: Filename Encryption: Tag 70 packets")
Cc: <stable@vger.kernel.org>
Reported-by: syzbot+03c68e42ce4b33f7ce9b@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=03c68e42ce4b33f7ce9b
Tested-by: syzbot+03c68e42ce4b33f7ce9b@syzkaller.appspotmail.com
Signed-off-by: Adriano Cordova <adrianox@gmail.com>
---
Changes in v3:
- Split the v2 patch.
- Change the Link: tag to Closes:.
- Remove Nguyen Duy Nhat Anh change and its Reported-by tag.
fs/ecryptfs/keystore.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index 51651314b7a6..c2ba230c71fd 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -477,6 +477,13 @@ ecryptfs_verify_auth_tok_from_key(struct key *auth_tok_key,
rc = -EINVAL;
goto out;
}
+ if ((*auth_tok)->token_type == ECRYPTFS_PASSWORD &&
+ (*auth_tok)->token.password.session_key_encryption_key_bytes >
+ ECRYPTFS_MAX_KEY_BYTES) {
+ printk(KERN_ERR "Invalid password auth_tok session key size\n");
+ rc = -EINVAL;
+ goto out;
+ }
out:
return rc;
}
--
2.51.0
prev parent reply other threads:[~2026-10-16 17:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 17:06 [PATCH v3 1/2] ecryptfs: reject short encrypted key payloads Adriano Cordova
2026-10-16 17:06 ` Adriano Cordova [this message]
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=20261016170633.1415240-2-adrianox@gmail.com \
--to=adrianox@gmail.com \
--cc=code@tyhicks.com \
--cc=ecryptfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neganhat@gmail.com \
--cc=stable@vger.kernel.org \
--cc=syzbot+03c68e42ce4b33f7ce9b@syzkaller.appspotmail.com \
/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®