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

Address issues in smart contract from security audit #93

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

Conversation

tamirms
Copy link
Contributor

@tamirms tamirms commented Sep 8, 2022

This PR implements fixes for "SBR-1 Replay attacks between chains" and "SBR-2 Deposited funds potentially locked in contract" from the security audit report:

https://drive.google.com/file/d/1f_IqUB3k3Q9XjLhG38zK5XWRF43tLZ_t/view

SBR1 is addressed by including adomainSeparator in the hash which is signed by the validators. The domainSeparator consists of the validator set version, the network chain id, and the bridge smart contract address. Including those components ensures that signatures cannot be replayed on bridge contracts deployed on multiple chains (e.g. testnet and mainnet).

SBR-2 is addressed by having a restricted list of all supported ERC20 tokens which can be deposited to the bridge contract. It is up to the validators to ensure that this allow list will contain only standard ERC20 tokens which do not subtract fees in tokens from the transferred value.
[Edit: I removed the deposit token allow list and instead explicitly checked the amount of tokens transferred to the bridge as suggested by the security audit]

Note that "SBR-3 Possible name or symbol collisions for Stellar assets" is not addressed because I think the validators can agree to not reuse symbols or names when registering Stellar assets. I think this behavior can be enforced through validator behavior and I don't think it's necessary to enforce name collision prevention in the smart contract logic. If the validators were compromised then there would be attacks of greater impact than just registering stellar assets with duplicate names.

@tamirms tamirms marked this pull request as ready for review September 9, 2022 07:10
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.

1 participant