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

WirePayForData with empty Message #8

Closed
mpoke opened this issue Aug 26, 2022 · 3 comments · Fixed by celestiaorg/celestia-app#1083
Closed

WirePayForData with empty Message #8

mpoke opened this issue Aug 26, 2022 · 3 comments · Fixed by celestiaorg/celestia-app#1083
Assignees
Labels
payment Payment module in celestia-app

Comments

@mpoke
Copy link
Collaborator

mpoke commented Aug 26, 2022

MsgWirePayForData.ValidateBasic doesn't check if msg.MessageSize == 0. As a result, a malicious user could spam the system with WirePayForData transactions with no data. Such attack is possible since the gas consumed per TXs is msg.MessageSize (there are no reads or writes to the store).

Suggestions:

  • Add checks to invalidated WirePayForData transactions with MessageSize == 0
  • Add to the amount of gas consumed a constant that doesn't depend on the MessageSize
@mpoke mpoke added the payment Payment module in celestia-app label Aug 26, 2022
@rootulp rootulp self-assigned this Aug 26, 2022
@evan-forbes
Copy link
Collaborator

evan-forbes commented Aug 26, 2022

Great find! We definitely have to address the spamming issue, so I don't want to distract from that, but just to note that there is currently a very small base fee added by the default cosmos-sdk for all txs for signature verification and size of tx.

https://github.com/cosmos/cosmos-sdk/blob/fc7ee0bf1e4e6afef4aed98515d418281edb7e62/x/auth/ante/ante.go#L44

https://github.com/cosmos/cosmos-sdk/blob/fc7ee0bf1e4e6afef4aed98515d418281edb7e62/x/auth/ante/ante.go#L48

this is something that we have to consider when designing a goal base fee and proper resource allocation, which we still need to do a lot of work for celestiaorg/celestia-app#658

@rootulp rootulp removed their assignment Aug 26, 2022
@mpoke
Copy link
Collaborator Author

mpoke commented Aug 26, 2022

there is currently a very small base fee added by the default cosmos-sdk for all txs for signature verification and size of tx.

https://github.com/cosmos/cosmos-sdk/blob/fc7ee0bf1e4e6afef4aed98515d418281edb7e62/x/auth/ante/ante.go#L44

https://github.com/cosmos/cosmos-sdk/blob/fc7ee0bf1e4e6afef4aed98515d418281edb7e62/x/auth/ante/ante.go#L48

Thanks. I was not aware of it, but I was hoping that something like this exists :)

@rootulp
Copy link
Contributor

rootulp commented Nov 30, 2022

Add to the amount of gas consumed a constant that doesn't depend on the MessageSize

No longer seems necessary given the above

Add checks to invalidated WirePayForData transactions with MessageSize == 0

Added in celestiaorg/celestia-app#1083

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
payment Payment module in celestia-app
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants