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

Variable length string prefixes could lead to injection attack #18

Closed
jtremback opened this issue Oct 25, 2021 · 1 comment · Fixed by #242
Closed

Variable length string prefixes could lead to injection attack #18

jtremback opened this issue Oct 25, 2021 · 1 comment · Fixed by #242
Assignees
Labels
good first issue Good for newcomers

Comments

@jtremback
Copy link
Contributor

jtremback commented Oct 25, 2021

I'm not 100% sure about this, but I think that the way we are using variable length string prefixes in the CCV module (for example: https://github.com/cosmos/interchain-security/blob/main/x/ccv/child/types/keys.go) could lead to a situation where an injection attack is possible.

Think about the (contrived) scenario where you have one set of record with keys made like this: "bond" + <ID> and a set of records with keys made like this "bonded" + <ID>. If the user has some kind of control over the ID on the "bond" records, they could create a situation where the first bytes of the ID are the same as the letters "ed". This could allow them to insert records into the "bonded" set.

I think we should use byte prefixes as is done in cosmos-sdk modules, or use iota to generate byte prefixes (we did this in gravity). Another option is to take string prefixes but hash or pad them.

@jtremback
Copy link
Contributor Author

jtremback commented Oct 26, 2021

I see we use these with a separator (which should alleviate the issue) in some places but not all

@mpoke mpoke moved this to Todo in Replicated Security Apr 11, 2022
@mpoke mpoke added good first issue Good for newcomers ccv labels Apr 26, 2022
@mpoke mpoke removed the strangelove label May 13, 2022
@mpoke mpoke moved this from Todo to Next in Replicated Security Jun 29, 2022
@mpoke mpoke moved this from Next to Todo in Replicated Security Jun 29, 2022
@mpoke mpoke moved this from Todo to Waiting for review in Replicated Security Jul 29, 2022
Repository owner moved this from Waiting for review to Done in Replicated Security Aug 2, 2022
@shaspitz shaspitz mentioned this issue Dec 14, 2022
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants