CVE-2021-39167 is a critical-severity (CVSS 9.8) Improper Privilege Management vulnerability in @openzeppelin/contracts. A fix is available for @openzeppelin/contracts — see the affected versions and patch details below.
TimelockController vulnerability in OpenZeppelin Contracts
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
CVE-2021-39167 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 385,386 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
@openzeppelin/contractsnpmDescription
Impact
A 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.
Patches
A fix is included in the following releases of @openzeppelin/contracts and @openzeppelin/contracts-upgradeable:
- 4.3.1
- 3.4.2
- 3.4.2-solc-0.7
Deployed instances of TimelockController should be replaced with a fixed version by migrating all assets, ownership, and roles.
Workarounds
Revoke 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.
References
Credits
The issue was identified by an anonymous white hat hacker through Immunefi.
For more information
If you have any questions or comments about this advisory, or need assistance executing the mitigation, email us at [email protected].
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | @openzeppelin/contracts | ≥ 4.0.0&&< 4.3.1 | 4.3.1npm install @openzeppelin/contracts@4.3.1 |
| 📦npm | @openzeppelin/contracts | ≥ 3.3.0&&< 3.4.2 | 3.4.2npm install @openzeppelin/contracts@3.4.2 |
Affected Products
contractsopenzeppelinDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @openzeppelin/contracts, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update @openzeppelin/contracts to 4.3.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-39167 is resolved across your whole dependency graph.
Workarounds
Close the privilege gap rather than the entry point: audit which accounts, roles and service identities can reach the affected operation, drop the component to the least privilege it actually needs, and review file and directory permissions created by earlier installs — a default left in place is what makes this reachable.
Frequently Asked Questions
Is CVE-2021-39167 in your dependencies?
Find it across npm, including transitive dependencies.