[{"data":1,"prerenderedAt":152},["ShallowReactive",2],{"\u002Fblog\u002F2021-08-15-what-a-bridge-actually-trusts":3},{"id":4,"title":5,"archiveType":6,"body":7,"category":136,"contextDate":137,"cover":138,"coverAlt":139,"date":140,"description":141,"extension":142,"featured":143,"historicalDate":140,"historicalLabel":137,"meta":144,"navigation":145,"path":146,"publishedDate":137,"seo":147,"stem":148,"thumbnail":137,"workPeriod":149,"writtenDate":150,"__hash__":151},"blogs\u002Fblog\u002F2021-08-15-what-a-bridge-actually-trusts.md","What a bridge actually trusts: the Poly Network hack, read after running our own bridge","retrospective",{"type":8,"value":9,"toc":128},"minimark",[10,22,25,30,39,42,45,48,52,55,58,67,70,74,77,80,83,87,122,125],[11,12,13,14,21],"p",{},"On 10 August an attacker moved more than $600 million out of Poly Network's cross-chain contracts on Ethereum, Binance Smart Chain and Polygon. Funds began coming back the next day, and on 23 August Poly Network said the user assets had been recovered, apart from about $33 million in USDT that Tether had frozen, ",[15,16,20],"a",{"href":17,"rel":18},"https:\u002F\u002Fwww.cnbc.com\u002F2021\u002F08\u002F23\u002Fpoly-network-hacker-returns-remaining-cryptocurrency.html",[19],"nofollow","according to CNBC",".",[11,23,24],{},"In May we ran a much smaller bridge to move Trivechain holders from our legacy chain to BSC. Reading the analyses of Poly Network, I kept asking the same question of both systems. When a bridge releases tokens on one chain, whose word is it acting on?",[26,27,29],"h2",{"id":28},"what-poly-networks-contracts-trusted","What Poly Network's contracts trusted",[11,31,32,33,38],{},"The early technical write-ups, such as ",[15,34,37],{"href":35,"rel":36},"https:\u002F\u002Fmudit.blog\u002Fpoly-network-largest-crypto-hack\u002F",[19],"Mudit Gupta's on 11 August",", describe the same shape.",[11,40,41],{},"Poly Network's contracts on each destination chain released tokens when they received a cross-chain message signed by a set of keepers. The keepers' public keys were stored in a data contract. The owner of that data contract was the manager contract that processed cross-chain messages, and the manager could be made to call a function on another contract, with the function's name taken from the message.",[11,43,44],{},"Solidity identifies a function by the first four bytes of a hash of its signature. Four bytes is small enough to search. The attacker found a function name that produced the same four bytes as the function that replaces the keepers' keys, and sent a message aimed at the data contract. The manager made the call, and because the manager was the owner, the data contract accepted it. The keepers were replaced with a key the attacker held. From then on, the attacker's signatures were the ones the contracts trusted.",[11,46,47],{},"The analysts were clear that no keeper's private key had leaked. Nothing had to be stolen. The weak point was the path that could change who the keepers were.",[26,49,51],{"id":50},"what-our-bridge-trusted","What our bridge trusted",[11,53,54],{},"Ours did not try to remove trust. It tried to make it visible.",[11,56,57],{},"As I described in the May posts, a holder sent their TRVC on the legacy chain to the bridge's address, with the destination BSC address written into the transaction's open data and marked T3IN. To show they controlled that BSC address, they sent a small BNB fee from it to the bridge's BSC address. After 100 confirmations on each chain, the bridge sent the same amount of BEP20 TRVC from its BSC address. It then burned the received coins on the legacy chain with a T3OUT transaction carrying the BSC transaction ID. Holders who preferred not to do the steps themselves could migrate through Swapz.Finance instead.",[11,59,60,61,66],{},"On BSC, the ",[15,62,65],{"href":63,"rel":64},"https:\u002F\u002Fgithub.com\u002Ftrivechain\u002Ftrivechain-bsc-contract",[19],"TRVC token contract"," gives its owner a mint function capped at a maximum supply of 80 million, and its README links a single initial minting of 45 million for the migration.",[11,68,69],{},"So the honest answer to \"whose word?\" was: ours. Holders trusted that whoever held the bridge's keys would send BEP20 TRVC for every T3IN, would not send it without one, and that the token contract's owner would not mint past what had been published.",[26,71,73],{"id":72},"visible-is-not-the-same-as-safe","Visible is not the same as safe",[11,75,76],{},"What we could offer was a trail. Every T3IN names its destination. Every T3OUT points to the BSC transaction it paid for. The migration supply was minted once, in a transaction anyone can open, and the cap can be read from the contract. Anyone can pair the two sides and check that the totals agree.",[11,78,79],{},"That makes misbehaviour detectable after the fact. It does not prevent it. A stolen bridge key would leave a clear record, and the record would stop none of it.",[11,81,82],{},"Poly Network was built the other way round: contracts that check signatures, instead of a team that sends tokens. That moves trust from people into permissions. It is an improvement only if the permissions are at least as narrow as the people would have been, and a contract that can rewrite its own signers holds the widest permission there is.",[26,84,86],{"id":85},"questions-i-now-ask-of-any-bridge","Questions I now ask of any bridge",[88,89,90,98,104,110,116],"ol",{},[91,92,93,97],"li",{},[94,95,96],"strong",{},"Who can change the set of signers, and through what path?"," The administrator of the administrator is the real key.",[91,99,100,103],{},[94,101,102],{},"Can any contract be made to call a function chosen by message data?"," If so, list every contract that trusts it as owner.",[91,105,106,109],{},[94,107,108],{},"What is the most that one key, or one compromised contract, can release?"," A cap does not prevent theft, but it bounds it.",[91,111,112,115],{},[94,113,114],{},"Can an outsider pair every release with its deposit from public data alone?"," If not, holders are trusting a report rather than a record.",[91,117,118,121],{},[94,119,120],{},"Who can pause it, and who can unpause it?"," Those are signers too, whether or not the documentation calls them that.",[11,123,124],{},"Our bridge answered the first question with \"us\", which was plain and narrow. Poly Network's answer, this month, was \"whoever can craft the right message\".",[11,126,127],{},"A bridge is a promise between two ledgers that neither ledger can check by itself. Something has to stand in the middle. The design question is how much that something can do, and whether everyone can see what it did.",{"title":129,"searchDepth":130,"depth":130,"links":131},"",2,[132,133,134,135],{"id":28,"depth":130,"text":29},{"id":50,"depth":130,"text":51},{"id":72,"depth":130,"text":73},{"id":85,"depth":130,"text":86},"Architecture",null,"\u002Fimg\u002Fblog-covers\u002F2021-08-15-what-a-bridge-actually-trusts.webp","A bridge between two glass platforms with its blue gate open while a key still hangs untouched beside it.","2021-08-15","Poly Network's keepers were replaced through a contract permission, not a stolen key. Set beside the openly custodial migration bridge we ran for Trivechain in May.","md",false,{},true,"\u002Fblog\u002F2021-08-15-what-a-bridge-actually-trusts",{"title":5,"description":141},"blog\u002F2021-08-15-what-a-bridge-actually-trusts","2021","2026-11-07","xxsoXim9gRo-19WDNuCo4ZPF_HZDEf7o71feuGI3Xk8",1794838285796]