Re: [PATCH v2] SUNRPC: restrict integrity replies to authenticated payload
From: Chuck Lever
Date: Mon Sep 21 2026 - 10:18:55 EST
On Sun, Sep 20, 2026, at 5:07 PM, Jérémy Jean wrote:
> gss_unwrap_resp_integ() authenticates only databody_integ. The checksum
> object and any bytes after it are not covered by the integrity check, but
> remain visible to the XDR decoder.
>
> This makes RPCSEC_GSS reply payloads malleable by bypassing crypto
> integrity. A modified reply can contain only the RPCSEC_GSS sequence
> number in databody_integ, reuse the reply verifier MIC as the body MIC,
> and append bytes that the decoder consumes without invalidating the MIC.
>
> Decode the checksum length into mic.len and truncate the decode stream
> after MIC verification so only the authenticated payload remains visible.
> Reject bodies shorter than the mandatory sequence number before using the
> body length.
>
> Fixes: 1da177e4c3f41 ("Linux-2.6.12-rc2")
> Assisted-by: Codex:gpt-5
> Signed-off-by: Jérémy Jean <Jeremy.Jean@xxxxxxxxxxxxxxxxx>
> ---
> Changes in v2:
> - Drop the redundant xdr_stream_remaining() guard before truncation.
>
> v1:
> https://lore.kernel.org/all/20260919212024.2335794-2-Jeremy.Jean@xxxxxxxxxxxxxxxxx/
>
> net/sunrpc/auth_gss/auth_gss.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
Reviewed-by: Chuck Lever <cel@xxxxxxxxxx>
--
Chuck Lever (Come to NFS bake-a-thon! https://nfsv4bat.org)