CVE-2020-7788: Ini Ini Before 1.3.6 Vulnerable To Vulnerability

HIGH
Advisory Identifier: GHSA-qqgx-2p2h-9c37
CVSS 7.3
CWE-1321
Published
Advisory Summary

CVE-2020-7788 is a HIGH (CVSS 7.3) ini before 1.3.6 vulnerable to vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Ini libraries in the npm ecosystem. The issue involves ini before 1.3.6 vulnerable to prototype pollution via ini.parse. Remediation is available by upgrading affected packages to version 1.3.6.

CVE-2020-7788 at a Glance

CVE Identifier CVE-2020-7788
GHSA Identifier GHSA-qqgx-2p2h-9c37
Severity HIGH
CVSS v3.1 Base Score 7.3
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product Ini
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.3

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

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

How to Fix CVE-2020-7788

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

ini fixed: 1.3.6
npm install ini@1.3.6
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 ini

How to Check if You Are Affected

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

npm ls ini

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

Note: The npm ls ini 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-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. In Ini, 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

### Overview The `ini` npm package before version 1.3.6 has a Prototype Pollution vulnerability. If an attacker submits a malicious INI file to an application that parses it with `ini.parse`, they will pollute the prototype on the application. This can be exploited further depending on the context. ### Patches This has been patched in 1.3.6. ### Steps to reproduce payload.ini ``` [__proto__] polluted = "polluted" ``` poc.js: ``` var fs = require('fs') var ini = require('ini') var parsed = ini.parse(fs.readFileSync('./payload.ini', 'utf-8')) console.log(parsed) console.log(parsed.__proto__) console.log(polluted) ``` ``` > node poc.js {} { polluted: 'polluted' } { polluted: 'polluted' } polluted ```

CVE-2020-7788 Affected Ini Versions

1 component(s)
Fixed Versions:
1.3.6
Product / Package Ecosystem Affected Versions Fixed Version
ini
npm
< 1.3.6
1.3.6

References

Frequently Asked Questions

What is CVE-2020-7788?
CVE-2020-7788 is a security vulnerability in Ini involving ini before 1.3.6 vulnerable to Prototype Pollution via ini.parse under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which Ini versions are affected?
Affected versions include releases prior to 1.3.6 across affected packages: ini.
What version fixes CVE-2020-7788?
Upgrading to 1.3.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ini affected?
Yes, ini is affected in releases prior to 1.3.6. Upgrade your dependency to 1.3.6 or later.
What is the CVSS score of CVE-2020-7788?
CVE-2020-7788 has a CVSS v3.1 base score of 7.3 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2020-7788?
CVE-2020-7788 is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') (The product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.).
How can I check npm dependencies for CVE-2020-7788?
Run the dependency tree command: 'npm ls ini'. 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-qqgx-2p2h-9c37",
  "modified" : "2022-12-03T03:55:11Z",
  "published" : "2020-12-10T16:53:45Z",
  "aliases" : [ "CVE-2020-7788" ],
  "summary" : "ini before 1.3.6 vulnerable to Prototype Pollution via ini.parse",
  "details" : "### Overview\nThe `ini` npm package before version 1.3.6 has a Prototype Pollution vulnerability.\n\nIf an attacker submits a malicious INI file to an application that parses it with `ini.parse`, they will pollute the prototype on the application. This can be exploited further depending on the context.\n\n### Patches\n\nThis has been patched in 1.3.6.\n\n### Steps to reproduce\n\npayload.ini\n```\n[__proto__]\npolluted = \"polluted\"\n```\n\npoc.js:\n```\nvar fs = require('fs')\nvar ini = require('ini')\n\nvar parsed = ini.parse(fs.readFileSync('./payload.ini', 'utf-8'))\nconsole.log(parsed)\nconsole.log(parsed.__proto__)\nconsole.log(polluted)\n```\n\n```\n> node poc.js\n{}\n{ polluted: 'polluted' }\n{ polluted: 'polluted' }\npolluted\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "ini"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.3.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-7788"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/ini/commit/56d2805e07ccd94e2ba0984ac9240ff02d44b6f1"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/npm/ini"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2020/12/msg00032.html"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-INI-1048974"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1589"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1321" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-12-10T16:51:39Z",
    "nvd_published_at" : "2020-12-11T11:15:00Z"
  }
}