User operations can be replayed on smart account across different chains. This can lead to users losing funds or any unexpected behavior that transaction replay attacks usually lead to. This will allow attacker to unauthorized approve tokens. Attacker can perform admin operations
Proof of Concept
As specified by the EIP4337 standard to prevent replay attacks ... the signature should depend on chainid. In MarketERC20.sol#_permit & YieldBoxPermit.sol#_permit the chainId is missing which means that the same UserOperation can be replayed on a different chain for the same smart contract account.
Lines of code
https://github.com/Tapioca-DAO/tapioca-bar-audit/blob/2286f80f928f41c8bc189d0657d74ba83286c668/contracts/markets/MarketERC20.sol#L251-L284 https://github.com/Tapioca-DAO/YieldBox/blob/f5ad271b2dcab8b643b7cf622c2d6a128e109999/contracts/YieldBoxPermit.sol#L72-L90 https://github.com/Tapioca-DAO/YieldBox/blob/f5ad271b2dcab8b643b7cf622c2d6a128e109999/contracts/YieldBoxPermit.sol#L42-L61
Vulnerability details
Impact
User operations can be replayed on smart account across different chains. This can lead to users losing funds or any unexpected behavior that transaction replay attacks usually lead to. This will allow attacker to unauthorized approve tokens. Attacker can perform admin operations
Proof of Concept
As specified by the EIP4337 standard to prevent replay attacks ... the signature should depend on chainid. In MarketERC20.sol#_permit & YieldBoxPermit.sol#_permit the chainId is missing which means that the same UserOperation can be replayed on a different chain for the same smart contract account.
Tools Used
Manual review
Recommended Mitigation Steps
Add the chainId in the calculation of the UserOperation hash in MarketERC20.sol#_permit & YieldBoxPermit.sol#_permit
Assessed type
Invalid Validation