又是闪电贷,Web3世界空手套白狼?——Fswap被攻击事件分析

成都链安Published on 2022-06-14Last updated on 2022-06-14

Abstract

BSC的Fswap合约遭受黑客闪电贷攻击,黑客获利约1751.6293WBNB,价值约40万美元。

2022年6月13日,成都链安链必应-区块链安全态势感知平台舆情监测显示,BSC的Fswap合约遭受黑客闪电贷攻击,黑客获利约1751.6293WBNB,价值约40万美元。成都链安安全团队第一时间对事件进行了分析。

#1什么是闪电贷

闪电贷概念最早由Marble协议于2018年提出。Marble自诩「智能合约银行」,其产品是很简单、但很具智慧的DeFi创新:通过智能化合约完成的零风险贷款。

闪电贷的基本工作原理是:在单笔交易中贷出借款人需要的金额。然而在交易结束时,借款人必须偿还不少于贷款金额的数目。如果借款人做不到,贷款机构会自动回滚交易。

简单讲,闪电贷是自动的:如果借款人不能偿还贷款,整个交易就会回滚,就像贷款根本没发生一样。

好,接下来我们来看本次事件是如何发生的。

#2事件相关信息

回到本次Fswap合约被攻击事件:

攻击交易

0xe75e30dafd865331e6a002d50effe084c21e413c96d4550d5e09cf647686fcbe

攻击者地址

0x0007D40F29c7A1713b251c69f5d999f16eC09Dfc

攻击合约

0x7437e7a923a5b467a197c6fae991f0f0ced9af57

被攻击合约

0x0d5F1226bd91b5582F6ED54DeeE739CAC49C37Db

#3攻击流程

第一步,攻击者先通过另外一个项目闪电贷一笔BSC-USD,将其中的大部分购买MC代币。

第二步,攻击者反复在pair中进行BSC-USD新的闪电贷,再将剩余的初始资金作为手续费支付。

第三步,每当用户在进行交换时,pair合约会向地址

0xe8a374c386d94b9b9d8feb801aec1ee44aad06ec发送交易对中的MC代币作为手续费。在这里会大量消耗合约里的MC,从而使MC的价格迅速上升。

第四步,攻击者再以初始购买的MC,交换大量的BSC-USD。偿还初始闪电贷后,将获利其兑换为WBNB。

最终,黑客就这样空手套白狼,获利约1751.6293WBNB。

#4漏洞分析

本次攻击主要利用了Fswap中pair合约在交易时会将合约中的reserve作为手续费发送给指定地址,从而导致价格的变化。

#5资金追踪

截止发文时,被盗资金1751.6293WBNB(约39.34万美元)已全部转移到Tornado.cash。

#6总结

闪电贷本身的存在是没有问题的,但有心之人将其利用,以极低的成本撬动巨量资金,在多个协议间进行价格操纵或套利,就存在风险。

针对本次事件,成都链安安全团队建议:Swap时的产生的手续费应该由用户支付,而不是用pair合约自身reserve支付。此外建议项目上线前选择专业的安全审计公司进行全面的安全审计,规避安全风险。

Related Reads

DeepSeek Funding: Liang Wenfeng's 'Realist' Pivot

DeepSeek, a leading Chinese AI company, has initiated its first external funding round, aiming to raise at least $300 million at a valuation of no less than $10 billion. This move marks a significant shift from its founder Liang Wenfeng’s previous idealistic stance of rejecting external capital to maintain independence. Despite strong financial backing from its parent company, quantitative trading firm幻方量化 (Huanfang Quant), which provided an estimated $700 million in revenue in 2025 alone, DeepSeek faces mounting challenges. Key issues include a 15-month gap in major model updates, delays in its flagship V4 release, and the loss of several core researchers to competitors offering significantly higher compensation. The company is also undergoing a strategic pivot by migrating its infrastructure from NVIDIA’s CUDA to Huawei’s Ascend platform, a move aligned with China’s push for technological self-reliance amid U.S. export controls. However, DeepSeek lags behind rivals like智谱AI and MiniMax—both now publicly listed—in areas such as product ecosystem, multimodal capabilities, and commercialization. The funding round, though relatively small in scale, is seen as a way to establish a market-validated valuation anchor, making employee stock options more competitive and facilitating talent retention. It also signals DeepSeek’s transition from a pure research-oriented organization to a commercially-driven player in the global AI ecosystem.

marsbit5m ago

DeepSeek Funding: Liang Wenfeng's 'Realist' Pivot

marsbit5m ago

Solana Q1 Report: Revenue Plunges 68% Year-on-Year, Developers Decrease by 30%

Solana Q1 2026 Report: Key Metrics Show Significant Decline Amid Market Reset Solana experienced a substantial downturn in Q1 2026, with key performance indicators reflecting a broader market cooling. Total network revenue (REV) fell to $89.9 million, down 68% year-over-year (YoY) and 1.4% quarter-over-quarter (QoQ). This decline was driven by reduced speculative activity, which had previously fueled the network during the 2024/2025 bull market. Key revenue components saw mixed results: base fees dropped 8.7% QoQ, Jito tips (MEV) fell 19.7%, priority fees rose 23%, and vote fees declined 44.5%. The annualized real yield for stakers was just 0.17%, down 67% YoY. Network GDP, generated by top applications, fell 7% QoQ to $451 million. Pump Fun emerged as a standout, generating $103 million (up 3% QoQ), surpassing Solana's L1 revenue. However, daily active addresses averaged 2.4 million, down 4.8% YoY. Stablecoin supply on Solana reached $15.9 billion, down 2.7% QoQ but up 18% YoY. USDC and USDT remained dominant. DEX volumes averaged $3.2 billion daily, with private DEXs now accounting for 60% of all volume. The network's net dilution rate was 4.38%, while the cost to produce $1 of REV was $8.10, up 93% YoY. The number of new tokens created on launchpads grew 42% QoQ to 3 million, with Pump Fun dominating 85% of this market. Despite the downturn, Solana's core strengths remain: its position as a hub for retail trading apps, potential in perpetual markets, and growing use in stablecoin-based fintech applications, particularly in Latin America. However, developer activity declined 32% YoY, slightly worse than Ethereum's 29% drop. The network must now focus on attracting traditional finance, competing in perpetual markets, and sustaining developer ecosystem growth to drive the next expansion cycle.

marsbit42m ago

Solana Q1 Report: Revenue Plunges 68% Year-on-Year, Developers Decrease by 30%

marsbit42m ago

Trading

Spot
Futures
活动图片