58512 sc low mytstrategy isvalidsignature is implemented wrong and will not work

Submitted on Nov 2nd 2025 at 22:57:31 UTC by @oxrex for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #58512

  • Report Type: Smart Contract

  • Report severity: Low

  • Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/MYTStrategy.sol

  • Impacts:

    • Smart contract unable to operate due to lack of token funds

    • Temporary freezing of funds for at least 24 hour

Description

Brief/Intro

The MYTStrategy contract's isValidSignature function is implemented and will not work with Permit2 during 0x Settler contract calls to swap out assets from the strategy contracts.

Vulnerability Details

function isValidSignature(bytes32 _hash, bytes memory _signature) public view returns (bytes4) {
        return IPermit2(permit2Address).isValidSignature(_hash, _signature);
    }

This snippet above from the MYTStrategy contract is completely wrong.

The way Permit2 works is that, Permit2 will call the strategy contract during transfers from 0x Settler and the function permit2 will call is the isValidSignature() on the strategy contract. Permit2 makes this call when the claimedSigner aka address strategy which the address that approved Permit2 for tokens is not an EOA and instead a contract. Here's that specific call here https://etherscan.io/address/0x000000000022d473030f116ddee9f6b43ac78ba3#code#F13#L46 from permit2:

As you can see, Permit2 wants us (strategy contract) to return the 4-byte function selector of the isValidSignature function which is 0x1626ba7e, it does not want us to call back into Permit2.

And this whole call starts from the permitTransferFrom call which 0x Settler will initiate on Permit2 during swaps:

The correct implementation is to return the isValidSignature function selector which we can do for example like:

Impact Details

The isValidSignature will always force a revert from Permit2 contract as the Permit2 address does not implement a isValidSignature function. The MYTStrategy is implementing the isValidSignature function wrong as I have explained in the vulnerability details above.

For the severity of this bug, I have selected the High Risk severity classification because we can also see that since the function is implemented wrong, swaps with 0x Settler will technically not be successful even when the approvals to Permit2 are available and thus we can classify this as funds be locked for atleast 24 hours since the protocol would technically want to swap out while the batch withdrawal is implemented and this can cause the funds to be unable to be swapped for 24 hours and more.

References

https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/MYTStrategy.sol#L311-L314

Proof of Concept

Proof of Concept

You can replace the content of the EulerUSDCStrategy.t.sol test file with the below code and run the test with test_permitPOC and verbosity of 3 (-vvv)

You will notice the test reverts now, but when you fix the isValidSignature function inside the MYTStrategy to something like below for example (for a quick confirmation, please add the suggested recommendation after confirmation and don't blindly return the sig i.e verify signer is e.g owner):

The test case will then pass after this fix and 0x Settler swaps will then be successful to move assets around that we approved to the Permit2 address.

Test logs for successful case with fix:

Was this helpful?