Executive brief
SwiftNIO, a high-performance networking framework for Apple platforms, is vulnerable to memory corruption. An attacker who can provide extremely large values (over 4GB) for data lengths or positions could cause the application to write data to the wrong memory location. This could lead to application crashes, data corruption, or potentially allow an attacker to gain further control over the system.
Technical details
The vulnerability exists in SwiftNIO's ByteBuffer implementation where internal helper functions _toIndex and _toCapacity used UInt32(truncatingIfNeeded:) to convert Int values. On 64-bit platforms, this silently discards the upper 32 bits of values exceeding 4,294,967,295, causing bounds checks to pass incorrectly. Affected methods include copyBytes(at:to:length:) and writeWithUnsafeMutableBytes(minimumWritableBytes:). An attacker who can influence these parameters can trigger out-of-bounds memory writes, potentially corrupting adjacent heap memory in optimized release builds. The issue is fixed in version 2.100.0 by using the standard UInt32(_:) initializer which traps on overflow.
Affected products
- Apple swift-nio >= 1.0.0, <= 2.99.0
Timeline
- 2026-05-21: disclosed
- 2026-06-12: advisory: GitHub Advisory published