Closed code423n4 closed 1 year ago
gzeon-c4 marked the issue as primary issue
gzeon-c4 marked the issue as satisfactory
livingrockrises marked the issue as sponsor confirmed
gzeon-c4 marked the issue as selected for report
gzeon-c4 marked issue #123 as primary and marked this issue as a duplicate of 123
Lines of code
https://github.com/code-423n4/2023-01-biconomy/blob/5df2e8f8c0fd3393b9ecdad9ef356955f07fbbdd/scw-contracts/contracts/smart-contract-wallet/SmartAccount.sol#L239 https://github.com/code-423n4/2023-01-biconomy/blob/5df2e8f8c0fd3393b9ecdad9ef356955f07fbbdd/scw-contracts/contracts/smart-contract-wallet/SmartAccount.sol#L264 https://github.com/code-423n4/2023-01-biconomy/blob/5df2e8f8c0fd3393b9ecdad9ef356955f07fbbdd/scw-contracts/contracts/smart-contract-wallet/SmartAccount.sol#L424
Vulnerability details
Description
For the calculation of the amount of the token to be paid to the relayer
tokenGasPriceFactor
value is used. The corresponding logic is the following:So, the number of tokens that the relayer should receive is inversely proportional to the value of this variable. But the
tokenGasPriceFactor
parameter is not signed by the owner:Using this fact the relayer can pass any value of
tokenGasPriceFactor
parameter to receive a greater amount than the user expected to pay.Attack scenario
The user sends a transaction to the relayer. By the formula,
payment
value should be equalgasUsed/tokenGasPriceFactor
. The user expects that thetokenGasPriceFactor
will be equal to100
for the specified token, but the relayer puttokenGasPriceFactor
to1
. Relayer receives100
times greater payout.Impact
Obtaining a greater relayer benefit than the user expects, theft of user funds.
Recommended Mitigation Steps
Add the
refundInfo.tokenGasPriceFactor
to the preimage of the tx hash which should be signed by the owner.