code-423n4 / 2024-04-revert-mitigation-findings

1 stars 1 forks source link

H-03 MitigationConfirmed #78

Open c4-bot-9 opened 6 months ago

c4-bot-9 commented 6 months ago

Lines of code

Vulnerability details

C4 issue

H-03: V3Vault::transform does not validate the data input and allows a depositor to exploit any position approved on the transformer

Comments

When V3Vault.transform() is called, several arguments are passed into transform(). Two arguments important to us are the data and tokenId arguments. The tokenId represents the id of the token that will be manipulated. The data calldata represents arbitrary data that will be passed to a transformer contract.

The core issue here is that the data argument is not validated. data is arbitrary user data and therefore a user can pass any value they want. Here arises the problem. Not only is data arbitrary, but data also contains a copy of the tokenId. A malicious user can pass in a separate token id into data, one that is different from the tokenId argument passed into V3Vault.transform(). The transformer contract will take the modified tokenID and manipulate it even though the malicious user doesn't have permission to do so.

Mitigation

PR #29

PR #29 includes fixes for a separate issue. This mitigation discussed below will focus just on this ticket's issue.

Based on these changes, a user is no longer able to arbitrary call V3Vault.transform() with an arbitrary data.tokenId. Each transformer contract successfully checks that the params.tokenId can be managed by the msg.sender.

Conclusion

LGTM

c4-judge commented 6 months ago

jhsagd76 marked the issue as satisfactory