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: 58/113
Findings: 2
Award: $23.19
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: NPCsCorp
Also found by: 0x11singh99, 0xAadi, 0xBugSlayer, 0xE1, 0xPluto, 0xSimeon, 0xSmartContract, 0xabhay, 0xdice91, 0xprinc, Aamir, Aymen0909, CDSecurity, DadeKuma, DarkTower, EV_om, Eeyore, GeekyLumberjack, GhK3Ndf, Giorgio, Greed, Inference, JanuaryPersimmon2024, Kaysoft, Krace, Matue, MrPotatoMagic, NentoR, Nikki, PUSH0, Soliditors, Tendency, Tigerfrake, Timeless, Timenov, ZanyBonzy, ZdravkoHr, abiih, adeolu, al88nsk, azanux, bareli, boredpukar, cu5t0mpeo, d4r3d3v1l, darksnow, deth, dutra, ether_sky, haxatron, ke1caM, kodyvim, m4ttm, mgf15, mrudenko, nmirchev8, nobody2018, nuthan2x, peanuts, piyushshukla, ravikiranweb3, rouhsamad, seraviz, simplor, slylandro_star, stealth, th13vn, vnavascues, wangxx2026, zaevlad
0.1172 USDC - $0.12
DcnthETh
is an Omnichain Fungible Token (OFTV2) that is used for the DecentEthRouter
. The OFTV2 tokens usually comply with the ERC20
standard but have extended functionality to be transferred across multiple blockchains without asset wrapping, middlechains, or liquidity pools.
Looking at the DcntETH
contract, the tokens can be minted and burned either by the router
or by the owner
. The mint
and burn
functions have a onlyRouter
modifier which restricts who can call the function:
modifier onlyRouter() { require(msg.sender == router); _; } function mint(address _to, uint256 _amount) public onlyRouter { _mint(_to, _amount); } function burn(address _from, uint256 _amount) public onlyRouter { _burn(_from, _amount); }
However, the public setRouter
function can be called by anyone and any address can be passed:
function setRouter(address _router) public { router = _router; }
This means that any user can pass his own address and mint
and burn
any amount of tokens to/from anyone.
setRouter
with his own address as an input parameter.mint
and pass _to
address and any _amount
of tokens and the call will succeed.burn
function meaning User A can burn all of the tokens from any address as the _from
parameter is user-supplied.Manual Review
Add an onlyOwner
modifier to the setRouter
function.
Access Control
#0 - c4-pre-sort
2024-01-25T02:04:27Z
raymondfam marked the issue as sufficient quality report
#1 - c4-pre-sort
2024-01-25T02:04:33Z
raymondfam marked the issue as duplicate of #14
#2 - c4-judge
2024-02-03T13:10:35Z
alex-ppg marked the issue as satisfactory
23.067 USDC - $23.07
Users can bypass any fees that should be paid to the protocol as mentioned in the project's documentation:
The Box charges 0.00044 ETH on Arbitrum, Base, Zora, Optimism, Avalanche, Moonbeam, and Fantom, 0.00077 ETH on Ethereum, and 0.81 MATIC on Polygon for transactions that require a bridge or a swap. There are no fees on direct transactions.
The swapAndExecute
method has the retrieveAndCollectFees
modifier, which takes care of transferring the fees to the FeeCollector
. Then, the private _swapAndExecute
function is called which takes care of the swap logic.
However, the private _swapAndExecute
is called within the receiveFromBridge
function which is public and callable by anybody:
function receiveFromBridge( SwapInstructions memory postBridge, address target, address paymentOperator, bytes memory payload, address payable refund ) public { _swapAndExecute(postBridge, target, paymentOperator, payload, refund); }
It takes the same input parameters which are forwarded in the external swapAndExecute
. This means that any user can just call receiveFromBridge
and achieve the same outcome without paying any fees because there is no access control or the retrieveAndCollectFees
modifier. This will lead to a significant loss of funds for the project as the likelihood is very high.
Manual Review
The receiveFromBridge
is designed to handle the logic when funds are received from the bridge adapter. Consider adding appropriate access control and place a modifier which allows only adapters to call the function.
Access Control
#0 - c4-pre-sort
2024-01-25T19:36:41Z
raymondfam marked the issue as sufficient quality report
#1 - c4-pre-sort
2024-01-25T19:36:48Z
raymondfam marked the issue as duplicate of #15
#2 - c4-judge
2024-02-03T12:14:29Z
alex-ppg marked the issue as satisfactory
#3 - c4-judge
2024-02-03T13:03:51Z
alex-ppg changed the severity to 2 (Med Risk)