OPENAFS-SA-2024-002: verify FetchACL returned a valid string 35/15935/2
authorBenjamin Kaduk <kaduk@mit.edu>
Tue, 5 Nov 2024 04:33:16 +0000 (20:33 -0800)
committerBenjamin Kaduk <kaduk@mit.edu>
Tue, 12 Nov 2024 18:05:44 +0000 (13:05 -0500)
commit64068705b15661a8d4e0b9f9f2ad4aec34ed51a7
tree911b4e1946bfba78d1e458b2af982f8d8d068cb6
parentbb01d76a2095baa65880bdc5d504e7a198958265
OPENAFS-SA-2024-002: verify FetchACL returned a valid string

CVE-2024-10396

Analogously to how a call to RXAFS_StoreACL() with a malformed
ACL string can cause a fileserver to perform invalid memory operations,
a malformed ACL string returned in response to a call to RXAFS_FetchACL()
can cause a client to perform invalid memory operations.

Modify all the in-tree callers of the RPC to verify that the ACL
data, which is conveyed as an XDR 'opaque' but whose contents
are actually expected to be a string, is a valid C string.  If
a zero-length opaque or one without a trailing NUL is received,
treat that as an error response from the fileserver rather than
returning success.

The Unix cache manager's pioctl handler already has logic to cope with a
zero-length reply by emitting a single NUL byte to userspace.  This
special-casing seems to have been in place from the original IBM import,
though it does so by confusingly "skipping over" a NUL byte already put
in place.  For historical compatibility, preserve that behavior rather
than treating the zero-length reply as an error as we do for the other
callers.  It seems likely that this location should treat a zero-length
reply as an error just as the other call sites do, but that can be done
as a later change.

Reviewed-on: https://gerrit.openafs.org/15914
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 0b1ccb0dbc3b7673558eceff3d672971f5bb0197)

Change-Id: Ifbce762d76641f08b5fc5e79b4c8dad07c1a135a
Reviewed-on: https://gerrit.openafs.org/15935
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
src/WINNT/afsd/cm_ioctl.c
src/afs/afs_pioctl.c
src/libafscp/afscp_acl.c