重温 CashioApp 安全事件

重温 CashioApp 安全事件

BlockSec 正在回顾 Cashio 应用安全事件

2022 年 3 月 23 日 16:20:08 UTC+8 开始,CashioApp 被利用,导致抵押代币账户被耗尽,损失约 5200 万美元。此次黑客攻击之所以得逞,是因为对输入账户的检查不足,允许攻击者在没有任何存款的情况下铸造 200 亿枚 $CASH 代币。接下来,我们将展示技术细节。

摘要

此次事件是由 Brrr 程序中的一个错误引起的,该程序旨在处理使用 Saber LP Arrows 作为抵押品的 $CASH 代币的铸造和销毁。具体来说,用户可以通过存入 Arrow LP 代币来打印 $CASH,即铸造 CASH。请注意,ArrowLP代币以[SaberLPtoken](https://app.saber.so/swap)作为底层代币。printcash指令(可以铸造CASH。请注意,Arrow LP 代币以 [Saber LP token](https://app.saber.so/swap) 作为底层代币。`print_cash` 指令(可以铸造 `CASH)接收一个账户列表,包括 Bank账户和Collateral账户。它们用于记录和跟踪允许用于铸造CASH的抵押品(即ArrowLP代币)。根据设计,这两个账户只能由管理员初始化和授权。然而,该程序未能检查Bank账户的有效性。因此,攻击者可以构造一系列虚假账户(包括Bank账户)来喂给printcash指令,从而几乎免费地打印CASH` 的抵押品(即 `Arrow` LP 代币)。根据设计,这两个账户只能由管理员初始化和授权。然而,该程序未能检查 `Bank` 账户的有效性。因此,攻击者可以构造一系列虚假账户(包括 `Bank` 账户)来喂给 `print_cash` 指令,从而几乎免费地打印 `CASH`(唯一的成本是交易费用)。

细节

让我们从下面 print_cash 指令使用的账户开始分析。

common 属性(第 75 行)是一个结构体,在程序中其类型为 BrrrCommon。在 BrrrCommon 中,bank 账户和 collateral 账户由管理员初始化和授权。crate_token$CASH 代币的账户,其中存储了有关 $CASH 的信息,例如 crate_mint 的公钥(第 107 行)、管理员角色的公钥等。crate_collateral_tokens 是一个金库账户,用于存放从用户那里转移过来的抵押品代币。由于抵押品应该是 Arrow LP 代币,而 Arrow LP 代币接收 Saber 的 LP 代币,因此用户必须输入与 saber_swap 相关的账户。BrrrCommon 结构体的最后两个属性是指令中使用的目标程序的程序 ID。请注意,PrintCash 结构体中的最后四个属性是用户的系统账户(也是交易的签名者)、用户的抵押品账户、接收铸造的 $CASH 的用户的 $CASH 代币账户,以及拥有铸造 $CASH 权限的账户的公钥。

攻击交易

在理解了上述账户的功能后,我们开始分析攻击交易:0x4fgL…z2K5。此攻击由攻击者地址(位于 0x6D7f)发起,PrintCash 指令中的输入账户列表如下所示。

Account #1(上面的 0x5aha)对应于 Bank 账户。我们注意到它与 CashioApp 官方网站上提供的地址 (0xEm1P) 不同,这意味着 Bank 账户的验证不足!

验证

让我们仔细查看代码中 BrrrCommon 结构体的验证,以找出绕过方法。

对输入 Bank 账户的唯一检查是确保输入的 Collateral 账户与 Bank 账户相关联(第 12 行)。但是,通过提供一个虚假的 Collateral 账户也可以轻松绕过。此外,为了避免支付真实的抵押品资产,攻击者还提供了虚假的 saber_swap 账户。请注意,攻击者的目标是存入无价值的抵押品资产来打印有价值的 $CASH 代币,因此攻击者提供的 crate_tokencrate_mint 应该是真实的地址。换句话说,Bank 账户检查不足使得攻击者能够构造一系列虚假账户,并以无价值的抵押品打印 $CASH

修复

修复方法是添加 assert_keys_eq!(self.bank.crate_mint, self.crate_mint) 语句。此语句可确保 Bank 账户的 crate_mint 是正确的 $CASHcrate_mint。但是,它如何确保 Bank 账户有效呢?让我们查看(bankman 程序中的)NewBank 结构体和(crate_token 程序中的)NewCrate 结构体来找到答案。

事实上,Bank 账户是一个 PDA,其 seed 包含 crate_token 的地址。同时,crate_token 也是一个 PDA,其 seed 包含 crate_mint 的地址。这确保了如果输入的 crate_mint 有效,Bank 账户就有效。没有正确的 crate_mint,攻击者就无法铸造 $CASH,也无法发动攻击。

关于 BlockSec

BlockSec 是一家开创性的区块链安全公司,由一群杰出的全球安全专家于 2021 年创立。该公司致力于提高新兴 Web3 世界的安全性和可用性,以促进其大规模采用。为此,BlockSec 提供智能合约和 EVM 链 安全审计 服务、用于安全开发和主动阻止威胁的 Phalcon 平台、用于资金追踪和调查的 MetaSleuth 平台,以及供 Web3 构建者在加密世界中高效冲浪的 MetaSuites 扩展。

迄今为止,该公司已为 MetaMask、Uniswap Foundation、Compound、Forta 和 PancakeSwap 等 300 多家尊贵客户提供服务,并已从 Matrix Partners、Vitalbridge Capital 和 Fenbushi Capital 等知名投资者那里完成了两轮融资,总计数千万美元。

官方网站:https://blocksec.com/

官方 Twitter 账号:https://twitter.com/BlockSecTeam

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.