During stargate router swap method calls, the refund address is set to _oft. In case of excess ETH amount or excess gas, it will refunded to that address.
Although these methods are called by a specific operator (owner), it's logical to refund to msg.sender.
Lines of code
https://github.com/Tapioca-DAO/tapiocaz-audit/blob/bcf61f79464cfdc0484aa272f9f6e28d5de36a8f/contracts/Balancer.sol#L290 https://github.com/Tapioca-DAO/tapiocaz-audit/blob/bcf61f79464cfdc0484aa272f9f6e28d5de36a8f/contracts/Balancer.sol#L326 https://github.com/Tapioca-DAO/tapiocaz-audit/blob/bcf61f79464cfdc0484aa272f9f6e28d5de36a8f/contracts/Balancer.sol#L315
Vulnerability details
Impact
During stargate router swap method calls, the refund address is set to
_oft
. In case of excess ETH amount or excess gas, it will refunded to that address. Although these methods are called by a specific operator (owner), it's logical to refund tomsg.sender
.In https://github.com/Tapioca-DAO/tapiocaz-audit/blob/bcf61f79464cfdc0484aa272f9f6e28d5de36a8f/contracts/Balancer.sol#L315, setting dstNativeAmount to
msg.value
is wrong considering fee required. If it's intended to send native to destination, recommend to setting proper gas for call.Proof of Concept
https://stargateprotocol.gitbook.io/stargate/developers/how-to-swap https://stargateprotocol.gitbook.io/stargate/interfaces/evm-solidity-interfaces/istargaterouter.sol
Tools Used
Manual
Recommended Mitigation Steps
Consider design decisions and tune parameters.
Assessed type
Invalid Validation