×
Array
(
[fid] => 6980
[description] =>
[password] =>
[icon] =>
[redirect] =>
[attachextensions] =>
[creditspolicy] => Array
(
[post] => Array
(
[usecustom] => 1
[cycletype] => 1
[cycletime] => 0
[rewardnum] => 75
[extcredits1] => 0
[extcredits2] => 0
[extcredits3] => 0
[extcredits4] => 0
[extcredits5] => 0
[extcredits6] => 0
[extcredits7] => 0
[extcredits8] => 0
[rid] => 1
[fid] => 6980
[rulename] => 发表主题
[action] => post
[fids] => 32,52,67,447,1120,1151,1156,6750,6762,6763,6766,6769,6772,6773,6787,6796,6808,6809,6810,6813,6814,6820,6829,6830,6846,6856,6864,6865,6827,6930,6931,6776,6858,6880,6764,6932,6871,6758,6905,1116,6788,6812,6798,6736,6759,6842,6966,6767,6828,6924,6935,6936,6938,6940,6941,6826,6909,6803,6919,6911,6908,6881,6920,6912,6913,6921,6925,6922,6789,6818,6819,6872,6928,6969,6889,6888,6917,6939,6947,6961,6937,6943,6970,6869,6900,6902,6783,6817,1111,6870,6821,6951,6876,6952,6954,6960,6942,6910,6949,6962,6963,6964,6927,6926,6973,6728,6929,6874,6894,6896,6885,6857,6868,1113,6778,56,6844,6878,6802,6933,6811,6923,6877,6875,6918,6892,6757,6832,6833,6795,6793,6848,6837,6849,6850,6851,6852,6853,6854,6863,6882,6836,6790,6838,6794,6791,6873,555,6895,6934,6958,6944,6945,6907,6779,6886,6950,6904,6956,6862,6957,6855,6955,6959,6914,6965,6971,6972,6953,6975,6976,6799,6974,6824,6815,6891,6866,6979,6977,6765,6903,6948,6845,6879,1121,6980
)
[reply] => Array
(
[usecustom] => 1
[cycletype] => 4
[cycletime] => 0
[rewardnum] => 0
[extcredits1] => 0
[extcredits2] => 0
[extcredits3] => 0
[extcredits4] => 0
[extcredits5] => 0
[extcredits6] => 0
[extcredits7] => 0
[extcredits8] => 0
[rid] => 2
[fid] => 6980
[rulename] => 发表回复
[action] => reply
)
[digest] => Array
(
[usecustom] => 1
[cycletype] => 4
[cycletime] => 0
[rewardnum] => 0
[extcredits1] => 0
[extcredits2] => 0
[extcredits3] => 0
[extcredits4] => 0
[extcredits5] => 0
[extcredits6] => 0
[extcredits7] => 0
[extcredits8] => 0
[rid] => 3
[fid] => 6980
[rulename] => 加精华
[action] => digest
)
)
[formulaperm] => a:5:{i:0;s:0:"";i:1;s:0:"";s:7:"message";s:0:"";s:5:"medal";N;s:5:"users";s:0:"";}
[moderators] =>
[rules] =>
[threadtypes] => Array
(
[status] => 1
[required] => 0
[listable] => 0
[types] => Array
(
)
)
[threadsorts] => Array
(
)
[viewperm] =>
[postperm] =>
[replyperm] =>
[getattachperm] =>
[postattachperm] =>
[postimageperm] =>
[spviewperm] =>
[seotitle] =>
[keywords] =>
[seodescription] =>
[supe_pushsetting] =>
[modrecommend] => Array
(
[open] => 0
[num] => 10
[imagenum] => 0
[imagewidth] => 300
[imageheight] => 250
[maxlength] => 0
[cachelife] => 0
[dateline] => 0
)
[threadplugin] => Array
(
)
[replybg] =>
[extra] => a:2:{s:9:"namecolor";s:0:"";s:9:"iconwidth";s:0:"";}
[jointype] => 0
[gviewperm] => 0
[membernum] => 0
[dateline] => 0
[lastupdate] => 0
[activity] => 0
[founderuid] => 0
[foundername] =>
[banner] =>
[groupnum] => 0
[commentitem] =>
[relatedgroup] =>
[picstyle] => 0
[widthauto] => 0
[noantitheft] => 0
[noforumhidewater] => 0
[noforumrecommend] => 0
[livetid] => 0
[price] => 0
[fup] => 6974
[type] => sub
[name] => 币圈资讯
[status] => 1
[displayorder] => 0
[styleid] => 0
[threads] => 84891
[posts] => 84962
[todayposts] => 0
[yesterdayposts] => 0
[rank] => 56
[oldrank] => 56
[lastpost] => 2760085 The Smarter Web Company 筹集 500 万美元,用于增持比特币 1756189025 比推快讯
[domain] =>
[allowsmilies] => 1
[allowhtml] => 1
[allowbbcode] => 1
[allowimgcode] => 1
[allowmediacode] => 0
[allowanonymous] => 0
[allowpostspecial] => 1
[allowspecialonly] => 0
[allowappend] => 0
[alloweditrules] => 0
[allowfeed] => 0
[allowside] => 0
[recyclebin] => 1
[modnewposts] => 0
[jammer] => 0
[disablewatermark] => 0
[inheritedmod] => 0
[autoclose] => 0
[forumcolumns] => 0
[catforumcolumns] => 0
[threadcaches] => 0
[alloweditpost] => 1
[simple] => 16
[modworks] => 0
[allowglobalstick] => 1
[level] => 0
[commoncredits] => 0
[archive] => 0
[recommend] => 0
[favtimes] => 0
[sharetimes] => 0
[disablethumb] => 0
[disablecollect] => 0
[ismoderator] => 0
[threadtableid] => 0
[allowreply] =>
[allowpost] =>
[allowpostattach] =>
)
[解读合约审计]Harmony的跨链桥是如何被盗一亿美金的?
[复制链接]
|
当前离线
经验:
天策币:
活跃币:
策小分:
总在线: 分钟
本月在线: 分钟
|
|
内容概要
2022年6月24日,由Layer1公链Harmony开发的,以太坊与Harmony间的资产跨链桥Horizon遭到攻击,损失金额约为1亿美元。
这到底是怎么回事?
虽然黑客攻击发生的当天就能断定属于“公证人私钥被盗”,既然贵客点开,不妨来展开聊聊,放心,有少数硬核源码但全篇讲白话,通俗易懂!
跨链桥分类与技术原理 Horizon合约审计报告解读 被盗原因复盘分析与总结
1、跨链桥技术原理
跨链,顾名思义是不同区块链之间资产信息如何转移的问题,也称之为互操作性,而目前有超50种跨链解决方案,其方案定义是多种多样的。

