Decent - zxriptor's results

Decent enables one-click transactions using any token across chains.

General Information

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

Decent

Findings Distribution

Researcher Performance

Rank: 70/113

Findings: 1

Award: $12.28

🌟 Selected for report: 0

šŸš€ Solo Findings: 0

Findings Information

Labels

bug
grade-b
QA (Quality Assurance)
sufficient quality report
Q-14

Awards

12.2818 USDC - $12.28

External Links

Summary

Low-Risk Issues

IssueInstances
L‑01Users can swap and execute without paying protocol fees1
L‑02Signature malleability of EVM's ecrecover in collectFees()1
L‑03Signature replay due to no protocol controlled variables in hash1

[L‑01] Users can swap and execute without paying protocol fees

Lines of code

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

Description

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.

Mitigation steps

Consider adding a modifier to limit access UTB.sol::receiveFromBridge to approved bridge adapters only.

[L‑02] Signature malleability of EVM's ecrecover in collectFees()

Lines of code

https://github.com/code-423n4/2024-01-decent/blob/main/src/UTBFeeCollector.sol#L53

Description

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

Mitigation steps

Consider using recover function from OpenZeppelin ECDSA library: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.9/contracts/utils/cryptography/ECDSA.sol

[L‑03] Signature replay due to no protocol controlled variables in hash

Lines of code

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

Description

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.

Mitigation steps

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

QA Judgment

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:

Low-Risk

  • L-01
  • L-03

Non-Critical

  • L-02

#3 - c4-judge

2024-02-04T22:49:24Z

alex-ppg marked the issue as grade-b

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