Skip to content
Smart contracts Audit finding Intermediate

Update initializer modifier to prevent reentrancy during initialization

The project used outdated OpenZeppelin contracts with a known reentrancy vulnerability in the initializer modifier, affecting several upgradeable contracts. An attacker could potentially reenter during initialization, though the exact impact is not detailed in the text.

Dravee Follow

Originally disclosed on Code4rena

Submitted by Dravee

package.json#L18-L19

The solution uses:

    "@openzeppelin/contracts": "^4.0.0",
    "@openzeppelin/contracts-upgradeable": "^4.3.2",

These dependencies have a known high severity vulnerability:

Which makes these contracts vulnerable:

contracts/helpers/CryptoPunksHelper.sol:
  19:     function initialize(address punksAddress) external initializer {

contracts/helpers/EtherRocksHelper.sol:
  19:     function initialize(address rocksAddress) external initializer {

contracts/staking/JPEGStaking.sol:
  21:     function initialize(IERC20Upgradeable _jpeg) external initializer {

contracts/vaults/FungibleAssetVaultForDAO.sol:
  71:     ) external initializer {

contracts/vaults/NFTVault.sol:
  149:     ) external initializer {

Recommended Mitigation Steps

Upgrade @openzeppelin/contracts and @openzeppelin/contracts-upgradeable to version 4.4.1 or higher.

spaghettieth (JPEG’d) confirmed, but disagreed with High severity

spaghettieth (JPEG’d) resolved and commented:

Fixed in jpegd/core#11.


The original report as published on Code4rena, by Dravee. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

The vulnerability could allow reentrancy during initialization, but the text does not specify the exact consequences.

What the attacker needed

None

The fix

The dependencies were upgraded to version 4.4.1 or higher, and the project confirmed the fix.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

This report is about using old versions of a software library that have a known security flaw. The flaw is in a function that runs once when a contract is set up, and it could let an attacker interfere with that setup. The fix is simply to update the library to a newer version.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by Dravee

View all

9 more disclosed reports, best first.

More from JPEG'd contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.