Bug 2590741

Summary: CVE-2026-120376 samba: samba: nmbd host announcement reads past the packet and can stop the daemon [fedora-44]
Product: [Fedora] Fedora Reporter: TEJ RATHI <trathi>
Component: sambaAssignee: Guenther Deschner <gdeschner>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 44CC: abokovoy, anoopcs, asn, gdeschner, pfilipen, sbose, ssorce
Target Milestone: ---Keywords: Security, SecurityTracking
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: {"flaws": ["219eb64a-d370-4952-948a-715babeaa006"]}
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2474774    

Description TEJ RATHI 2026-12-04 06:09:31 UTC
Disclaimer: Community trackers are created by Red Hat Product Security team on a best effort basis. Package maintainers are required to ascertain if the flaw indeed affects their package, before starting the update process.

process_dgram() in source3/nmbd/nmbd_packets.c accepts a browse mailslot whose DataLength is 1 and whose DataOffset places that byte at the last copied byte of the datagram. The function checks that span against the copied payload and does not pass the remaining length to the command handler.

read_packet() fills a 576-byte buffer, MAX_DGRAM_SIZE. parse_dgram() in source3/libsmb/nmblib.c zeroes the datagram and copies the bytes after the 14-byte datagram header and the two NetBIOS names into dgram->data, which is 576 bytes. A name in pointer form consumes 2 bytes. With both names in that form the copied length is 558, and data[558] through data[575] stay zero. data[] is the last field of dgram_packet, the larger arm of the union at the end of packet_struct. The SMB view starts 4 bytes before data[]. DataLength is the 16-bit word at data[55]. DataOffset is the 16-bit word at data[57]. A length of 1 and an offset of 557 pass: the length is within the copied size, the span starts inside the copy, and the span ends on the last copied byte. process_browse_packet() reads the command from data[557] and calls the handler at data[558].

process_host_announce() in source3/nmbd/nmbd_incomingdgrams.c reads a 32-bit ttl at offset 1, a 32-bit server type at offset 23, and a comment at offset 31. The ttl read falls in the zero tail, so the ttl is 0. The server-type read starts at data[581]. The comment read is pull_ascii_fstring(), which calls pull_ascii() in source3/lib/charcnv.c with a source length of -1. With STR_TERMINATE, that length makes pull_ascii() call strlen() from data[589]. That address is 13 bytes past data[]. Trailing padding of packet_struct on an 8-byte alignment is at most 7 bytes, so strlen() starts outside the object. strlen() stops at the first NUL. pull_ascii_fstring() runs before the server-type test. If strlen() returns and the server type is nonzero, the comment can be kept in the server record. That copy is not sent back to the caller. nmbd announces only its own server names. server min protocol defaults to SMB2_02, so the SMB1 call that reads browse.dat is not available.

The caller can stop nmbd. strlen() has no length limit. A walk that leaves mapped memory faults the process. nmbd stays down until it is started again, and the caller can send the datagram again.

The caller must reach UDP/138 while nmbd is running, and the destination name must be one nmbd registered. register_my_workgroup_and_names() registers the server names, types 0x00, 0x03, and 0x20, and the workgroup names, types 0x00 and 0x1e, on the unicast subnet. listening() accepts those names. The source name must be a name nmbd does not own, and the NetBIOS scope must match. process_host_announce() continues when the destination type is other than 0x1d and rewrites the type to 0x1d. No authentication is required.

The flaw is reachable when nmbd is running. No smb.conf change is required. nmbd.c does not consult the disable netbios parameter.

The strlen() form of this read was introduced in samba 3.0.0, released on 2003-09-25, by Jeremy Allison in commit dac11b890b on 2003-08-23, when these comments were converted to pull_ascii_fstring(). The parent of that commit wrote a zero at comment offset 43 instead of calling strlen(). The first tag with this call is samba-3.0.0rc2, tagged on 2003-08-29. The handlers have taken no remaining length since Jeremy Allison's nmbd rewrite, commit 64f0348a3f on 1997-12-13. The strlen() call is present from samba-3.0.0rc2 through the samba-4.25.2 tag, and on master at f748ad82c34. The length-check patch on the bug is not in those tags.

process_local_master_announce() has the same strlen() read of the comment at offset 31. process_workgroup_announce() reads a 16-byte name with strnlen() at offset 31. From the furthest pointer process_dgram() accepts, process_election() reads its name from the zeroed tail of data[].