Platform: Code4rena
Start Date: 01/09/2023
Pot Size: $36,500 USDC
Total HM: 4
Participants: 70
Period: 6 days
Judge: kirk-baird
Id: 281
League: ETH
Rank: 36/70
Findings: 2
Award: $25.93
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: adriro
Also found by: 0x6980, 0xStalin, 0xanmol, 0xmystery, 0xpanicError, Arz, Aymen0909, BenRai, Breeje, Lalanda, MohammedRizwan, Raihan, SovaSlava, Stormreckson, Udsen, ast3ros, bin2chen, castle_chain, catellatech, codegpt, dev0cloo, gkrastenov, hals, klau5, kutugu, ladboy233, matrix_0wl, nirlin, ohm, peanuts, pipidu83, sandy, wahedtalash77
7.08 USDC - $7.08
QA Report
Count | Explanation |
---|---|
[L-01] | No checks to confirm that the gas paid by user is enough |
[L-02] | In case DestinationBridge is paused before SourceBridge , User can lose funds |
[L-03] | No incentive for approvers to approve can lead to issues in long term |
[L-04] | Possible Reorg situation in rUSDYFactory |
Total Low Risk Issues | 4 |
---|
In SourceBridge
contract, When any user calls burnAndCallAxelar
:
TOKEN
s are burned from caller.payNativeGasForContractCall
.callContract
call is made to transfer the token cross chain.function burnAndCallAxelar( uint256 amount, string calldata destinationChain ) external payable whenNotPaused { string memory destContract = destChainToContractAddr[destinationChain]; if (bytes(destContract).length == 0) { revert DestinationNotSupported(); } if (msg.value == 0) { revert GasFeeTooLow(); } TOKEN.burnFrom(msg.sender, amount); bytes memory payload = abi.encode(VERSION, msg.sender, amount, nonce++); _payGasAndCallContract(destinationChain, destContract, payload); } function _payGasAndCallContract( string calldata destinationChain, string memory destContract, bytes memory payload ) private { GAS_RECEIVER.payNativeGasForContractCall{value: msg.value}( address(this), destinationChain, destContract, payload, msg.sender ); AXELAR_GATEWAY.callContract(destinationChain, destContract, payload); }
Here, there is no validation that the Gas Fees paid by user is sufficient to transfer the token cross chain or not.
There are transaction won't be successful at the destination chain because of lack of gas fees paid. User might need to manually call
As per Axelar Docs,
An application that wants Axelar to automatically execute contract calls on the destination chain needs to do three things:
- Estimate the gasLimit that the contract call will require on your executable contract on the destination chain.
- Call the estimateGasFee method to get the sourceGasFee in the desired gas-payment token on the destination chain.
- Pay the AxelarGasService smart contract on the source chain in the amount calculated in step 2.
Given that the extra cost will be refunded to user, a mapping state variable can be added which can save the estimate gas fees it will cost for different chains which owner can update as well. And then keep a require check to make sure that user are passing enough gas to execute the transaction seamlessly.
DestinationBridge
is paused before SourceBridge
, User can lose fundsWhen user wants to let's say transfer x
amount of tokens from Chain A to Chain B, below is the sequence of events that will occur:
burnAndCallAxelar
on SourceBridge
contract._execute
on destination contract will be called.Issue here can arise during emergency, if DestinationBridge
is paused before SourceBridge
. In this case, user's token will be burnt in the source contract but user will not be able to mint the tokens in the destination contract.
Loss of funds for User.
Always makes sure to pause all the source contract first during emergency before destination contracts.
On destination chain, the last approver
will be required to pay extra gas fees to perform extra operations of Updating mint limit, minting the tokens to sender etc.
Here, approver has no incentive to do it and gas fees can be quite high in case the chain is ethereum.
Hence, it is recommended to have an additional function which should be called by user to mint the tokens and perform the operation in _mintIfThresholdMet
function. Or another option is to introduce a fee on transfer of tokens which will be distributed to approvers to compensate for their gas fees cost.
rUSDYFactory
The deployrUSDY
function deploys a new rUSDY
contract using the create.
Some of the chains like Arbitrum and Polygon are suspicious of the reorg attack in case contracts are not deployed with Deployed via create2
with salt
.
File: rUSDYFactory.sol function deployrUSDY( address blocklist, address allowlist, address sanctionsList, address usdy, address oracle ) external onlyGuardian returns (address, address, address) { rUSDYImplementation = new rUSDY(); rUSDYProxyAdmin = new ProxyAdmin(); rUSDYProxy = new TokenProxy( address(rUSDYImplementation), address(rUSDYProxyAdmin), "" );
So it is recommended to deploy via create2
with salt
only.
#0 - c4-pre-sort
2023-09-08T08:37:16Z
raymondfam marked the issue as sufficient quality report
#1 - c4-judge
2023-09-21T10:13:08Z
kirk-baird marked the issue as grade-b
🌟 Selected for report: catellatech
Also found by: 0xAsen, 0xE1D, 0xStalin, 0xmystery, Breeje, Bube, DedOhWale, JayShreeRAM, K42, Krace, castle_chain, hals, hunter_w3b, kaveyjoe, m4ttm, mahdikarimi, nirlin, peanuts, sandy
18.8458 USDC - $18.85
Count | Topic |
---|---|
1 | Introduction |
2 | Audit Approach |
3 | Architecture Recommendation |
4 | Centralization Risk |
5 | Code Review Insights |
6 | Time Spent |
This technical analysis report focuses on the underlying smart contracts of Ondo Finance consisting of the rebasing variant of USDY token and bridging tokens using Axelar Network. This report explores various contract categories, including Rebase token itself, Bridging component and oracle implementation.
Initial Scope and Documentation Review: Thoroughly went through the Contest Readme File and project documentation to understand the protocol's objectives and functionalities.
High-level Architecture Understanding: Performed an initial architecture review of the codebase by going through all files without going into function details.
Test Environment Setup and Analysis: Set up a test environment and execute all tests. Additionally, use Static Analyzer tools like Slither to identify potential vulnerabilities.
Comprehensive Code Review: Conducted a line-by-line code review focusing on understanding code functionalities.
Report Writing: Write Report by compiling all the insights I gained throughout the line by line code review.
The following architecture improvements and feedback could be considered:
approvers
will be required to pay extra gas fees to perform extra operations of Updating mint limit, minting the tokens to sender etc. Here, approvers
has no incentive to do it and gas fees can be quite high in case the chain is ethereum. So it is recommended to have an additional function which should be called by user to mint the tokens and perform the operation in _mintIfThresholdMet
function. Or another option is to introduce a fee on transfer of tokens which will be distributed to approvers to compensate for their gas fees.Role of Admin is very crucial in almost every contract. Here are the Centralization Risk which Users needs to be aware of before using the smart contracts in scope:
DestinationBridge
contract.mintLimit
as very low value to force DoS on DestinationBridge
contract.LIST_CONFIGURER_ROLE
can add any address to blocklist, SanctionsList or Allowlist.PAUSER_ROLE
can pause all the operations of rUSDY
token anytime.Contracts:
SourceBridge
:DestinationBridge
MintTimeBasedRateLimiter
DestinationBridge
is paused before SourceBridge
, User can potentially burn their tokens while will fail to mint it back on destination chain.DestinationBridge
contract which can lead to user not able to mint the token at destination chain.Contracts:
rUSDYFactory
rUSDY
RWADynamicOracle
transferFrom
function reduces allowances
even if _sender
is msg.sender
Blocklist
, Allowlist
and SanctionsList
in rUSDY
token by LIST_CONFIGURER_ROLE
which can impact their ability to use their funds.USDY
to or from rUSDY
.Total Number of Hours | 10 |
---|
10 hours
#0 - c4-pre-sort
2023-09-08T14:47:14Z
raymondfam marked the issue as sufficient quality report
#1 - c4-judge
2023-09-24T07:05:47Z
kirk-baird marked the issue as grade-a
#2 - c4-judge
2023-09-24T07:13:31Z
kirk-baird marked the issue as grade-b