Skip to content

fix(fc-pallet-pass): prevent reusing credentials#47

Merged
pandres95 merged 8 commits intomainfrom
fix/prevent-reusing-attestations-assertions
May 15, 2025
Merged

fix(fc-pallet-pass): prevent reusing credentials#47
pandres95 merged 8 commits intomainfrom
fix/prevent-reusing-attestations-assertions

Conversation

@pandres95
Copy link
Copy Markdown
Member

@pandres95 pandres95 commented May 14, 2025

This PR includes some tests that are failing because it's possible to reuse some credentials that have been found out there to impersonate a pass account. This is completely inadmissible, as it poses a huge security risk, and must be fixed immediately. This PR fixes it.

Superseeds #40, as this solution uses the Transaction Extensions approach.

How the fix works

  1. Challenger::generate and Challenger::validate_challenge now include a new parameter: extrinsic_context: impl AsRef<[u8]>. This parameter should be processed by the challenger.
  2. Pass::authenticate includes an additional parameter: extrinsic_context: impl AsRef<[u8]>.
  3. We pass the encoded value of inhereted_implication from TransactionExtensions::validate to Pass::authenticate.

Since this value changes on each new transaction (because the nonce changes) we ensure each

What to change in external authenticators

External authenticators now must include the external challenge using this calculation1:

  1. The extension version byte, call, extension and extension implicit should be encoded (by "extension" and its implicit we mean only the data associated with extensions that follow this one in the composite extension type);
  2. The result of the encoding should then be hashed using the BLAKE2_256 hasher;
// Step 1: encode the bytes
let encoded = (extension_version_byte, call, transaction_extensions, transaction_extensions_implicit_values).encode();
// Step 2: hash them
blake2_256(&encoded[..])

Footnotes

  1. As defined by RFC 124 from the Polkadot Fellowship.

…ss this parameter on both `Authenticator` and `UserAuthenticator` traits.
@pandres95 pandres95 moved this to In Review in Virto 2025 May 14, 2025
@pandres95 pandres95 added this to the Kreivo 0.16 milestone May 14, 2025
@pandres95 pandres95 mentioned this pull request May 14, 2025
21 tasks
@pandres95 pandres95 changed the title fix(fc-pallet-pass): prevent reusing attestations assertions fix(fc-pallet-pass): prevent reusing credentials May 14, 2025
@pandres95 pandres95 merged commit 19f167e into main May 15, 2025
6 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in Virto 2025 May 15, 2025
@pandres95 pandres95 deleted the fix/prevent-reusing-attestations-assertions branch May 15, 2025 14:36
pandres95 added a commit to virto-network/papi-signers that referenced this pull request May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants