DittoETH

Ditto
DeFiFoundryOracle
55,000 USDC
View results
Submission Details
Severity: low
Invalid

External calls in an un-bounded for-loop may result in a DOS

External calls in an un-bounded for-loop may result in a DOS

  • Severity: Low

  • Confidence: Medium

Description

Calls inside a loop might lead to a denial-of-service attack.

There are 4 instances of this issue:

File: contracts/facets/ERC721Facet.sol
22 function balanceOf(address owner) external view returns (uint256 balance)

has external calls inside a loop:

File: contracts/facets/ERC721Facet.sol
29 STypes.ShortRecord[] memory shortRecords =
30 IDiamond(payable(address(this))).getShortRecords(s.assets[i], owner)

https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/facets/ERC721Facet.sol#L22-L43

File: contracts/facets/MarginCallSecondaryFacet.sol
38 function liquidateSecondary(
39 address asset,
40 MTypes.BatchMC[] memory batches,
41 uint88 liquidateAmount,
42 bool isWallet
43 ) external onlyValidAsset(asset) isNotFrozen(asset) nonReentrant

has external calls inside a loop:

File: contracts/facets/MarginCallSecondaryFacet.sol
84 uint256 walletBalance = tokenContract.balanceOf(msg.sender)

https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/facets/MarginCallSecondaryFacet.sol#L38-L117

File: contracts/facets/MarginCallSecondaryFacet.sol
38 function liquidateSecondary(
39 address asset,
40 MTypes.BatchMC[] memory batches,
41 uint88 liquidateAmount,
42 bool isWallet
43 ) external onlyValidAsset(asset) isNotFrozen(asset) nonReentrant

has external calls inside a loop:

File: contracts/facets/MarginCallSecondaryFacet.sol
86 tokenContract.burnFrom(msg.sender, m.short.ercDebt)

https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/facets/MarginCallSecondaryFacet.sol#L38-L117

File: contracts/facets/MarginCallSecondaryFacet.sol
38 function liquidateSecondary(
39 address asset,
40 MTypes.BatchMC[] memory batches,
41 uint88 liquidateAmount,
42 bool isWallet
43 ) external onlyValidAsset(asset) isNotFrozen(asset) nonReentrant

has external calls inside a loop:

File: contracts/facets/MarginCallSecondaryFacet.sol
87 assert(tokenContract.balanceOf(msg.sender) < walletBalance)

https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/facets/MarginCallSecondaryFacet.sol#L38-L117

Updates

Lead Judging Commences

0xnevi Lead Judge
almost 2 years ago
0xnevi Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Vague generalities

Support

FAQs

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