Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Valid

Wrong implementation of `nonReentrant` modifier in `InheritanceManager` contract.

Description

The `nonReentrant` modifier should use to protect against reentrancy attack, But the implementation of `nonReentrant` modifier in `InheritanceManager` contract is wrong implementation.
```javascript
modifier nonReentrant() {
assembly {
@> if tload(1) { revert(0, 0) }
tstore(0, 1)
}
_;
assembly {
tstore(0, 0)
}
}
```
As per solidity doccumentation `https://soliditylang.org/blog/2024/01/26/transient-storage/` th `nonReentrant` modifier is diffrent from the implementaion.

Impact

The contract will open vulnerability which will lead to potential reentrancy attack.

Proof of Concept

See the `https://soliditylang.org/blog/2024/01/26/transient-storage/` doccument for more information.

Recommended Mitigation

Follow the `https://soliditylang.org/blog/2024/01/26/transient-storage/` doccumentaion to implement `nonReenrant` modifier or add this to the contract.
```diff
modifier nonReentrant() {
assembly {
+ if tload(0) { revert(0, 0) }
- if tload(1) { revert(0, 0) }
tstore(0, 1)
}
_;
assembly {
tstore(0, 0)
}
}
```
Updates

Lead Judging Commences

0xtimefliez Lead Judge 3 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Wrong value in nonReentrant modifier

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.