CVE-2022-1642
Swift vulnerability analysis and mitigation

Overview

CVE-2022-1642 is a vulnerability in swift-corelibs-foundation that was disclosed on June 16, 2022. The vulnerability affects programs using swift-corelibs-foundation up to version 5.6.1, making them susceptible to denial of service attacks through malicious JSON document processing (GitHub Advisory).

Technical details

The vulnerability stems from the interaction between the Swift standard library's Codable protocol and the JSONDecoder class. When deserializing JSON data containing numeric values with floating-point portions into integer fields, JSONDecoder uses different type-eraser methods during validation than during final casting. This mismatch in type handling methods leads to a deterministic crash. The issue particularly affects Swift-based web frameworks that use JSONDecoder to parse HTTP request bodies (GitHub Advisory).

Impact

The vulnerability allows attackers to cause denial of service by sending specifically crafted JSON documents to affected endpoints. While the vulnerability itself doesn't directly compromise confidentiality or integrity, the resulting crashes could potentially trigger error conditions that might lead to more severe security implications. The issue primarily affects Swift applications running on Linux and Windows platforms (GitHub Advisory).

Mitigation and workarounds

The vulnerability was patched in Swift 5.6.2 for Linux and Windows platforms. Users should upgrade to this version and recompile their applications. As a temporary workaround, users can either ensure JSON numeric fields don't contain fractional parts or use JSONSerialization class instead of JSONDecoder. Notably, versions of Swift running on Darwin-based operating systems are not affected by this vulnerability (GitHub Advisory).

Additional resources


SourceThis report was generated using AI

Related Swift vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-54951CRITICAL9.8
  • JavaJava
  • executorch
NoYesAug 07, 2025
CVE-2025-54950CRITICAL9.8
  • JavaJava
  • org.pytorch:executorch-android
NoYesAug 07, 2025
GHSA-88q6-jcjg-hvmwHIGH8.8
  • SwiftSwift
  • github.com/beatt83/jose-swift
NoNoJan 09, 2026
GHSA-xvr7-p2c6-j83wMEDIUM6.3
  • SwiftSwift
  • github.com/apple/swift-nio-http2
NoYesAug 13, 2025
GHSA-pc9j-5v36-2mwwLOW3.7
  • SwiftSwift
  • github.com/awslabs/aws-sdk-swift
NoYesJan 08, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management