Tigris Trade contest - gzeon's results

A multi-chain decentralized leveraged exchange featuring instant settlement and guaranteed price execution on 30+ pairs.

General Information

Platform: Code4rena

Start Date: 09/12/2022

Pot Size: $90,500 USDC

Total HM: 35

Participants: 84

Period: 7 days

Judge: GalloDaSballo

Total Solo HM: 12

Id: 192

League: ETH

Tigris Trade

Findings Distribution

Researcher Performance

Rank: 73/84

Findings: 2

Award: $12.84

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

1.1472 USDC - $1.15

Labels

bug
2 (Med Risk)
satisfactory
duplicate-377

External Links

Lines of code

https://github.com/code-423n4/2022-12-tigris/blob/496e1974ee3838be8759e7b4096dbee1b8795593/contracts/Trading.sol#L898-L905

Vulnerability details

Impact

The value of blockDelay is unbounded. With the widespread use of unchecked throughout the codebase this can cause unexpected behavior. For example, it might overflow here:

https://github.com/code-423n4/2022-12-tigris/blob/496e1974ee3838be8759e7b4096dbee1b8795593/contracts/Trading.sol#L858-L867

        unchecked {
            Delay memory _delay = blockDelayPassed[_id];
            if (_delay.actionType == _type) {
                blockDelayPassed[_id].delay = block.number + blockDelay;
            } else {
                if (block.number < _delay.delay) revert("0"); //Wait
                blockDelayPassed[_id].delay = block.number + blockDelay;
                blockDelayPassed[_id].actionType = _type;
            }
        }

and cause the delay not working as expected.

Proof of Concept

https://github.com/code-423n4/2022-12-tigris/blob/496e1974ee3838be8759e7b4096dbee1b8795593/contracts/Trading.sol#L898-L905

    function setBlockDelay(
        uint _blockDelay
    )
        external
        onlyOwner
    {
        blockDelay = _blockDelay;
    }

Bound the max number of block delay, or remove the unchecked.

#0 - TriHaz

2022-12-23T02:28:59Z

Same as #17, would label as duplicate.

#1 - c4-judge

2022-12-23T17:35:42Z

GalloDaSballo marked the issue as duplicate of #321

#2 - c4-judge

2023-01-19T19:51:46Z

GalloDaSballo marked the issue as duplicate of #377

#3 - c4-judge

2023-01-22T17:35:00Z

GalloDaSballo marked the issue as satisfactory

Awards

11.6941 USDC - $11.69

Labels

bug
2 (Med Risk)
satisfactory
duplicate-655

External Links

Lines of code

https://github.com/code-423n4/2022-12-tigris/blob/496e1974ee3838be8759e7b4096dbee1b8795593/contracts/utils/TradingLibrary.sol#L113

Vulnerability details

Impact

Chainlink latestAnswer() is deprecated. It might return stale data or incomplete round answer.

Proof of Concept

https://github.com/code-423n4/2022-12-tigris/blob/496e1974ee3838be8759e7b4096dbee1b8795593/contracts/utils/TradingLibrary.sol#L113

            int256 assetChainlinkPriceInt = IPrice(_chainlinkFeed).latestAnswer();

Check for stale price and round completeness using latestRoundData()

#0 - c4-judge

2022-12-22T00:20:23Z

GalloDaSballo marked the issue as duplicate of #655

#1 - GalloDaSballo

2022-12-22T00:20:34Z

Barely made it as dup of #655 because of mentioning stale data not being validate

#2 - c4-judge

2023-01-22T17:31:08Z

GalloDaSballo 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