Open c4-bot-4 opened 11 months ago
raymondfam marked the issue as sufficient quality report
raymondfam marked the issue as duplicate of #169
0xA5DF changed the severity to QA (Quality Assurance)
0xA5DF marked the issue as grade-c
Moved to QA report
0xA5DF marked the issue as grade-a
Lines of code
https://github.com/code-423n4/2023-11-shellprotocol/blob/485de7383cdf88284ee6bcf2926fb7c19e9fb257/src/ocean/Ocean.sol#L1068-L1109
Vulnerability details
Proof of Concept
The wrapping and unwrapping process is mostly foolproof even with low/high decimal tokens.
There is an edge case if a person intends to mint ~1e12 shTokens with a low decimal token
Let's say that token ABC has 2 decimals and is worth 20000 USDC (1e2 ABC tokens == 20000)
User wants to mint 1e15 shABC tokens
In order to mint 1e15 shTokens, user has to pay 1 wei token to get 1e15 tokens. 9e15 shTokens is paid to the the protocol. By right, 1 wei token should get the user 1e16 shTokens instead of 1e15 shTokens
Code Reference:
Impact
User pays more fees than normal when wrapping tokens with low decimals and minting low amounts of shTokens.
Tools Used
VSCode
Recommended Mitigation Steps
Recommend not allowing minting such a low amount of shTokens and also possibly disallowing extremely low decimal tokens.
Assessed type
Error