Platform: Code4rena
Start Date: 19/01/2024
Pot Size: $36,500 USDC
Total HM: 9
Participants: 113
Period: 3 days
Judge: 0xsomeone
Id: 322
League: ETH
Rank: 70/113
Findings: 1
Award: $12.28
š Selected for report: 0
š Solo Findings: 0
š Selected for report: Kaysoft
Also found by: 0xmystery, Aamir, DadeKuma, IceBear, Pechenite, SBSecurity, Shaheen, bronze_pickaxe, ether_sky, nobody2018, rjs, rouhsamad, slvDev, zxriptor
12.2818 USDC - $12.28
Issue | Instances | |
---|---|---|
Lā01 | Users can swap and execute without paying protocol fees | 1 |
Lā02 | Signature malleability of EVM's ecrecover in collectFees() | 1 |
Lā03 | Signature replay due to no protocol controlled variables in hash | 1 |
https://github.com/code-423n4/2024-01-decent/blob/main/src/UTB.sol#L108 https://github.com/code-423n4/2024-01-decent/blob/main/src/UTB.sol#L311
As there is no access control modifier on UTB.sol::receiveFromBridge
, it can be called by anyone. Both of these functions simply call _swapAndExecute
, making them interchangeable in the case of ERC20 swaps. However, it's important to note that UTB.sol::receiveFromBridge
does not have a payable
modifier, so it cannot be used for Ether-based calls. Additionally, since UTB.sol::receiveFromBridge
does not utilize the retrieveAndCollectFees
modifier, fees are not collected in this function.
Consider adding a modifier to limit access UTB.sol::receiveFromBridge
to approved bridge adapters only.
ecrecover
in collectFees()https://github.com/code-423n4/2024-01-decent/blob/main/src/UTBFeeCollector.sol#L53
EVM's ecrecover
is susceptible to a signature malleability which allows replay attacks. In case of fee increase, users may reuse previous fees by supplying another signature, valid for the supplied constructedHash
.
Please see this document for the reference: https://swcregistry.io/docs/SWC-117
Consider using recover
function from OpenZeppelin ECDSA library: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.9/contracts/utils/cryptography/ECDSA.sol
https://github.com/code-423n4/2024-01-decent/blob/main/src/UTB.sol#L115C38-L115C68 https://github.com/code-423n4/2024-01-decent/blob/main/src/UTBFeeCollector.sol#L49-L50
In the event of a fee increase, users may continue to use the old fees as long as they submit the same data in the SwapAndExecuteInstructions
or BridgeInstructions
structures. The reason for this is the absence of parameters in a signed hash that are controlled by the protocol or, specifically, the signer.
Consider adding deadline
(i.e. timestamp) into FeeStructure struct and check it in the UTBFeeCollector.sol::collectFees
function.
#0 - raymondfam
2024-01-26T06:18:03Z
L-01 to #15 L-02/L-03 to #16
3L
#1 - c4-pre-sort
2024-01-26T06:18:22Z
raymondfam marked the issue as sufficient quality report
#2 - alex-ppg
2024-02-04T22:49:21Z
The Warden's QA report has been graded B based on a score of 23
combined with a manual review per the relevant QA guideline document located here.
The Warden's submission's score was assessed based on the following accepted findings:
#3 - c4-judge
2024-02-04T22:49:24Z
alex-ppg marked the issue as grade-b