CVE-2021-39168: @openzeppelin/contracts upgradeable TimelockController Vulnerability Vulnerability
CRITICALCVE-2021-39168 is a CRITICAL (CVSS 10.0) timelockcontroller vulnerability vulnerability (CWE-269: Improper Privilege Management) affecting @openzeppelin/contracts upgradeable libraries in the npm ecosystem. The issue involves timelockcontroller vulnerability in openzeppelin contracts. Remediation is available by upgrading affected packages to version 4.3.1, 3.4.2.
CVE-2021-39168 at a Glance
Security Impact
CVSS: 10.0
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:C/C:H/I:H/A:H).
How to Fix CVE-2021-39168
To remediate this vulnerability, upgrade all affected @openzeppelin/contracts upgradeable dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install @openzeppelin/contracts-upgradeable@4.3.1
npm install @openzeppelin/contracts-upgradeable@3.4.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @openzeppelin/contracts-upgradeable
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-39168, inspect your project dependencies using npm:
npm ls @openzeppelin/contracts-upgradeable
Analyze the terminal output to locate any version of @openzeppelin/contracts upgradeable in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.3.1), your application is affected.
Note: The npm ls @openzeppelin/contracts-upgradeable 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-269: Improper Privilege Management, where the product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor. In @openzeppelin/contracts upgradeable, 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
CVE-2021-39168 Affected @openzeppelin/contracts upgradeable Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@openzeppelin/contracts-upgradeable
|
npm |
≥ 4.0.0
< 4.3.1
|
4.3.1
|
|
@openzeppelin/contracts-upgradeable
|
npm |
≥ 3.3.0
< 3.4.2
|
3.4.2
|
References
Frequently Asked Questions
What is CVE-2021-39168?
Which @openzeppelin/contracts upgradeable versions are affected?
What version fixes CVE-2021-39168?
Is @openzeppelin/contracts-upgradeable affected?
What is the CVSS score of CVE-2021-39168?
What CWE is associated with CVE-2021-39168?
How can I check npm dependencies for CVE-2021-39168?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-vrw4-w73r-6mm8",
"modified" : "2021-09-13T20:30:25Z",
"published" : "2021-08-30T16:12:49Z",
"aliases" : [ "CVE-2021-39168" ],
"summary" : "TimelockController vulnerability in OpenZeppelin Contracts",
"details" : "### Impact\n\nA vulnerability in `TimelockController` allowed an actor with the executor role to take immediate control of the timelock, by resetting the delay to 0 and escalating privileges, thus gaining unrestricted access to assets held in the contract. Instances with the executor role set to \"open\" allow anyone to use the executor role, thus leaving the timelock at risk of being taken over by an attacker.\n\n### Patches\n\nA fix is included in the following releases of `@openzeppelin/contracts` and `@openzeppelin/contracts-upgradeable`:\n- 4.3.1\n- 3.4.2\n- 3.4.2-solc-0.7\n\nDeployed instances of `TimelockController` should be replaced with a fixed version by migrating all assets, ownership, and roles.\n\n### Workarounds\n\nRevoke the executor role from accounts not strictly under the team's control. We recommend revoking all executors that are not also proposers. When applying this mitigation, ensure there is at least one proposer and executor remaining.\n\n### References\n\n[Post-mortem](https://forum.openzeppelin.com/t/timelockcontroller-vulnerability-postmortem/14958).\n\n### Credits\n\nThe issue was identified by an anonymous white hat hacker through [Immunefi](https://immunefi.com/).\n\n### For more information\n\nIf you have any questions or comments about this advisory, or need assistance executing the mitigation, email us at security@openzeppelin.com.\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@openzeppelin/contracts-upgradeable"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.3.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "@openzeppelin/contracts-upgradeable"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.3.0"
}, {
"fixed" : "3.4.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/security/advisories/GHSA-vrw4-w73r-6mm8"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-39168"
}, {
"type" : "WEB",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts/commit/cec4f2ef57495d8b1742d62846da212515d99dd5"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeabl"
}, {
"type" : "WEB",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/CHANGELOG.md#431"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-269" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2021-08-27T12:57:31Z",
"nvd_published_at" : "2021-08-27T00:15:00Z"
}
}