[HLE/net] WSAConnectByList builds an unbounded slice from a title-supplied count #428
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork#428
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@joseschesben-collab on GitHub · 2026-11-25 00:42 UTC · original
Severity: medium (unbounded read / immediate UB in the emulator at an HLE boundary)
File:
crates/victory-hle/src/modules/net.rs:310-321(especially 313-315)HEAD:
a803c87c48078e57b296e06e08146d7ceca44530Proof
WSAConnectByListreadsiAddressCountfrom the title'sSOCKET_ADDRESS_LIST. The conversion already treats the count as untrusted:but
countis then used directly as the slice length, with no upper bound and no check against the bytes actually present in the structure.SocketAddressis 16 bytes on x64 (*const u8+i32+ padding).A single
connect-by-listcall with one real entry (16 bytes of payload) andiAddressCount = 0x7FFFFFFFcreates a slice of roughly 34 GB starting at that 16-byte buffer.entries.iter()at lines 316-319 reads out of the allocation asSocketAddressvalues — undefined behavior beforereachable()even gets a chance to reject the address.Expected vs actual
WSAEINVAL/WSAENETUNREACH) or examines only the entries actually present.&[SocketAddress]of arbitrary length; arbitrary memory is deserialized as address pointers and lengths.Suggested fix
Put a ceiling on the count (e.g. 64) and/or avoid constructing the slice: walk the entries with
checked_add/checked_mulinside an explicit bound,read_unaligned()eachSocketAddress, and validateaddr/lenbefore reading — the same waysocket_addr()already validateslen.Duplicates
None of the 422 existing issues mention
net.rs, Winsock,WSA*, sockets or connect-by-list. The closest by theme is #161 (HLE last-error behavior), which is unrelated.github-bot referenced this issue2026-11-26 03:44:00 +00:00
github-bot referenced this issue2026-11-26 03:44:45 +00:00