Connext contest - shw's results

The interoperability protocol of L2 Ethereum.

General Information

Platform: Code4rena

Start Date: 09/07/2021

Pot Size: $25,000 USDC

Total HM: 7

Participants: 10

Period: 3 days

Judge: ghoulsol

Total Solo HM: 2

Id: 19

League: ETH

Connext

Findings Distribution

Researcher Performance

Rank: 4/10

Findings: 6

Award: $3,334.78

🌟 Selected for report: 4

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: pauliax

Also found by: gpersoon, shw

Labels

bug
duplicate
3 (High Risk)
sponsor confirmed

Awards

1103.2637 USDC - $1,103.26

External Links

Handle

shw

Vulnerability details

Impact

The consumed gas to remove a user's active block is proportional to the total number of array elements (i.e., block numbers). However, the array size can be arbitrarily increased by an attacker (with only paying gas fees), causing a gas griefing attack when the victim wants to fulfill or cancel his transactions.

Proof of Concept

Consider an attacker performing the following steps:

  1. The attacker creates a malicious ERC20 token, which returns true for any transferFrom call.
  2. The attacker calls the prepare function multiple times on the sending chain with invariantData.user being the victim and invariantData.sendingAssetId as the malicious ERC20 token address. The router's address differs in each call to make the digest different every time (to pass the check at line 192). The rest of the provided parameters are valid.
  3. As a result, the size of the user's activeTransactionBlocks array increases by the number of prepare calls.
  4. Whenever the user calls fulfill or cancel on a regular transaction, he suffers from large gas consumption due to the array traverse and copying in the removeUserActiveBlocks function. Moreover, to cancel those malicious transactions, the user has to wait for them to expire and pay additional gas fees to cancel them.

Referenced code: TransactionManager.sol#L209

A possible mitigation is to re-design the way to store the user's active transaction blocks to avoid spending O(N) amount of gas when removing a specific block number from the array (where N is the total elements in the array). Please refer to the issue with the title "Gas optimization on maintaining the activeTransactionBlocks array" for more details.

#0 - LayneHaber

2021-07-12T20:15:02Z

#27

#1 - ghoul-sol

2021-08-02T01:03:29Z

Duplicate of #27 so high risk

Findings Information

🌟 Selected for report: 0xRajeev

Also found by: cmichel, gpersoon, pauliax, s1m0, shw

Labels

bug
duplicate
3 (High Risk)
sponsor confirmed

Awards

402.1396 USDC - $402.14

External Links

Handle

shw

Vulnerability details

Impact

When the user calls fulfill with a non-zero callTo parameter, the TransactionManager tries to call execute on callTo, and if the function call fails, the manager transfers toSend amount of receiving assets to receivingAddress. However, since the assets may have been transferred before (when the addFunds call fails), the user could get twice the toSend amount assets as a result.

Proof of Concept

Referenced code: TransactionManager.sol#L405-L408 TransactionManager.sol#L424-L427

Since the assets are approved or transferred to the receivingAddress before calling the execute function, the manager should not transfer assets again if the execute call fails.

#0 - LayneHaber

2021-07-12T19:47:45Z

#46

Findings Information

🌟 Selected for report: pauliax

Also found by: 0xsanson, cmichel, shw

Labels

bug
duplicate
3 (High Risk)
sponsor confirmed

Awards

744.703 USDC - $744.70

External Links

Handle

shw

Vulnerability details

Impact

When the user calls fulfill on the receiving chain with a non-zero callTo address, the TransactionManager approves callTo to transfer toSend amount of receiving assets. Then, the manager tries to call addFunds on callTo, and if the call fails, the manager then transfers toSend amount of assets to the receivingAddress. However, after the transfer, the callTo address can still transfer the toSend amount of assets from the manager because of the previous approval, resulting in the user getting twice the toSend amount of assets from the manager.

Proof of Concept

Referenced code: TransactionManager.sol#L387-L389 TransactionManager.sol#L405-L408

Directly transfer toSend amount of assets to callTo before calling addFunds instead of approving callTo.

#0 - LayneHaber

2021-07-12T19:38:09Z

#31

Findings Information

🌟 Selected for report: 0xRajeev

Also found by: cmichel, shw

Labels

bug
duplicate
2 (Med Risk)

Awards

330.9791 USDC - $330.98

External Links

Handle

shw

Vulnerability details

Impact

If a user's two transactions can have the same transactionId (while their router addresses differ), then the fulfill and cancel signatures for one of the transaction is replayable on the other.

Proof of Concept

The only transaction-related data in the SignedCancelData and SignedFulfillData structures are the transactionId of the transaction. Thus, these signatures are valid for all transactions with the same transactionId.

A malicious attacker can monitor the blockchain network and collect all signatures of a victim. Once the attacker found a new victim's transaction created with a duplicated transactionId he has seen before, he can fulfill or cancel the transaction on behalf of the victim since he has a valid signature. Besides, since the signature does not contain information about the chain ID, it is possible to perform the replay attack across chains.

Referenced code: ITransactionManager.sol#L51-L62

Add the router address and the chain ID information to the signed data structure to ensure a signature is only for a specific transaction.

#0 - LayneHaber

2021-07-12T20:21:05Z

#54

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter