CVE-2026-97559: smb: client: fail DACL rewrite when the new DACL exceeds 64K
In the Linux kernel, the following vulnerability has been resolved:
smb: client: fail DACL rewrite when the new DACL exceeds 64K
replacesidsandcopyaces() and setchmoddacl() accumulate the size of the DACL they build in a u16. That accumulator can wrap.
validatedacl() caps numaces at (daclsize - sizeof(struct smbacl)) / 20, i.e. 3276 for a maximally sized DACL, while each rewritten ACE can grow to sizeof(struct smbace) (76 bytes) once its SID is replaced with one carrying SIDMAXSUBAUTHORITIES sub-authorities. The worst case is therefore sizeof(struct smbacl) + 3276 76 = 248984 bytes, far beyond what a u16 can hold. A wraparound is reached with 863 ACEs.
After the wraparound, ndaclptr->size becomes meaningless and the offset will point anywhere in the ACE array. As a result, we will see corruption of the DACL, which then gets sent to the server. This is not an out-of-bounds write as the allocation now covers the worst-case expansion, so writes will always go into the buffer.
Adjust the code to use a u32 internally and return -EOVERFLOW in the overflow case. The operation must be refused, because a DACL can only hold 2^16-1 bytes on the wire and larger DACLs cannot be represented.
setchmoddacl() carries the same pattern and is fixed the same way. It only wraps once the source DACL comes within roughly 380 bytes of the 64K ceiling, but the failure mode is identical.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
Update replace_sids_and_copy_aces() and set_chmod_dacl() to accumulate the rewritten DACL size in a u32, refuse rewrites whose resulting DACL exceeds 64K, and return -EOVERFLOW for the overflow case.
Event History
Frequently Asked Questions
Which systems are exposed to this issue?
Linux systems using the SMB client are affected when they perform a DACL rewrite, including the chmod DACL path. The issue concerns DACLs whose rewritten ACEs expand significantly because their SIDs are replaced.
What conditions trigger the corruption?
The DACL rewrite must contain enough expanding ACEs for the internal 16-bit size accumulator to wrap. The described wraparound is reached with 863 ACEs when rewritten ACEs grow to 76 bytes.
What is the practical impact of the integer wraparound?
The resulting DACL size and ACE offset become invalid, causing corruption of the DACL that is sent to the SMB server. The described condition is not an out-of-bounds write because the allocation covers the worst-case expansion.
What should happen after the fix when a rewritten DACL is too large?
The operation is refused with -EOVERFLOW when the DACL would exceed the size that can be represented on the wire. A DACL cannot exceed 2^16-1 bytes on the wire.