ID

VAR-202206-1379


CVE

CVE-2022-1642


TITLE

Swift  Illegal type conversion vulnerabilities in

Trust: 0.8

sources: JVNDB: JVNDB-2022-014677

DESCRIPTION

A program using swift-corelibs-foundation is vulnerable to a denial of service attack caused by a potentially malicious source producing a JSON document containing a type mismatch. This vulnerability is caused by the interaction between a deserialization mechanism offered by the Swift standard library, the Codable protocol; and the JSONDecoder class offered by swift-corelibs-foundation, which can deserialize types that adopt the Codable protocol based on the content of a provided JSON document. When a type that adopts Codable requests the initialization of a field with an integer value, the JSONDecoder class uses a type-erased container with different accessor methods to attempt and coerce a corresponding JSON value and produce an integer. In the case the JSON value was a numeric literal with a floating-point portion, JSONDecoder used different type-eraser methods during validation than it did during the final casting of the value. The checked casting produces a deterministic crash due to this mismatch. The JSONDecoder class is often wrapped by popular Swift-based web frameworks to parse the body of HTTP requests and perform basic type validation. This makes the attack low-effort: sending a specifically crafted JSON document during a request to these endpoints will cause them to crash. The attack does not have any confidentiality or integrity risks in and of itself; the crash is produced deterministically by an abort function that ensures that execution does not continue in the face of this violation of assumptions. However, unexpected crashes can lead to violations of invariants in services, so it's possible that this attack can be used to trigger error conditions that escalate the risk. Producing a denial of service may also be the goal of an attacker in itself. This issue is solved in Swift 5.6.2 for Linux and Windows. This issue was solved by ensuring that the same methods are invoked both when validating and during casting, so that no type mismatch occurs. Swift for Linux and Windows versions are not ABI-interchangeable. To upgrade a service, its owner must update to this version of the Swift toolchain, then recompile and redeploy their software. The new version of Swift includes an updated swift-corelibs-foundation package. Versions of Swift running on Darwin-based operating systems are not affected. Swift Exists in a vulnerability related to illegal type conversion.Service operation interruption (DoS) It may be in a state

Trust: 1.8

sources: NVD: CVE-2022-1642 // JVNDB: JVNDB-2022-014677 // VULHUB: VHN-419755 // VULMON: CVE-2022-1642

AFFECTED PRODUCTS

vendor:applemodel:swiftscope:ltversion:5.6.2

Trust: 1.0

vendor:アップルmodel:swiftscope:eqversion:5.6.2

Trust: 0.8

vendor:アップルmodel:swiftscope:eqversion: -

Trust: 0.8

sources: JVNDB: JVNDB-2022-014677 // NVD: CVE-2022-1642

CVSS

SEVERITY

CVSSV2

CVSSV3

nvd@nist.gov: CVE-2022-1642
value: HIGH

Trust: 1.0

NVD: CVE-2022-1642
value: HIGH

Trust: 0.8

CNNVD: CNNVD-202206-1609
value: HIGH

Trust: 0.6

VULHUB: VHN-419755
value: MEDIUM

Trust: 0.1

nvd@nist.gov: CVE-2022-1642
severity: MEDIUM
baseScore: 5.0
vectorString: AV:N/AC:L/AU:N/C:N/I:N/A:P
accessVector: NETWORK
accessComplexity: LOW
authentication: NONE
confidentialityImpact: NONE
integrityImpact: NONE
availabilityImpact: PARTIAL
exploitabilityScore: 10.0
impactScore: 2.9
acInsufInfo: NONE
obtainAllPrivilege: NONE
obtainUserPrivilege: NONE
obtainOtherPrivilege: NONE
userInteractionRequired: NONE
version: 2.0

Trust: 1.8

VULHUB: VHN-419755
severity: MEDIUM
baseScore: 5.0
vectorString: AV:N/AC:L/AU:N/C:N/I:N/A:P
accessVector: NETWORK
accessComplexity: LOW
authentication: NONE
confidentialityImpact: NONE
integrityImpact: NONE
availabilityImpact: PARTIAL
exploitabilityScore: 10.0
impactScore: 2.9
acInsufInfo: NONE
obtainAllPrivilege: NONE
obtainUserPrivilege: NONE
obtainOtherPrivilege: NONE
userInteractionRequired: NONE
version: 2.0

Trust: 0.1

nvd@nist.gov: CVE-2022-1642
baseSeverity: HIGH
baseScore: 7.5
vectorString: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
attackVector: NETWORK
attackComplexity: LOW
privilegesRequired: NONE
userInteraction: NONE
scope: UNCHANGED
confidentialityImpact: NONE
integrityImpact: NONE
availabilityImpact: HIGH
exploitabilityScore: 3.9
impactScore: 3.6
version: 3.1

Trust: 1.0

NVD: CVE-2022-1642
baseSeverity: HIGH
baseScore: 7.5
vectorString: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
attackVector: NETWORK
attackComplexity: LOW
privilegesRequired: NONE
userInteraction: NONE
scope: UNCHANGED
confidentialityImpact: NONE
integrityImpact: NONE
availabilityImpact: HIGH
exploitabilityScore: NONE
impactScore: NONE
version: 3.0

Trust: 0.8

sources: VULHUB: VHN-419755 // JVNDB: JVNDB-2022-014677 // CNNVD: CNNVD-202206-1609 // NVD: CVE-2022-1642

PROBLEMTYPE DATA

problemtype:CWE-704

Trust: 1.1

problemtype:CWE-241

Trust: 1.0

problemtype:CWE-351

Trust: 1.0

problemtype:Illegal type conversion or cast (CWE-704) [NVD evaluation ]

Trust: 0.8

sources: VULHUB: VHN-419755 // JVNDB: JVNDB-2022-014677 // NVD: CVE-2022-1642

THREAT TYPE

remote

Trust: 0.6

sources: CNNVD: CNNVD-202206-1609

TYPE

code problem

Trust: 0.6

sources: CNNVD: CNNVD-202206-1609

PATCH

title:Possible DoS in JSON decoding with JSONDecoderurl:https://github.com/apple/swift-corelibs-foundation/security/advisories/GHSA-239c-6cv2-wwx8

Trust: 0.8

title:Apple Swift Fixes for code issue vulnerabilitiesurl:http://www.cnnvd.org.cn/web/xxk/bdxqById.tag?id=198746

Trust: 0.6

sources: JVNDB: JVNDB-2022-014677 // CNNVD: CNNVD-202206-1609

EXTERNAL IDS

db:NVDid:CVE-2022-1642

Trust: 3.4

db:JVNDBid:JVNDB-2022-014677

Trust: 0.8

db:CNNVDid:CNNVD-202206-1609

Trust: 0.6

db:VULHUBid:VHN-419755

Trust: 0.1

db:VULMONid:CVE-2022-1642

Trust: 0.1

sources: VULHUB: VHN-419755 // VULMON: CVE-2022-1642 // JVNDB: JVNDB-2022-014677 // CNNVD: CNNVD-202206-1609 // NVD: CVE-2022-1642

REFERENCES

url:https://github.com/apple/swift-corelibs-foundation/security/advisories/ghsa-239c-6cv2-wwx8

Trust: 1.8

url:https://nvd.nist.gov/vuln/detail/cve-2022-1642

Trust: 0.8

url:https://cxsecurity.com/cveshow/cve-2022-1642/

Trust: 0.6

url:https://nvd.nist.gov

Trust: 0.1

sources: VULHUB: VHN-419755 // VULMON: CVE-2022-1642 // JVNDB: JVNDB-2022-014677 // CNNVD: CNNVD-202206-1609 // NVD: CVE-2022-1642

SOURCES

db:VULHUBid:VHN-419755
db:VULMONid:CVE-2022-1642
db:JVNDBid:JVNDB-2022-014677
db:CNNVDid:CNNVD-202206-1609
db:NVDid:CVE-2022-1642

LAST UPDATE DATE

2024-11-23T21:32:23.905000+00:00


SOURCES UPDATE DATE

db:VULHUBid:VHN-419755date:2022-07-05T00:00:00
db:VULMONid:CVE-2022-1642date:2022-06-16T00:00:00
db:JVNDBid:JVNDB-2022-014677date:2023-09-21T01:19:00
db:CNNVDid:CNNVD-202206-1609date:2022-07-06T00:00:00
db:NVDid:CVE-2022-1642date:2024-11-21T06:41:09.587

SOURCES RELEASE DATE

db:VULHUBid:VHN-419755date:2022-06-16T00:00:00
db:VULMONid:CVE-2022-1642date:2022-06-16T00:00:00
db:JVNDBid:JVNDB-2022-014677date:2023-09-21T00:00:00
db:CNNVDid:CNNVD-202206-1609date:2022-06-16T00:00:00
db:NVDid:CVE-2022-1642date:2022-06-16T17:15:07.763