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

Test malleability attacks #3925

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

grarco
Copy link
Contributor

@grarco grarco commented Oct 16, 2024

Describe your changes

  • Adds property tests for malleability attacks on transactions
  • Improves test_wrapper_unknown_address
  • Removes old references to encrypted/decrypted txs

Checklist before merging

  • If this PR has some consensus breaking changes, I added the corresponding breaking:: labels
    • This will require 2 reviewers to approve the changes
  • If this PR requires changes to the docs or specs, a corresponding PR is opened in the namada-docs repo
    • Relevant PR if applies:
  • If this PR affects services such as namada-indexer or namada-masp-indexer, a corresponding PR is opened in that repo
    • Relevant PR if applies:

grarco added a commit that referenced this pull request Oct 18, 2024
@grarco grarco force-pushed the grarco/test-malleability-attacks branch from d4e741b to 39972d5 Compare October 18, 2024 17:09
@grarco grarco marked this pull request as ready for review October 18, 2024 17:09
@grarco grarco added the testing label Oct 18, 2024
Copy link

codecov bot commented Oct 18, 2024

Codecov Report

Attention: Patch coverage is 95.55556% with 6 lines in your changes missing coverage. Please review.

Project coverage is 74.04%. Comparing base (a871c33) to head (da127a4).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
crates/node/src/shell/process_proposal.rs 88.23% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3925      +/-   ##
==========================================
+ Coverage   73.88%   74.04%   +0.16%     
==========================================
  Files         341      341              
  Lines      106444   106510      +66     
==========================================
+ Hits        78647    78870     +223     
+ Misses      27797    27640     -157     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

crates/node/src/shell/process_proposal.rs Show resolved Hide resolved
Comment on lines 1777 to 1791
prop_compose! {
/// Generate an arbitrary signed inner tx that has been tampered with.
pub fn arb_tampered_inner_tx(signer: common::SecretKey)
(tx1 in arb_valid_signed_inner_tx(signer.clone()))(
tx2 in arb_valid_signed_inner_tx(signer.clone()),
mut tx in Just(tx1),
) -> Tx {
// TODO: tamper with the sections too once signature is updated
// Tamper with the header only for now
tx.header = tx2.header;
tx
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be interesting if we tampered with a tx section, particularly one that had meaningful tx data, such as a bond tx. the raw header hash would have changed, while the authorization stored in a section would have been for the previous hash

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact is that changing a section does not change its commitment (unless the attacker also does that): if this happens, than the signature will still be valid and the tx will fail later during execution because it's missing the correct section that the commitment is pointing to. I believe this scenario should have a different test than this one

@grarco grarco force-pushed the grarco/test-malleability-attacks branch from 39972d5 to da127a4 Compare November 5, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants