CVE-2024-21668: React native mmkv React-native-mmkv Insertion Of Sensitive Information Vulnerability

MODERATE
Advisory Identifier: GHSA-4jh3-6jhv-2mgp
CVSS 4.4
CWE-532
Published
Advisory Summary

CVE-2024-21668 is a MODERATE (CVSS 4.4) react-native-mmkv insertion of sensitive information vulnerability (CWE-532: Insertion of Sensitive Information into Log File) affecting React native mmkv libraries in the npm ecosystem. The issue involves react-native-mmkv insertion of sensitive information into log file vulnerability. Remediation is available by upgrading affected packages to version 2.11.0.

CVE-2024-21668 at a Glance

CVE Identifier CVE-2024-21668
GHSA Identifier GHSA-4jh3-6jhv-2mgp
Severity MODERATE
CVSS v3.1 Base Score 4.4
CWE Classification CWE-532: Insertion of Sensitive Information into Log File
Affected Product React native mmkv
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 4.4

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2024-21668

To remediate this vulnerability, upgrade all affected React native mmkv dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

react-native-mmkv fixed: 2.11.0
npm install react-native-mmkv@2.11.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls react-native-mmkv

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-21668, inspect your project dependencies using npm:

npm ls react-native-mmkv

Analyze the terminal output to locate any version of React native mmkv in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.11.0), your application is affected.

Note: The npm ls react-native-mmkv command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-532: Insertion of Sensitive Information into Log File, where the product writes sensitive information to a log file. In React native mmkv, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary Before version [v2.11.0](https://github.com/mrousavy/react-native-mmkv/releases/tag/v2.11.0), the react-native-mmkv logged the optional encryption key for the MMKV database into the Android system log. The key can be obtained by anyone with access to the Android Debugging Bridge (ADB) if it is enabled in the phone settings. This bug is not present on iOS devices. ## Details The bridge for communicating between JS code and native code on Android logs the encryption key. This was fixed in commit [a8995cc](https://github.com/mrousavy/react-native-mmkv/commit/a8995ccb7184281f7d168bad3e9987c9bd05f00d) by only logging whether encryption is used. ## Impact The encryption of an MMKV database protects data from higher privilege processes on the phone that can access the app storage. Additionally, if data in the app's storage is encrypted, it is also encrypted in potential backups. By logging the encryption secret to the system logs, attackers can trivially recover the secret by enabling ADB and undermining an app's thread model. The bug was discovered and fixed by somebody else. Not me. I'm just reporting this so users of react-native-mmkv upgrade the dependency.

CVE-2024-21668 Affected React native mmkv Versions

1 component(s)
Fixed Versions:
2.11.0
Product / Package Ecosystem Affected Versions Fixed Version
react-native-mmkv
npm
< 2.11.0
2.11.0

References

Frequently Asked Questions

What is CVE-2024-21668?
CVE-2024-21668 is a security vulnerability in React native mmkv involving react-native-mmkv Insertion of Sensitive Information into Log File vulnerability under CWE-532: Insertion of Sensitive Information into Log File.
Which React native mmkv versions are affected?
Affected versions include releases prior to 2.11.0 across affected packages: react-native-mmkv.
What version fixes CVE-2024-21668?
Upgrading to 2.11.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is react-native-mmkv affected?
Yes, react-native-mmkv is affected in releases prior to 2.11.0. Upgrade your dependency to 2.11.0 or later.
What is the CVSS score of CVE-2024-21668?
CVE-2024-21668 has a CVSS v3.1 base score of 4.4 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2024-21668?
CVE-2024-21668 is classified under CWE-532: Insertion of Sensitive Information into Log File (The product writes sensitive information to a log file.).
How can I check npm dependencies for CVE-2024-21668?
Run the dependency tree command: 'npm ls react-native-mmkv'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-4jh3-6jhv-2mgp",
  "modified" : "2024-01-09T21:52:47Z",
  "published" : "2024-01-09T19:33:09Z",
  "aliases" : [ "CVE-2024-21668" ],
  "summary" : "react-native-mmkv Insertion of Sensitive Information into Log File vulnerability",
  "details" : "## Summary\nBefore version [v2.11.0](https://github.com/mrousavy/react-native-mmkv/releases/tag/v2.11.0), the react-native-mmkv logged the optional encryption key for the MMKV database into the Android system log. The key can be obtained by anyone with access to the Android Debugging Bridge (ADB) if it is enabled in the phone settings. This bug is not present on iOS devices.\n\n## Details\nThe bridge for communicating between JS code and native code on Android logs the encryption key. This was fixed in commit [a8995cc](https://github.com/mrousavy/react-native-mmkv/commit/a8995ccb7184281f7d168bad3e9987c9bd05f00d) by only logging whether encryption is used.\n\n## Impact\nThe encryption of an MMKV database protects data from higher privilege processes on the phone that can access the app storage. Additionally, if data in the app's storage is encrypted, it is also encrypted in potential backups.\nBy logging the encryption secret to the system logs, attackers can trivially recover the secret by enabling ADB and undermining an app's thread model.\n\nThe bug was discovered and fixed by somebody else. Not me. I'm just reporting this so users of react-native-mmkv upgrade the dependency.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "react-native-mmkv"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.11.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/mrousavy/react-native-mmkv/security/advisories/GHSA-4jh3-6jhv-2mgp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-21668"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mrousavy/react-native-mmkv/commit/a8995ccb7184281f7d168bad3e9987c9bd05f00d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mrousavy/react-native-mmkv"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mrousavy/react-native-mmkv/releases/tag/v2.11.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-532" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-01-09T19:33:09Z",
    "nvd_published_at" : "2024-01-09T19:15:12Z"
  }
}