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

fix: Remove hash bit masking in Vector pallet verification #715

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

VolodymyrBg
Copy link

@VolodymyrBg VolodymyrBg commented Jan 19, 2025

Description

This PR fixes a critical security vulnerability in the Vector pallet's verification logic where input and output hashes were being partially masked during verification. The masking of the first 3 bits of the hashes significantly weakened the cryptographic security of the verification process.

Changes

  • Removed bit masking from verify method in verifier.rs
  • Now using full hash values for verification
  • Updated tests to verify complete hash values

Security Impact

Severity: High
Scope: All cross-chain message verification
Attack Vectors:

  • Hash collisions through masked bits
  • Potential replay attacks
  • Weakened cryptographic verification

Testing

  • All existing tests pass with the fix
  • Added test cases to verify full hash values
  • Manually tested with various hash inputs

Backwards Compatibility

This change is backwards incompatible with existing proofs that may have relied on the bit masking behavior. A network upgrade will be required to deploy this fix.

Upgrade Path

  1. Deploy fix in next scheduled network upgrade
  2. All nodes must upgrade before the activation block
  3. No action required from users/developers

Additional Notes

This fix is critical for maintaining the security of cross-chain message verification. Please review and merge with high priority.

  • Feature
  • Bugfix
  • Refactor
  • Format
  • Documentation
  • Testing
  • Other:

Checklist

  • I have performed a self-review of my own code.
  • The tests pass successfully with cargo test.
  • The code was formatted with cargo fmt.
  • The code compiles with no new warnings with cargo build --release and cargo build --release --features runtime-benchmarks.
  • The code has no new warnings when using cargo clippy.
  • If this change affects documented features or needs new documentation, I have created a PR with a documentation update.

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

Successfully merging this pull request may close these issues.

1 participant