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

Vulnerable withdrawal request #34

Open
leandro-ro opened this issue Sep 13, 2022 · 0 comments
Open

Vulnerable withdrawal request #34

leandro-ro opened this issue Sep 13, 2022 · 0 comments

Comments

@leandro-ro
Copy link

leandro-ro commented Sep 13, 2022

Location

AssetHolderWithdrawalAuth in bindings/assetholder/AssetHolder.go generated through WithdrawalAuth in perun-eth-contracts.

Problem

AssetHolderWithdrawalAuth does not contain a nonce. This makes withdrawals requesting an amount smaller than half of the total funds vulnerable for a replay attacks. It is especially problematic because the receiver can be an external party.

Consider this scenario: Alice and Bob concluded a channel. Bob is left with 1 ETH.
Bob owes Eve 0.1 ETH. He wants to pay Eve directly and withdraws 0.1 ETH with Eve as the receiver.
Eve captures Bobs call to the contract containing the signed AssetHolderWithdrawalAuth. Now Eve calls withdraw herself with the captured AssetHolderWithdrawalAuth to steal an additional 0.1 ETH from the channel. Eve does this multiple times to withdraw all funds of Bob.

Proposal

There are two possible ways I think we can deal with this issue:

  1. Remove the possibility to set a specific amount and limit the user to only withdraw the complete balance.
  2. Add a nonce to AssetHolderWithdrawalAuth. The contract must store the nonces and only accept withdrawals if the given nonce is new.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants