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

Unbounded field lengths #4859

Closed
3 tasks
faddat opened this issue Oct 13, 2023 · 6 comments · Fixed by #4992
Closed
3 tasks

Unbounded field lengths #4859

faddat opened this issue Oct 13, 2023 · 6 comments · Fixed by #4992
Assignees
Labels
change: state machine breaking Issues or PRs that break consensus (need to be released in at least a new minor version) type: bug Something isn't working as expected

Comments

@faddat
Copy link
Contributor

faddat commented Oct 13, 2023

Summary of Bug

In ibc-go, there are many unbounded field lengths, and in production, this can result in ibc messages that are as large as several megabytes, which are seen as valid and relayed.

Expected Behaviour

With the exception of the total size of client updates, I'm not aware of any ibc transaction that benefits from a field length of over 5kb for any field. Even if this is incorrect and we need to exceed 5kb in some places, we need to introduce bounds to fields in ibc for safety.

Version

all

Steps to Reproduce

Contact Jacob Gadikian or another Notional team member via slack for information on reproduction

fix

We should ensure that every field in IBC has a maximum length. Marko from the SDK team says that length limitations are done on a per module basis in the SDK, and so IBC should comply. We are checking internally to determine if we have time / financial resources to complete this task.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned
@crodriguezvega crodriguezvega self-assigned this Oct 13, 2023
@crodriguezvega crodriguezvega added the type: bug Something isn't working as expected label Oct 13, 2023
@crodriguezvega
Copy link
Contributor

crodriguezvega commented Oct 13, 2023

Thank you for opening the PR, @faddat.

On a first pass, I think we have the following string fields whose maximum length is not checked:

PRs should be opened against this feature branch.

@faddat
Copy link
Contributor Author

faddat commented Oct 16, 2023

Thank you!

@tac0turtle
Copy link
Member

technically every module in existence may have this issue, it would be good to understand why longer length cause larger amounts of computation on certain fields over others. I dont think this is limited to ibc.

@faddat
Copy link
Contributor Author

faddat commented Oct 17, 2023

It is unfortunate that this was not addressed in a serious and rigorous manner when it was reported in October 2022, and I mention this because the reason we are scrambling does not relate to the software changes needed, but instead to a set of process-driven failures caused by the opaque ways of working and general unaccountability of the Interchain foundation, coupled with their legal threats against security researchers, and their security team's lack of good practices.

cosmos/security#19

Later, a chain-comber found the osmosis banana kings:

https://twitter.com/web3_analyst/status/1635687287962112000

Given that Amulet has released information about a related matter direct to the public on the cosmos hub forum, I will be releasing a set of targeted mitigations that cite this issue today at midnight Bali time, which is 4PM GMT.

The mitigations are available in the p2p-storms channel, as well as the validator working group on spam, and feedback from all teams is welcome, but timeline cannot be extended beyond then due to amulet's release of related information against my explicit and direct wishes.

@tac0turtle can you think of a rapid way to check modules for unbounded field length, or should the suggested mitigation be to instruct authors of modules to ensure that every field has a length limitation?

@tac0turtle
Copy link
Member

almost all fields in existence, you would need check each by hand, but this doesnt answer the question at hand, why does this tx take a long time to confirm? is it the bech32 decoding? Can we get a test case in ibc for a single message type to test what is going on here before making a bunch of length checks.

the fix overall is to reduce total block sizes, there is no need to have 10mb+ blocks. That would prevent the tweet issue. I havent seen the submitted report so dont know if a test case was added, if so can you point me to a gist i can run locally to test?

@faddat
Copy link
Contributor Author

faddat commented Oct 18, 2023

@tac0turtle can you check HackerOne?

https://twitter.com/ctrl_Felix/status/1714714816625934383?t=0TTLNJYmd07vt3G52Lj2Bg&s=19

Felix mentioned that he reported this -- even before contacting me. I thought the order was the other way around though it doesn't really matter what the order is. Issues slip by and that's bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change: state machine breaking Issues or PRs that break consensus (need to be released in at least a new minor version) type: bug Something isn't working as expected
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants