Loopring(LRC)协议事件

Loopring(LRC)协议事件

2020年11月,以太坊上的许多DeFi平台都遭遇了安全事件,例如Pickle Finance88mph

为了检测DeFi中发生的安全事件,我们开发了ThunderForecast系统。在分析近期交易时,它会发现一类极其可疑的交易。首先,存在一对交易,它们的交易汇率差异超过千倍。其次,调用者(EOA)在每次交易结束时总能获得少量以太坊。我们使用我们研究团队开发的EthScope系统来分析这些交易,并发现这是一个利用Loopring的Vault协议漏洞进行的套利攻击。

LRC协议费用Vault

Loopring是以太坊区块链上一个开源的去中心化交易所(DEX)协议。相应的,LRC是Loopring的代币(ERC-20)。此外,Loopring有一个特定的Vault协议(LRC Protocol Fee Vault)来存储协议费用。在下面的分析中,我们将使用缩写LRCPFV。

    function sellTokenForLRC(
        address token,
        uint    amount
        )
        external
        nonReentrant
    {
        require(amount > 0, "ZERO_AMOUNT");
        require(token != lrcAddress, "PROHIBITED");

        address recipient = tokenSellerAddress == address(0) ? owner : tokenSellerAddress;

        if (token == address(0)) {
            recipient.sendETHAndVerify(amount, gasleft());
        } else {
            token.safeTransferAndVerify(recipient, amount);
        }

        require(
            tokenSellerAddress == address(0) ||
            ITokenSeller(tokenSellerAddress).sellToken(token, lrcAddress),
            "SELL_FAILURE"
        );

        emit TokenSold(token, amount);
    }

sellTokenForLRC是LRCPFV中的一个函数。该函数允许用户将池中的费用兑换成LRC代币。然而,其开发者在sellTokenForLRC中没有设计任何访问控制,因此任何人都可以调用此函数。最终,攻击者利用此漏洞,获得了发起一系列相同逻辑攻击的机会。攻击的细节将在下面进行分析。

细节

现在,我们将通过一个攻击交易0x00b2c...来揭示更多攻击细节。

共涉及六个步骤:

  • 步骤1:从0xEB7e...进行闪电贷,借入 3773.88 ETH。

  • 步骤2:在Uniswap V1-LRC上将 3773.88 ETH兑换成 5014.68 LRC。此交易的汇率为:1 ETH = 1.32878 LRC。

  • 步骤3:通过调用sellTokenForLRC,在Uniswap V1-LRC池中将LRCFV存储的 0.231 ETH费用兑换成 0.000219 LRC(如前所述,攻击者不应调用sellTokenForLRC)。然而,根据Uniswap V1-LRC使用的价格计算算法,LRC兑ETH的价格在Uniswap V1-LRC上急剧上升。此交易的汇率为:1 ETH = 0.00094 LRC。

  • 步骤4:在Uniswap V1-LRC上将 5014.68 LRC兑换成 3774.09 ETH。基于步骤3,只有少量LRC在Uniswap V1-LRC上被兑换。此操作使得LRC兑ETH在Uniswap V1-LRC上的价值增加。因此,与步骤1相比,攻击者通过在Uniswap V1-LRC上兑换 5014.68 LRC获得了 3773.88 ETH,并额外获利 0.215 ETH。

  • 步骤5:归还 3773.88 ETH闪电贷。

  • 步骤6:将 0.215 ETH发送到攻击者的地址(EOA)。

盈亏

上述分析的交易于2020年10月13日发起。为了计算攻击者和受害者之间大致但可追溯的盈亏,我们使用coingecko获取LRC的价格,即 0.0005175 ETH。另一方面,LRCPFV。

攻击者操纵了步骤4中的价格,通过两次交易获利 0.215 ETH。

攻击规模

基于攻击的特征,我们检测到3个已部署的恶意合约(0xa896...0x414a...0xd91d...)以及自LRCPFV部署以来的90笔由攻击者0x81e8...发起的交易(在第9644449个区块,LRCPFV已部署。(在交易0x33eab...中获得的最大利润甚至达到9.89 ETH。)最终,攻击者通过套利获得了总计80.97 ETH,相当于2020年10月1日的价格为48,849.2美元。

尾声

随着以太坊DeFi生态系统的发展,各种安全问题逐渐显现。然而,社区可能更容易被造成巨大经济损失的攻击所吸引,而不是一些不显眼的攻击。事实上,此次攻击背后的根本原因,即访问控制,也通过发起90笔交易给Loopring造成了相当大的损失(80.97 ETH)。

时间线

  • 2020/11/30:发现可疑交易。
  • 2020/12/01:完成分析。
  • 2020/12/02:向loopring报告。
  • 2020/12/03:漏洞确认,修复上线。
  • 2020/12/03:公布细节。
  • 2021/01/03:分配CVE-2020–35962。
Sign up for the latest updates
Weekly Web3 Security Incident Roundup | Feb 9 – Feb 15, 2026

Weekly Web3 Security Incident Roundup | Feb 9 – Feb 15, 2026

During the week of February 9 to February 15, 2026, three blockchain security incidents were reported with total losses of ~$657K. All incidents occurred on the BNB Smart Chain and involved flawed business logic in DeFi token contracts. The primary causes included an unchecked balance withdrawal from an intermediary contract that allowed donation-based inflation of a liquidity addition targeted by a sandwich attack, a post-swap deflationary clawback that returned sold tokens to the caller while draining pool reserves to create a repeatable price-manipulation primitive, and a token transfer override that burned tokens directly from a Uniswap V2 pair's balance and force-synced reserves within the same transaction to artificially inflate the token price.

Top 10 "Awesome" Security Incidents in 2025

Top 10 "Awesome" Security Incidents in 2025

To help the community learn from what happened, BlockSec selected ten incidents that stood out most this year. These cases were chosen not only for the scale of loss, but also for the distinct techniques involved, the unexpected twists in execution, and the new or underexplored attack surfaces they revealed.

#10 Panoptic Incident: XOR Linearity Breaks the Position Fingerprint Scheme

#10 Panoptic Incident: XOR Linearity Breaks the Position Fingerprint Scheme

On August 29, 2025, Panoptic disclosed a Cantina bounty finding and confirmed that, with support from Cantina and Seal911, it executed a rescue operation on August 25 to secure roughly $400K in funds. The issue stemmed from a flaw in Panoptic’s position fingerprint calculation algorithm, which could have enabled incorrect position identification and downstream fund risk.