Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

fix: Some fields in transaction are not authenticated by signature #689

Closed
wants to merge 0 commits into from

Conversation

adu-web3
Copy link
Contributor

@adu-web3 adu-web3 commented Oct 21, 2021

Closes: #426

Description

Some fields in transaction are not authenticated by signature, so there may be a cosmos transaction malleability vulnerability.
Since cosmos transaction is not signed, we can verify most of the fields of tx.Tx as null and verify fields like Fee.Amount and Fee.GasLimit based on MsgEtherumTx


For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@codecov
Copy link

codecov bot commented Oct 21, 2021

Codecov Report

Merging #689 (2f4d806) into main (08a8191) will increase coverage by 0.04%.
The diff coverage is 59.82%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #689      +/-   ##
==========================================
+ Coverage   57.36%   57.41%   +0.04%     
==========================================
  Files          63       63              
  Lines        5505     5570      +65     
==========================================
+ Hits         3158     3198      +40     
- Misses       2180     2199      +19     
- Partials      167      173       +6     
Impacted Files Coverage Δ
rpc/ethereum/types/utils.go 0.00% <ø> (ø)
server/config/config.go 21.48% <36.36%> (-0.12%) ⬇️
app/ante/eth.go 82.28% <56.00%> (-5.92%) ⬇️
app/ante/ante.go 48.19% <100.00%> (ø)
encoding/config.go 95.00% <100.00%> (ø)
x/evm/types/chain_config.go 100.00% <100.00%> (ø)

Copy link
Contributor

@tomtau tomtau left a comment

Choose a reason for hiding this comment

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

maybe good to add some tests for the failure cases?

@adu-web3
Copy link
Contributor Author

maybe good to add some tests for the failure cases?

Good idea!
I will add more tests for failure cases.

@fedekunze fedekunze marked this pull request as draft October 21, 2021 11:08
app/ante/eth.go Outdated Show resolved Hide resolved
@adu-web3
Copy link
Contributor Author

Add more tests for failure cases where the tx.Tx gets signed, or has Memo, TimeoutHeight, or has invalid fee amount and gaslimit (not compatible with MsgEthereumTx).
Fix the typo protoTxPrivider -> protoTxProvider as well.

Copy link
Contributor

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, I'd like to see a separate test that compares the signatures from:

  • MsgEthereumTx (v, r, s)
  • sdk.Tx using the tx Builder
  • ethereum Transaction

@tomtau tomtau marked this pull request as ready for review October 22, 2021 09:39
@tomtau tomtau requested a review from fedekunze October 22, 2021 09:39
@adu-web3
Copy link
Contributor Author

Thanks for the PR, I'd like to see a separate test that compares the signatures from:

  • MsgEthereumTx (v, r, s)

  • sdk.Tx using the tx Builder

  • ethereum Transaction

Ok, I will write a separate test comparing these signatures

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some fields in transaction are not authenticated by signature
4 participants