JPEG'd contest - jayjonah8's results

Bridging the gap between DeFi and NFTs.

General Information

Platform: Code4rena

Start Date: 07/04/2022

Pot Size: $100,000 USDC

Total HM: 20

Participants: 62

Period: 7 days

Judge: LSDan

Total Solo HM: 11

Id: 107

League: ETH

JPEG'd

Findings Distribution

Researcher Performance

Rank: 48/62

Findings: 1

Award: $151.35

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Awards

151.3491 USDC - $151.35

Labels

bug
duplicate
QA (Quality Assurance)
disagree with severity
resolved
sponsor confirmed

External Links

Lines of code

https://github.com/code-423n4/2022-04-jpegd/blob/main/contracts/vaults/NFTVault.sol#L675 https://github.com/code-423n4/2022-04-jpegd/blob/main/contracts/vaults/NFTVault.sol#L560

Vulnerability details

Impact

In NFTVault.sol the borrow() function does not follow the Checks Effects Interactions pattern. There are important state updates that occur after an external call which happens in _openPosition(). Assuming that the nonReentrant modifier makes this ok is false due to the threat of cross function reentrancy. require checks should be done followed by state updates and then any external calls in accord with the Checks Effects Interactions pattern

Proof of Concept

https://github.com/code-423n4/2022-04-jpegd/blob/main/contracts/vaults/NFTVault.sol#L675

https://github.com/code-423n4/2022-04-jpegd/blob/main/contracts/vaults/NFTVault.sol#L560

https://fravoll.github.io/solidity-patterns/checks_effects_interactions.html

Tools Used

Manual code review

The borrow() function should fully implement the Checks Effects Interactions pattern performing all external calls last and not making important state updates after external calls.

#0 - spaghettieth

2022-04-11T16:31:15Z

The example provided doesn't have any exploit vector and the code in question isn't vulnerable to cross function reentrancy. I'm not going to dispute this issue as the Checks Effects Interactions pattern allows for cleaner and safer code, but this issue should be severity 0 or at most 2.

#1 - spaghettieth

2022-04-14T14:25:20Z

#2 - dmvt

2022-04-26T13:36:50Z

I'm going to leave this as part of the warden's QA report, but if the sponsor had not confirmed the suggested change I would have marked it invalid. The code does not have a reentrancy vulnerability and the warden has not actually described an exploit.

#3 - JeeberC4

2022-05-02T19:10:29Z

Generating QA Report as judge downgraded issue. Preserving original title: _borrow() has important state updates after external call

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax Β© 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter