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

Need Error Handling for SendCoinsFromAccountToModule Function #8

Open
slendermaan opened this issue Mar 6, 2023 · 2 comments
Open

Comments

@slendermaan
Copy link

slendermaan commented Mar 6, 2023

Credit to : HelloBloc

@liangping

Description

In the following code content, the error handling of x.bankKeeper.SendCoins is missing, which will result in a malicious user being able to set the status without cost.

	//lock swap-in token to the swap module
	escrowAddr := types.GetEscrowAddress(pool.EncounterPartyPort, pool.EncounterPartyChannel)
	k.bankKeeper.SendCoinsFromAccountToModule(ctx, sdk.MustAccAddressFromBech32(msg.Sender), escrowAddr.String(), sdk.NewCoins(*msg.TokenIn))

	//constructs the IBC data packet
	rawMsgData, err := json.Marshal(msg)
	if err != nil {
		return nil, err
	}

Impact

This results in users being able to successfully swap without having a sufficient balance.

Likelihood

This attack can be done by any user who does not have sufficient balance.

Related links

Related-Code

REF

REF

Ethics

Sorry for using github to report this vul, as I didn't find your security channle and all the effective ways to report it at that time. However, I have observed that your main-net was not online at that time, so reported the issue via github. Hope you don't mind.

@slendermaan
Copy link
Author

You can use this to check your own code for this series of problems

@liangping
Copy link
Contributor

liangping commented Mar 6, 2023 via email

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

No branches or pull requests

2 participants