安全公司慢雾:Punk Protocol被攻击主要因其未做重复初始化检查

This article is not available in the current language yet. Showing the original version.

PANews 8月12日消息,安全公司慢雾对去中心化年金协议Punk Protocol遭遇攻击的原理进行了解析。攻击者首先调用 CompoundModel 合约的 Initialize 函数进行重复初始化操作将合约 Forge 角色设置为攻击者指定的地址。随后攻击者为了最大程度的将合约中资金取出,其调用了 invest 函数将合约中的资金抵押至 Compound 中以取得抵押凭证 cToken。最后攻击者直接调用 withdrawToForge 函数将合约中的 cToken 转回 Compound 获取对应的底层资产并最终将其转给 Forge 角色。withdrawToForge 函数被限制只有 Forge 角色可以调用,但 Forge 角色已被重复初始化为攻击者指定的地址,因此最终合约管理的资产都被转移至攻击者指定的地址。本次攻击的根本原因在于其 CompoundModel 的 Initialize 函数未做重复初始化检查,导致攻击者直接调用此函数进行重复初始化替换 Forge 角色,最终造成合约管理的资产被盗。

Share to:

Author: PA一线

This content is for market information only and is not investment advice.

Follow PANews official accounts, navigate bull and bear markets together