CVE-2026-43671: SwiftNIO Out-of-bounds Write Vulnerability
HIGHCVE-2026-43671 is a HIGH out-of-bounds write vulnerability (CWE-787: Out-of-bounds Write) affecting SwiftNIO libraries in the SwiftURL ecosystem. The issue involves out-of-bounds write via bytebuffer index and length uint32 overflow. Remediation is available by upgrading affected packages to version 2.100.0.
CVE-2026-43671 at a Glance
How to Fix CVE-2026-43671
To remediate this vulnerability, upgrade all affected SwiftNIO dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/apple/swift-nio to 2.100.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/apple/swift-nio
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-43671, inspect your project dependencies for SwiftNIO:
inspect dependencies for github.com/apple/swift-nio
Analyze the terminal output to locate any version of SwiftNIO in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.100.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-787: Out-of-bounds Write, where the product writes data past the end, or before the beginning, of the intended buffer. In SwiftNIO, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-43671 Affected SwiftNIO Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/apple/swift-nio
|
SwiftURL |
≥ 1.0.0
< 2.100.0
|
2.100.0
|
References
Frequently Asked Questions
What is CVE-2026-43671?
Which SwiftNIO versions are affected?
What version fixes CVE-2026-43671?
Is github.com/apple/swift-nio affected?
What CWE is associated with CVE-2026-43671?
How can I check SwiftURL dependencies for CVE-2026-43671?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-r3rc-9hpw-54v9",
"modified" : "2026-06-12T15:07:23Z",
"published" : "2026-06-12T15:07:23Z",
"aliases" : [ "CVE-2026-43671" ],
"summary" : "SwiftNIO: Out-of-bounds write via ByteBuffer index and length UInt32 overflow",
"details" : "### Summary\n\nA 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.\n\n### Details\n\n`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`.\n\nThis 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.\n\nThe affected `ByteBuffer` methods that may lead to out-of-bounds writes are:\n\n- `copyBytes(at:to:length:)` — a crafted destination index exceeding `UInt32.max` could copy bytes to an incorrect offset.\n- `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.\n\nThe affected `ByteBuffer` methods that have logic errors but do neither expose out-of-bounds reads nor out-of-bounds writes:\n\n - `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.\n - The `ByteBuffer(takingOwnershipOf:allocator:)` initialiser — passing a buffer larger than `UInt32.max` bytes could create a `ByteBuffer` with an incorrect capacity.\n\nOutside 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.\n\n### Impact\n\nExploitation 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.\n\nOther applications may encounter logical issues due to reading unexpected bytes, or writing to unexpected parts of the buffer.\n\nWhen 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.\n\nIn 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.\n\n### Patches\n\nThe 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.\n\nOne 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`.\n\n### Workarounds\n\nApplications 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" : [ {
"type" : "CVSS_V4",
"score" : "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"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "SwiftURL",
"name" : "github.com/apple/swift-nio"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.0.0"
}, {
"fixed" : "2.100.0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 2.99.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/apple/swift-nio/security/advisories/GHSA-r3rc-9hpw-54v9"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/apple/swift-nio"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-787" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-06-12T15:07:23Z",
"nvd_published_at" : null
}
}