Closed code423n4 closed 1 year ago
trust1995 marked the issue as duplicate of #758
trust1995 marked the issue as satisfactory
trust1995 marked the issue as partial-50
trust1995 marked the issue as full credit
trust1995 marked the issue as satisfactory
Lines of code
https://github.com/code-423n4/2023-05-maia/blob/54a45beb1428d85999da3f721f923cbf36ee3d35/src/ulysses-omnichain/RootPort.sol#L282 https://github.com/code-423n4/2023-05-maia/blob/54a45beb1428d85999da3f721f923cbf36ee3d35/src/ulysses-omnichain/BranchPort.sol#L248 https://github.com/code-423n4/2023-05-maia/blob/54a45beb1428d85999da3f721f923cbf36ee3d35/src/ulysses-omnichain/BranchPort.sol#L275
Vulnerability details
Impact
Root hTokens will be minted based on the decimals of the underlying deposit, which causes incorrect accounting.
Proof of Concept
In
bridgeToRoot()
of RootPort.sol, the root hToken is transferred to the_recipient
. The amount that is transferred is the difference between_amount
and_deposit
. As discussed with the Sponsor,_amount
is an amount of hTokens, which is decimal18
. The_deposit
is the deposit amount of underlying, which can have varying decimals. This results in incorrect accounting, because_deposit
amounts using decimals lower than18
will result in more tokens transferred. Tokens with decimals greater than18
, can result in an underflow because_deposit
is greater than_amount
.There are other places where
amount - deposit
is used, but does not take into account thedeposit
decimals, such as:Tools Used
Manual
Recommended Mitigation Steps
Consider converting
_deposit
to18
decimals to match the hToken decimals.Assessed type
Decimal