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.
Implement Allowance Checks:
For ERC20 tokens, ensure that the allowance is checked and updated atomically within the transferFrom function. This prevents potential race conditions.
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