Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add withdrawal message verification #28

Merged
merged 1 commit into from
Dec 4, 2023
Merged

feat: Add withdrawal message verification #28

merged 1 commit into from
Dec 4, 2023

Conversation

lukema95
Copy link
Contributor

@lukema95 lukema95 commented Dec 3, 2023

The original code did not check whether the poolId and denom of msg matched in the Withdraw function, leading to a vulnerability. Assuming Alice has two shares, ShareA and ShareB, when calling Withdraw, Alice sets the poolId in msg to the liquidity pool corresponding to ShareA but sets the denom to the denom of ShareB. In this case, the following code will not throw an error.
https://github.com/sideprotocol/side/blob/47fc3fe9642c316865b5d3f8e07a1c1389a24029/x/gmm/keeper/msg_server_withdraw.go#L28-L30
In the end, Alice will successfully obtain tokens from the liquidity pool of PoolA by decreasing the shares of PoolB.

@liangping
Copy link
Contributor

good catch, thanks you.

@liangping liangping merged commit c364426 into sideprotocol:dev Dec 4, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants