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

Signatures for SignaturePayload can be re-interpreted to be signatures for distinct messages #2947

Closed
2 tasks done
kayabaNerve opened this issue Jan 16, 2024 · 2 comments
Closed
2 tasks done
Labels
I2-bug The node fails to follow expected behavior. I10-unconfirmed Issue might be valid, but it's not yet known.

Comments

@kayabaNerve
Copy link

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

impl<Call, Extra> Encode for SignedPayload<Call, Extra>
where
Call: Encode,
Extra: SignedExtension,
{
/// Get an encoded version of this payload.
///
/// Payloads longer than 256 bytes are going to be `blake2_256`-hashed.
fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R {
self.0.using_encoded(|payload| {
if payload.len() > 256 {
f(&blake2_256(payload)[..])
} else {
f(payload)
}
})
}
}

The potential reduction, which I can't identify the reasoning for in the first place, means that a hashed message can be re-interpreted as a message itself (or an unhashed 32-byte message can be reinterpreted as the hash of a longer message, yet this requires finding a preimage).

This shouldn't practically be an issue due to the lack of 32-byte messages in the ecosystem. Extrinsic almost always has several extensions which will place its payload far beyond 32 bytes. It'd require a distinct use of SignaturePayload, which I presume unlikely.

I did follow responsible disclosure on this, as it is arguable as a critical fault in the signature as a formal object, and was told it's a non-issue I'm welcome to publicly disclose.

Steps to reproduce

No response

@kayabaNerve kayabaNerve added I10-unconfirmed Issue might be valid, but it's not yet known. I2-bug The node fails to follow expected behavior. labels Jan 16, 2024
@kayabaNerve
Copy link
Author

I'd presume this will be resolved with #2415 is.

kayabaNerve added a commit to serai-dex/serai that referenced this issue Jan 16, 2024
@bkchr
Copy link
Member

bkchr commented Jan 17, 2024

Yes, I added this comment because of your report. Thank you for the report.

I don't see any reason to keep this issue open, as it is already tracked in the linked issue. You can leave there a comment if you like.

@bkchr bkchr closed this as completed Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I2-bug The node fails to follow expected behavior. I10-unconfirmed Issue might be valid, but it's not yet known.
Projects
None yet
Development

No branches or pull requests

2 participants