CyberSecBulletin
CVE-2022-40138NVD status: Modified

Hermes: Incorrect Conversion between Numeric Types

CVE-2022-40138 is a critical-severity incorrect conversion between numeric types vulnerability in Hermes from Facebook, with a CVSS 3.1 base score of 9.8 out of 10. It can be exploited remotely over the network by an unauthenticated attacker, without any action from a user. The record lists version commit prior to 6aa825e480d48127b480b08d13adf70033237097 as the first without the flaw, so updating Hermes to that release or later removes the exposure. There is no confirmed exploitation so far. EPSS estimates a 1.21% chance of exploitation within 30 days, higher than 69% of scored CVEs.

Patch this week

Critical severity: a successful attack would have severe impact.

What to do

  1. Update Hermes to commit prior to 6aa825e480d48127b480b08d13adf70033237097 or a later version.
  2. Read the advisory on facebook.com for workarounds and exact fixed builds.
  3. Until you can update, restrict network access to the affected service so it is not reachable from untrusted networks.

Affected products and versions

VendorProductAffected versionsFixed in
FacebookHermesbefore commit prior to 6aa825e480d48127b480b08d13adf70033237097commit prior to 6aa825e480d48127b480b08d13adf70033237097

Version data comes from the organisation that assigned the CVE. Confirm against the vendor advisory before deciding you are unaffected.

How the severity score breaks down

Attack vector
NetworkCan be exploited remotely over a network, including the internet.
Attack complexity
LowNo special conditions are needed; the attack works reliably.
Privileges required
NoneNo account or login is needed.
User interaction
NoneNo action by a victim is required.
Scope
UnchangedImpact stays within the vulnerable component.
Confidentiality
HighAll data handled by the component can be read.
Integrity
HighData or code can be modified at will.
Availability
HighThe component can be taken down completely.

Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H. Scored by NVD.

Official description

An integer conversion error in Hermes bytecode generation, prior to commit 6aa825e480d48127b480b08d13adf70033237097, could have been used to perform Out-Of-Bounds operations and subsequently execute arbitrary code. Note that this is only exploitable in cases where Hermes is used to execute untrusted JavaScript. Hence, most React Native applications are not affected.

Source: the CVE record as published by its numbering authority, via NVD and CVE.org.

The underlying weakness: Incorrect Conversion between Numeric Types

When converting from one data type to another, such as long to integer, data can be omitted or translated in a way that produces unexpected values. If the resulting values are used in a sensitive context, then dangerous behaviors may occur.

How developers prevent this class of flaw

  • Avoid making conversion between numeric types. Always check for the allowed ranges.

More Incorrect Conversion between Numeric Types vulnerabilities (CWE-681)

Timeline

  1. CVE record published.
  2. Record last changed materially (score, affected products, status or references).

References

Other vulnerabilities in Hermes

All Hermes vulnerabilities

Recent Incorrect Conversion between Numeric Types vulnerabilities

Spotted an error? Tell us.