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

ajayss - User will get same hash when attestation details are modified slightly #312

Open
sherlock-admin2 opened this issue Nov 4, 2024 · 0 comments

Comments

@sherlock-admin2
Copy link
Contributor

sherlock-admin2 commented Nov 4, 2024

ajayss

Medium

User will get same hash when attestation details are modified slightly

Summary

The hash for creating attestation encodes multiple string based values into a bytes object before hashing it.

However the problem comes when the string manipulation like
~ service : "ABC" , evidence: "D"
can be put as
~ service : "AB", evidence : "CD"

@> return keccak256(abi.encodePacked(profileId, randValue, account, service, evidence));

@> return keccak256(abi.encodePacked(service, account));

and get the same hash as the abi.encodePacked method is used.

Root Cause

the abi.encodePacked method clubs all the strings together, so basic manipulation like these may lead to the same for ServiceAndAccountHash and CreateAttestation

1, 2

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

Hash conflict can be easily created affecting mapping storage variables like attestationByHash for its integrity.

PoC

No response

Mitigation

use abi.encode for group of dynamic data types like bytes and strings.

@sherlock-admin4 sherlock-admin4 changed the title Dry Yellow Canary - User will get same hash when attestation details are modified slightly ajayss - User will get same hash when attestation details are modified slightly Nov 20, 2024
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

1 participant