CVE-2022-3918
Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.
NVD · uneditedA program using FoundationNetworking in swift-corelibs-foundation is potentially vulnerable to CRLF ( ) injection in URLRequest headers. In this vulnerability, a client can insert one or several CRLF sequences into a URLRequest header value. When that request is sent via URLSession to an HTTP server, the server may interpret the content after the CRLF as extra headers, or even a second request. For example, consider a URLRequest to http://example.com/ with the GET method. Suppose we set the URLRequest header "Foo" to the value "Bar Extra-Header: Added GET /other HTTP/1.1". When this request is sent, it will appear to the server as two requests: GET / HTTP/1.1 Foo: Bar Extra-Header: Added GET /other HTTP/1.1 In this manner, the client is able to inject extra headers and craft an entirely new request to a separate path, despite only making one API call in URLSession. If a developer has total control over the request and its headers, this vulnerability may not pose a threat. However, this vulnerability escalates if un-sanitized user input is placed in header values. If so, a malicious user could inject new headers or requests to an intermediary or backend server. Developers should be especially careful to sanitize user input in this case, or upgrade their version of swift-corelibs-foundation to include the patch below.
Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.
dbcve analysis · high confidenceCRLF injection vulnerability in swift-corelibs-foundation allows attackers to inject newline characters into URLRequest header values, potentially splitting a single HTTP request into multiple requests or injecting arbitrary headers. This occurs because the library does not sanitize or reject CRLF sequences in header values before sending them via URLSession.
Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.
Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.
NVD · CPE data< 5.7.3CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.
From the vector- Attack vector
- Network
- Complexity
- Low
- Privileges
- Low
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.
dbcve checksWork through these to decide whether this CVE applies to you.
-
Identify Swift Foundation implementation in useDetermine if your application uses swift-corelibs-foundation (open source) versus Apple Foundation (macOS/iOS). Check your dependency manifest (Package.swift, Podfile, or similar) for 'swift-corelibs-foundation' or check runtime by inspecting the loaded library. On Linux, run 'swift --version' and check the Foundation library path.Affected if Using swift-corelibs-foundation (open source version) rather than Apple Foundation on macOS/iOS
-
Determine installed Swift versionRun 'swift --version' on the command line or programmatically get ProcessInfo.processInfo.swiftVersion. This returns the Swift language version which correlates to the Foundation version bundled with it.Affected if Swift version is below 5.7.3 (check against the affected range < 5.7.3)
-
Inspect code for URLRequest header manipulationSearch source code for instances of URLRequest, URLSession, or HTTPURLResponse where headers are set. Look for code that assigns user-supplied strings (query parameters, form input, database values, API responses) to HTTPHeader fields like 'allHTTPHeaderFields', 'value(forHTTPHeaderField:)', or direct property assignment.Affected if Code passes unsanitized user input directly into URLRequest header values without filtering CRLF sequences
-
Check for input sanitization functionsReview any utility functions, middleware, or validation layers that process data before using it in HTTP requests. Look for presence of validation logic that strips or rejects newline characters (\r, \n, \r\n) from header-bound data.Affected if No sanitization logic exists that explicitly rejects or strips CRLF sequences from data before header assignment
You are affected if your application uses swift-corelibs-foundation with Swift version below 5.7.3 AND passes external/unsanitized input into URLRequest header values.
Generated from the published advisory. Verify against your own configuration.
Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.
dbcve · scoped5.7.3
Sanitize all user input before using it in URLRequest header values, rejecting or stripping any CRLF sequences. Alternatively, upgrade to a patched version of swift-corelibs-foundation that implements validation to reject headers containing CRLF.
Swift Foundation 5.7.3
- Upgrade Swift Foundation to version 5.7.3 or later
- Verify the upgrade by checking the FoundationNetworking library version
- Test application to ensure URLSession requests handle header values correctly and that the CRLF injection is mitigated
- If using a package manager (Swift Package Manager), update the Package.swift dependency to specify swift-corelibs-foundation version 5.7.3 or later
- For CocoaPods users, update the Podfile to request Foundation version 5.7.3 or newer and run pod update
- For Carthage users, update Cartfile to fetch the corrected version and rebuild
Generated from the published advisory — verify against the referenced sources before acting.
- Consultation3.0 h
- Implementation6.0 h
- Testing3.0 h
- Review / QA2.0 h
An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $3,984.
Scan for this in your stack
Free · runs locallyCheck whether your project pulls in CVE-2022-3918 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.
References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.
Primary sourcesPractitioner notes
ContributedPeer-ranked notes from engineers who’ve handled CVE-2022-3918 in production — separate from our analysis above.
The advisory tells you what broke. It rarely tells you what actually worked. If you’ve dealt with this one, that detail is what the next engineer is searching for.
- The version that genuinely resolved it — not the one the vendor claimed
- A config change or rule that shut the vector down
- A gotcha in the upgrade path that cost you an afternoon
No notes yet
Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.
A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.
- Verified mitigations, workarounds, and config changes
- Version or environment caveats, and links to real fixes
- No weaponised exploit code, or anything meant to cause harm
- No spam, self-promotion, credentials, or personal data