CVE Watchtower

CVE-2026-43671github.com/apple/swift-nio >= 1.0.0, Out-of-bounds Write

NVD

Vulnerability Summary

### Summary

A program using swift-nio is vulnerable to a potential out-of-bounds write when attacker-controlled index or length values exceeding `UInt32.max` are passed to some `ByteBuffer` methods. This affects all swift-nio versions from 1.0.0 to 2.99.0. It is fixed in 2.100.0 and later releases.

### Details

`ByteBuffer` internally stores indices and capacities as `UInt32` values. The internal helper functions `_toIndex` and `_toCapacity`, which convert from `Int` to `UInt32`, used `UInt32(truncatingIfNeeded:)`. On 64-bit platforms, this silently discards the upper 32 bits of the value rather than trapping on overflow. For example, a value of `UInt32.max + 1` (0x100000000) would be truncated to `0`.

This truncation can cause safety preconditions to pass when they should fail. Subsequent operations would then use the incorrect truncated value, potentially leading to out-of-bounds memory writes or reads.

The affected `ByteBuffer` methods that may lead to out-of-bounds writes are:

- `copyBytes(at:to:length:)` — a crafted destination index exceeding `UInt32.max` could copy bytes to an incorrect offset.
- `writeWithUnsafeMutableBytes(minimumWritableBytes:)` — a crafted `minimumWritableBytes` exceeding `UInt32.max` could provide the caller with a buffer pointer of incorrect length, which can easily be subsequently overflowed.

The affected `ByteBuffer` methods that have logic errors but do neither expose out-of-bounds reads nor out-of-bounds writes:

- `moveReaderIndex(forwardBy:)` / `moveWriterIndex(forwardBy:)` — a crafted offset exceeding `UInt32.max` could move indices to incorrect positions, bypassing bounds checks. These indices cannot be out of the bounds of the buffer, so they do not expose access to uninitialized memory or produce wild pointers.
- The `ByteBuffer(takingOwnershipOf:allocator:)` initialiser — passing a buffer larger than `UInt32.max` bytes could create a `ByteBuffer` with an incorrect capacity.

Outside of these methods, there are still impacts, but they are simply logical bugs. In these cases applications can be forced to read from or write to unexpected parts of the buffer. This does not cause memory-safety issues, but it can cause logical issues or corruption of outbound packets.

### Impact

Exploitation requires an attacker to influence the `index`, `offset`, or `length` parameter of the affected `ByteBuffer` methods with a value exceeding `UInt32.max` (approximately 4 GiB). This is a high bar for most applications: attacker-controlled length parameters to ByteBuffer are typically used on the read path, and the above methods are typically not used on the read paths. However, applications that calculate buffer positions arithmetically from untrusted input when attempting to do writes, or that process very large payloads, may be at risk of memory safety issues.

Other applications may encounter logical issues due to reading unexpected bytes, or writing to unexpected parts of the buffer.

When the memory-safety issue is exploitable, the consequences are severe. Because `truncatingIfNeeded` silently produces an incorrect but valid `UInt32` value, subsequent operations may write to or read from memory outside the valid buffer region. In optimised (release) builds where preconditions are not checked, this could lead to out-of-bounds memory writes, potentially corrupting adjacent heap memory.

In debug builds, some of these conditions are caught by assertions, but `truncatingIfNeeded` occurs before the assertion checks the (already-truncated) value, so even assertions may not reliably catch the issue.

### Patches

The issue is fixed by replacing `UInt32(truncatingIfNeeded:)` with `UInt32(_:)` in the `_toIndex` and `_toCapacity` helper functions. The `UInt32(_:)` initialiser traps on overflow in both debug and release builds, converting a potential silent memory corruption into a deterministic crash.

One call site in `getSlice(at:length:)` retains `truncatingIfNeeded` because prior bounds checks against the non-truncated `Int` values mathematically guarantee the values fit within `UInt32`.

### Workarounds

Applications can mitigate this issue by validating that all index and length values passed to `ByteBuffer` methods do not exceed `UInt32.max` (4,294,967,295). In practice, most applications are not affected because buffer indices are derived from protocol parsing rather than raw untrusted input.
Severity Level
HIGH
Published Date
Jun 12, 2026
Last Modified
Jun 12, 2026
Exploitation Status
No confirmed exploitation yet
CVE Record Status
Reserved
This CVE ID is referenced in a public advisory, but the CVE Program has not published its official CVE Record yet. Full CVSS/CPE data from NVD will appear here once it does.
EPSS Score (30-Day)
0.04%Probability
Root Weakness (CWE)
The product writes data past the end, or before the beginning, of the intended buffer.
CVSS v4.0 Base Metrics — Score 8.3
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:L/VI:H/VA:L/SC:N/SI:N/SA:N
Attack VectorNetwork
Attack ComplexityHigh
Attack RequirementsPresent
Privileges RequiredNone
User InteractionNone
Confidentiality (Vulnerable System)Low
Integrity (Vulnerable System)High
Availability (Vulnerable System)Low
Confidentiality (Subsequent System)None
Integrity (Subsequent System)None
Availability (Subsequent System)None

Affected & Patched Versions

Affected Versions
  • github.com/apple/swift-nio >= 1.0.0, <= 2.99.0
Patched Versions
No patched version published yet
Until a fix ships, reduce exposure:
  • Restrict access to the affected service or interface to trusted networks.
  • Disable the affected feature if you do not need it.
  • Watch the vendor advisory for a firmware or software update.

What to do

Plan remediation soon. No exploitation is confirmed yet, but the severity is high.

  1. Check whether you run github.com/apple/swift-nio >= 1.0.0, and which version.
  2. No patched version is listed yet. Limit access to the affected service to trusted networks, and disable the feature if you can.
  3. Subscribe to the vendor advisory so you learn when a fix ships.

Timeline

  • Jun 12, 2026Published
  • Jun 12, 2026Record last modified

Score, severity and exploitation changes are tracked from the day Watchtower started logging them.

Get notified about new github.com/apple/swift-nio >= 1.0.0, CVEsYou are reading CVE-2026-43671. Get an email when KEV listings, exploits or new CVEs match your stack.
Set up CVE alerts

Data last checked: Nov 14, 2026 11:00 UTC