Consensys / linea-contracts

Linea smart-contracts
http://linea.build/
73 stars 61 forks source link

Specific Security Recommendations for Protocols on Linea in Relation to Issue #17 #19

Open piotrammain opened 3 months ago

piotrammain commented 3 months ago

This discussion addresses potential security vulnerabilities within Linea's ecosystem arising from the existing blacklisting asymmetry introduced by USDC (as detailed in issue #17). It also assesses the security implications of introducing Native USDC and proposes recommendations for mitigating these risks.

Attack Vectors due to Blacklisted USDC Addresses

Blacklisted addresses for popular ERC20 tokens, like USDC, can be used to exploit in several ways within perpetual protocols on Linea.

Impact on Different Protocol Types

This vulnerability can affect various protocols on Linea, including:

These protocols are susceptible if they utilize token transfers to arbitrary addresses or user accounts and if the transferred token has blacklist functionality. If a liquidation requires transferring a blacklisted token to a blacklisted address, the transaction will revert, hindering the liquidation process.

Recommendations

Cross-Chain Transfer Protocol (CCTP) and Potential Impact on Existing Bridged USDC

Description:

This issue explores the potential interaction between the Cross-Chain Transfer Protocol (CCTP) and existing bridged forms of USDC. While Circle's documentation suggests no direct impact (https://developers.circle.com/), this requires further discussion in the context of composability within DeFi smart contracts.

Current Bridging Mechanisms:

CCTP and its Benefits:

Potential Concerns:

Alternative Use Case:

Recommendations for Developers:

Discussion Points:

Additional Notes:

whileunless commented 3 months ago

The science of blacklisting. Consensys is good in taking money from people and censoring them. But to expect from them to dive into all this science of blacklisting - may not happen without throwing on them millions of fiat more.

gregorio500 commented 3 months ago

Oof, the complexity of handling different USDC forms is giving me chills!

piotrammain commented 3 months ago

Oof, the complexity of handling different USDC forms is giving me chills!

To clarify some previous points:

The Circle documentation states, "CCTP, as a low-level primitive, can be embedded within any app or wallet—even existing bridges—to enhance and simplify the user experience for cross-chain use cases. With USDC circulating on a large number of blockchain networks, CCTP can connect and unify liquidity across disparate ecosystems where it's supported"(https://developers.circle.com/stablecoins/docs/cctp-getting-started).

However, cross-chain and cross-USDC vulnerabilities associated with, but not limited to, blacklisting asymmetry, should not create a situation where the internal accounting of smart contracts unifies liquidity by introducing new attack vectors. Significant differences exist between various USDC forms, such as USDC.e, and a well-considered approach is necessary to handle all edge cases without introducing critical vulnerabilities into composable smart contracts.

While Circle's documentation claims that "CCTP has no direct impact upon existing bridged forms of USDC" (https://developers.circle.com/stablecoins/docs/cctp-faq), it's crucial to emphasize that different USDC forms are not isolated; composability is the foundation of DeFi smart contract development. As previously mentioned, diverse cross-chain, cross-USDC scenarios, and various blacklisting asymmetries introduced by both native and bridged USDC exist. We might argue that development on top of this can still be composable, but only at the expense of security if developers are not vigilant about the potential dangers.