Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H-01 MitigationConfirmed #22

Open
code423n4 opened this issue Jul 21, 2023 · 2 comments
Open

H-01 MitigationConfirmed #22

code423n4 opened this issue Jul 21, 2023 · 2 comments
Labels
confirmed for report This issue is confirmed for report mitigation-confirmed MR-H-01 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

Vulnerability details

Original Issue

code-423n4/2023-06-angle-findings#24

Details

This issue shows attackers can charge more collaterals during the redemption/swap using the reentrancy attack.

Mitigation

PR: AngleProtocol/angle-transmuter@864c1c4

It mitigated the issue by adding a reentrancy guard to _redeem() and _swap().

    modifier nonReentrant() {
        TransmuterStorage storage ts = s.transmuterStorage();
        // Reentrant protection
        // On the first call, `ts.statusReentrant` will be `NOT_ENTERED`
        if (ts.statusReentrant == ENTERED) revert ReentrantCall();
        // Any calls to the `nonReentrant` modifier after this point will fail
        ts.statusReentrant = ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see https://eips.ethereum.org/EIPS/eip-2200)
        ts.statusReentrant = NOT_ENTERED;
    }

    function _redeem(
        uint256 amount,
        address to,
        uint256 deadline,
        uint256[] memory minAmountOuts,
        address[] memory forfeitTokens
    ) internal nonReentrant returns (address[] memory tokens, uint256[] memory amounts) {}

    function _swap(
        uint256 amountIn,
        uint256 amountOut,
        address tokenIn,
        address tokenOut,
        address to,
        bool mint,
        Collateral storage collatInfo,
        bytes memory permitData
    ) internal nonReentrant {}        

Conclusion

It was mitigated properly.

@c4-judge
Copy link

hansfriese marked the issue as satisfactory

@c4-judge c4-judge added satisfactory satisfies C4 submission criteria; eligible for awards confirmed for report This issue is confirmed for report labels Jul 22, 2023
@c4-judge
Copy link

hansfriese marked the issue as confirmed for report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed for report This issue is confirmed for report mitigation-confirmed MR-H-01 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

2 participants