1.1、跨链方案有哪些?
概括来讲,要实现资产价值在另一条链上恒定,有两种大路径按”价格”锚定和按”物理”锚定
乍一听复杂,其实按价格锚定就是在各公链上的USDT这种稳定币,他与美元1:1锚定,因此也属于跨链资产的一种。
抛开各类稳定币更直观一种跨链方案则是物理锚定,即流动性总量是恒定的,其方案也很多(公证人、侧链、中继链、哈希锁定等),咱们重点讲公证人模式。
公证人模式依据”公证人是谁“有三种区分:
交易所做担保型:比如币安提币,各种买卖均在中心化交易所进行,提币才兑现 流动性池桥接型:比如bridge.connext,o3swap 合约锁定铸造型:各类官方桥通用方案polygon/arbitrum/avax/celer,以及今天的主角harmony
锁定铸造型由于产生的是包装代币,因此往往是各公链具有一定公信力的官方桥才采用。
以上均各有优缺,或是怕交易所跑路,或是流动性枯竭,或是公证人私钥被盗,目前并没有完美实现不可能三角的跨链方案出现。
如下图是o3swap的流动性总量和交易量趋势,近半年已然跌去90%,或许是因为去年8月的质押资产被盗案导致不断式微吧。

1.2、Horizon桥的跨链原理
Harmony开发的Horizon桥是非常标准的公证人锁定铸造型。
为何锁定铸造可以被信任呢?
是由于区块链上的合约具有不可更改特性,如果不留后门的话,甚至一旦部署将无任何方式可以影响他的运作,正如无聊猿官方自己将所有权限转入0地址,放弃所有权后,无任何方式可以进一步铸造出新的猴子,其流动性总量将被锁死。
同理的,不同公链之间虽然合约不同,但如果在以太坊上用合约锁住10个ETH,在另一条公链上也以同样有公信力的合约,来释放10个wETH,这样一来其实全局上流动性是固定的,只要wETH可以随时转回以太坊并兑换得到ETH,那wETH就可以被认为是具有了ETH的等同价值。
因此其核心的操作就是
Lock-and-Mint:A链锁定代币流动性 + B链发行等量的可流通包装代币 Burn-and-Release:B链销毁包装代币 + A链解锁等量基础代币的流动性 公证人:负责发现A链Lock锁定事件后,去B链Mint铸造出锚定代币,转入目标地址。

有锁定自然衡量各个跨链桥规模的最佳方式就是TVL(总价值锁定),可以显著看到6.24之后,Horizon的TVL瞬间跌入谷底,当安全事故来临再多的TVL也就如流水一般,蜂拥而至也一哄而散。

2、Horizon桥的合约审计报告解读
一次事故对很多Web3项目而言,做不到100%安全就基本等于0的价值,因此为了检查合约的安全性,一般会测试模拟多种攻击场景,通过checklist进行安全审查,以确保合约安全
开发或许几天而已,但要足够可靠则流程多且昂贵(一般报价按时间衡量10W刀起步)

审计报告的核心信息是:风险名称、漏洞描述、风险等级、安全建议、修复状态及审计结果等
而Horizon桥的合约审计报告是老牌审计公司PeckShield进行的,发现了5个漏洞风险

2.1、中低风险点1-兼容不足
是不是很难想象区区3行代码都能有bug?

其实锁定token的逻辑很简单,就是用户制定金额和目标地址,在授权代扣权限后,合约将USDT转入此合约锁定,并发出一个locked事件,让链下的公证人可以得知资产已经被锁定了。

但PeckShield审计发现LockToken锁定函数对通缩型token是不兼容的,用户传入的amount如果是100,自然Locked事件发出的是成功锁定100个
但是如果是”通缩型“的token呢?进行safeTransferFrom |
|
|
|
|
|
|