GHSA-w8xv-rwgf-4fwh

Suggest an improvement
Source
https://github.com/advisories/GHSA-w8xv-rwgf-4fwh
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/01/GHSA-w8xv-rwgf-4fwh/GHSA-w8xv-rwgf-4fwh.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-w8xv-rwgf-4fwh
Aliases
  • CVE-2025-0343
Published
2025-01-14T16:32:07Z
Modified
2025-01-15T15:26:01Z
Summary
CVE-2025-0343: Swift ASN.1 can crash when parsing maliciously formed BER/DER
Details

Swift ASN.1 can be caused to crash when parsing certain BER/DER constructions. This crash is caused by a confusion in the ASN.1 library itself which assumes that certain objects can only be provided in either constructed or primitive forms, and will trigger a preconditionFailure if that constraint isn't met.

Importantly, these constraints are actually required to be true in DER, but that correctness wasn't enforced on the early node parser side so it was incorrect to rely on it later on in decoding, which is what the library did.

These crashes can be triggered when parsing any DER/BER format object. There is no memory-safety issue here: the crash is a graceful one from the Swift runtime. The impact of this is that it can be used as a denial-of-service vector when parsing BER/DER data from unknown sources, e.g. when parsing TLS certificates.

Many thanks to @baarde for reporting this issue and providing the fix.

Database specific
{
    "nvd_published_at": "2025-01-15T01:15:13Z",
    "cwe_ids": [
        "CWE-228"
    ],
    "severity": "LOW",
    "github_reviewed": true,
    "github_reviewed_at": "2025-01-14T16:32:07Z"
}
References

Affected packages

SwiftURL / github.com/apple/swift-asn1

Package

Name
github.com/apple/swift-asn1
Purl
pkg:swift/github.com/apple/swift-asn1

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
1.3.1

Database specific

{
    "last_known_affected_version_range": "<= 1.3.0"
}