code-423n4 / 2024-07-basin-validation

0 stars 0 forks source link

Arbitrary from passed to transferFrom (lor safeTransferFrom) #37

Closed c4-bot-4 closed 3 months ago

c4-bot-4 commented 3 months ago

Lines of code

https://github.com/code-423n4/2024-07-basin/blob/7d5aacbb144d0ba0bc358dfde6e0cc913d25310e/src/Well.sol#L864

Vulnerability details

Impact

Passing an arbitrary from address to transferFrom (or safeTransferFrom) can lead to loss of funds, because anyone can transfer tokens from the from address if an approval is made.

Proof of Concept

https://github.com/code-423n4/2024-07-basin/blob/7d5aacbb144d0ba0bc358dfde6e0cc913d25310e/src/Well.sol#L864

Tools Used

aderyn

Recommended Mitigation Steps

Implement Allowance Checks: For ERC20 tokens, ensure that the allowance is checked and updated atomically within the transferFrom function. This prevents potential race conditions.

Assessed type

Access Control

nevillehuang commented 3 months ago

Likely Invalid, Well.sol is OOS. Additionally the transfer is not arbitrary and needs to be initiated from the caller as seen here and here