Decent - azanux'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: 81/113

Findings: 1

Award: $0.12

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/decentxyz/decent-bridge/blob/3460106d1cd976e0235695676a9e318f750cd4dd/src/DcntEth.sol#L20

Vulnerability details

Impact

An attacker could change the router in this Token to another router, allowing them to mint tokens for themselves. Consequently, the DecentEthRouter would not be able to add liquidity, or users would be unable to withdraw their tokens.

Proof of Concept

Get the address of the Token DcntEth. Set the address of a new router. Mint new tokens for a user. Set the address of the old router. Withdraw the amount that was minted.


    function testRouter() public {

        assertEq(router, dcntEth.router());

        dcntEth.setRouter(router2);

        console2.log("router is", router);
        //check the router
        assertEq(router2, dcntEth.router());
    }

Tools Used

foundry

Only an admin should be able to set the router for DcntEth, add onlyOwner modifier in front of the function setRouter

 function setRouter(address _router) public onlyOwner 

Assessed type

Access Control

#0 - c4-pre-sort

2024-01-25T20:29:48Z

raymondfam marked the issue as sufficient quality report

#1 - c4-pre-sort

2024-01-25T20:29:54Z

raymondfam marked the issue as duplicate of #14

#2 - c4-judge

2024-02-03T13:08:23Z

alex-ppg marked the issue as satisfactory

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