Kuiper contest - bw's results

Automated portfolio protocol.

General Information

Platform: Code4rena

Start Date: 16/09/2021

Pot Size: $50,000 USDC

Total HM: 26

Participants: 30

Period: 7 days

Judge: GalloDaSballo

Total Solo HM: 17

Id: 36

League: ETH

Kuiper

Findings Distribution

Researcher Performance

Rank: 21/30

Findings: 3

Award: $359.37

๐ŸŒŸ Selected for report: 2

๐Ÿš€ Solo Findings: 0

Findings Information

๐ŸŒŸ Selected for report: 0xRajeev

Also found by: bw, pauliax

Labels

bug
duplicate
2 (Med Risk)
sponsor confirmed

Awards

270.5216 USDC - $270.52

External Links

Handle

bw

Vulnerability details

Impact

Bounty is read into memory and then modified, which does not result in the modification being written to storage.

Proof of Concept

https://github.com/code-423n4/2021-09-defiProtocol/blob/main/contracts/contracts/Auction.sol#L143

Modifications (_bounties public)

--- a/contracts/contracts/Auction.sol +++ b/contracts/contracts/Auction.sol @@ -24,7 +24,7 @@ contract Auction is IAuction { IFactory public override factory; address public override auctionBonder; - Bounty[] private _bounties; + Bounty[] public _bounties; modifier onlyBasket() { require(msg.sender == address(basket), 'not basket'); diff --git a/contracts/test/Auction.test.js b/contracts/test/Auction.test.js index 5377bbc..9cbb126 100644 --- a/contracts/test/Auction.test.js +++ b/contracts/test/Auction.test.js @@ -142,7 +142,8 @@ describe("Auction", function () { await UNI.approve(auction.address, `100000000000000000000`); await COMP.approve(auction.address, `100000000000000000000`); await AAVE.approve(auction.address, `100000000000000000000`); - - await expect(auction.settleAuction([], [COMP.address], ["2999400000000000000"], [UNI.address, AAVE.address], ["200720000000000000", "200120000000000000"])).to.be.ok; + await auction.addBounty(UNI.address, `100000000000000000000`); + await expect(auction.settleAuction([0], [COMP.address], ["2999400000000000000"], [UNI.address, AAVE.address], ["200720000000000000", "200120000000000000"])).to.be.ok; + console.log(`bounty.active = ${await auction._bounties(0)}`); }); });

Output

bounty = 0x0E801D84Fa97b50751Dbf25036d067dCf18858bF,100000000000000000000,true

Should have returned false.

Tools Used

N/A

The memory keyword should be replaced with storage in order for bounty.active = false; to be persisted.

diff --git a/contracts/contracts/Auction.sol b/contracts/contracts/Auction.sol
index f07df8b..0ec5efe 100644
--- a/contracts/contracts/Auction.sol
+++ b/contracts/contracts/Auction.sol
@@ -140,7 +140,7 @@ contract Auction is IAuction {
     function withdrawBounty(uint256[] memory bountyIds) internal {
         // withdraw bounties
         for (uint256 i = 0; i < bountyIds.length; i++) {
-            Bounty memory bounty = _bounties[bountyIds[i]];
+            Bounty storage bounty = _bounties[bountyIds[i]];
             require(bounty.active);
 
             IERC20(bounty.token).transfer(msg.sender, bounty.amount);

#1 - GalloDaSballo

2021-12-20T01:03:00Z

Finding is valid, in lack of any POC nor explanation for possible implications with the finding, I believe low severity to be correct

#2 - GalloDaSballo

2021-12-21T22:31:54Z

After re-reviewing, I've increased severity of a similar finding, and since this is a duplicate of it, am increasing the severity of this to medium as well.

Duplicate of #168

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