Z Zihan Xi #
Hi Linux kernel maintainers, We found and validated a issue in fs/smb/client/smb2pdu.c. The bug is reachable by a non-root user via user and net namespace. We've tested it, and it should not affect any other functionality. The malicious server can be operated by a non-root user in a user and net namespace. The guest-side CIFS mount in this validation is performed as root because CIFS does not set FS_USERNS_MOUNT. We will provide detailed information about the bug in this email, along with a PoC to trigger it. ---- details below ---- Bug details: The reproduced crash is a truncated QFid create context. Generic layout checks accept DataLength 0, then parse_query_id_ctxt() still reads DiskFileId through a full response-structure cast and crosses the cifs_small_rq object. smb2_parse_contexts() also does not bound each context record by its Next field before dispatching to a handler. The SMB2 lease parser reads LeaseFlags after LeaseState, so a short lease context can pass the generic checks and still be handed to smb2_parse_lease_buf(). Patch 1 bounds each context by Next, validates the QFid payload length, and extends the SMB2 lease minimum through LeaseFlags. The embedded PoC and KASAN report show the truncated QFid path; the Next and lease checks close sibling parser holes in the same function. parse_posix_ctxt() reads nlink, reparse_tag, and mode before checking that the POSIX context contains those fields. Current in-tree smb2_open_file() passes a NULL posix pointer into SMB2_open(), so this handler is not reached on the ordinary open path. Patch 2 still adds a handler-level minimum DataLength check and keeps the existing soft-failure behavior for malformed optional metadata. Please accept my apologies for the follow-up. I posted v2 on 23 Aug 2026 and have not received a reply, so I am resending the series as v3. There are no functional code changes versus v2.