FEI and TRIBE Redemption contest - smiling_heretic's results

A new DeFi primitive that allows any token to become productive and provide FEI liquidity at no cost to the markets that need it most.

General Information

Platform: Code4rena

Start Date: 09/09/2022

Pot Size: $42,000 USDC

Total HM: 2

Participants: 101

Period: 3 days

Judge: hickuphh3

Total Solo HM: 2

Id: 161

League: ETH

Tribe

Findings Distribution

Researcher Performance

Rank: 52/101

Findings: 1

Award: $33.58

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Lines of code

https://github.com/code-423n4/2022-09-tribe/blob/769b0586b4975270b669d7d1581aa5672d6999d5/contracts/shutdown/fuse/RariMerkleRedeemer.sol#L93

Vulnerability details

Impact

This comment and existence of the testCannotSignTwice test case makes it clear that intended behavior of the protocol is to prevent users from submitting a signature of MESSAGE_HASH twice.

However, any user can circumvent this and overwrite once provided signature with another valid one.

Proof of Concept

Add the following test case to this file and run integration tests:

function testCanSignTwice() public { vm.startPrank(addresses[0]); IERC20(cToken0).approve(address(redeemer), 100_000_000e18); (uint8 v0, bytes32 r0, bytes32 s0) = vm.sign(keys[0], redeemer.MESSAGE_HASH()); bytes memory signature0 = bytes.concat(r0, s0, bytes1(v0)); redeemer.sign(signature0); address[] memory cTokens; uint256[] memory amounts; bytes32[][] memory merkleProofs; // vm.expectRevert("User has already signed"); redeemer.signAndClaim(signature0, cTokens, amounts, merkleProofs); vm.stopPrank(); }

As we can see, signAndClaim doesn't revert despite non-zero userSignatures[msg.sender] because of the missing hasNotSigned modifier. Moreover, when arguments passed to redeemer.signAndClaim are a signature and empty lists, then this function effectively behaves just like _sign.

Tools Used

Foundry

Add missing hasNotSigned modifier to the redeemer.signAndClaim function.

#0 - kryptoklob

2022-09-19T23:39:57Z

Good find. Marking this as the primary issue as there are several duplicates. Disagree with severity as it does not affect any state adversely on-chain, though it is unintended behavior - should be low sev.

#1 - HickupHH3

2022-09-26T06:34:24Z

Reproducing my comment in #233 here:

Agree with wardens that it is inconsistent behaviour, but I agree that the severity is low because there isn't an adverse impact apart from deviant behaviour and multiple emissions of the Signed() event.

#2 - HickupHH3

2022-09-26T06:35:23Z

Warden's primary QA

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