11 ms·
Many people are asking what happened, because the article does not go much into detail. The code is there (linked in the article): https://bscscan.com/address/
by hiq 5y ago
Many people are asking what happened, because the article does not go much into detail.
The code is there (linked in the article): https://bscscan.com/address/0x7a8ac384d3a9086afcc13eb58e90916f17affc89#code https://bscscan.com/address/0x7a8ac384d3a9086afcc13eb58e9091...
After spending 2min on it and using this hint from the article:
> The affected pool contract had an initialize() function that should have been activated after deployment.
> The line: initialized = true; is missing from the function.
That's really the crux of the issue. Have a look at the `initialize()` function. It's meant to be called only once (that's why it uses the modifier `notInitialized`), right after the smart contract is deployed, and never again. But the `initialized` variable is never set to true, meaning that it can be called again, and it seems that's what the attacker did.
...so for those who expected something fancy and technically advanced, that's not for you.
- andrewfromx 5y agoso where does one draw the line between theft and just doing what the code allows? I wonder in the future crypto courts is the defense, "your honor, the code allowed me to call initialize again, they specifically didn't set it to true." going to fly? Or will you have to prove that the 10 mil you now have was intended to be given to you and your "victim" isn't a victim at all.
- paulpauper 5y agoif it went to court, i am guessing presuambly under a plea deal the hacker would be required give back all or most of the crpyto to rectify the 'mistake;' if not, it would prove intent to steal . For example, there is the 2005 Sammy MySpace XSS incident. Technically, his code was interpreted by Myspace as valid CSS/html, but was still guilty due to intent.
- deleted 5y ago[deleted]
- cosmodisk 5y agoIt may depend on a legal system in a country but I think 'Or will you have to prove that the 10 mil you now have was intended to be given to you and your "victim" isn't a victim at all' is more likely. For instance there were cases,where ATMs dispensed stupid amounts of money because of some error. People would normally be found guilty if they take the money that technically isn't theirs.
- meowkit 5y agoIn the future I think smart contracts will be standardized - these kinds of things won’t happen unless you’re trying something new. If that’s the case there will probably be services/testnets to properly vet it before launching on a mainnet.
- IncRnd 5y ago> these kinds of things won’t happen unless you’re trying something new. Unfortunately, that's probably not going to be what occurs. Even today, there are constantly bugs discovered and fixed, some critical, that have been latent in systems for decades - as in since the last century. The recent FragAttacks against WiFi systems come to mind.
- benplumley 5y agoA bug-free version of ProfitSharingRewardPool is much more plausible than a bug-free version of WiFi, or SSL, because the former is less than 1000 lines of code and apparently had an unintended $10M bug bounty.
- IncRnd 5y agoWe were dicussing errors in smart contracts not just errors specific to ProfitSharingRewardPool. Your comment is correct about ProfitSharingRewardPool but is incorrect about smart contracts. That goes to show that errors happen all the time.
- sidlls 5y agoThe legal system isn't a computer that implements the law strictly to the letter based on only factual information. There are "reasonable person" standards, allowance/tolerance for mistakes, etc. Relevant to this discussion is rules covering mistaken deposits to a bank account: recipients are obliged to return the assets, not shrug their shoulders and use the cash while they proclaim "Bank's fault; they're responsible!"
- logicalmonster 5y agoNobody can predict the future of how business will get done years down the road, but I think Smart Contracts can potentially utilize both Oracles (systems like Chainlink) to provide objective data about the world for triggering Smart Contract logic, and Arbitration systems (something along the lines of Kleros) for humans to make subjective judgements about human concepts like "reasonableness" in contracts. A very contrived example. Say a Smart Contract exists for a contractor to paint a boat cornflower blue and then get paid when the job is done, but the Oracle system says that the contractor messed up and painted it sky blue. It can be part of the Smart Contract in the event of some error that it can go to arbitration to some pre-agreed-to subject matter experts that both sides agreed to beforehand for a quick and reasonable resolution or fee. This kind of thing can be planned for and made standard in smart contracts. It'll only happen if it saves businesses more time and money than it costs though, and many other question marks will be involved. I think it's very exciting conceptually though.
- withinboredom 5y agoBut if a bug allows you to delete the contract. It’s useless. In the real world, a contract exists unless all parties agrees it doesn’t. A “loophole” won’t cause money to be removed from escrow unilaterally.
- drdrey 5y agoActually didn’t a judge just rule Citibank wasn’t entitled to get its money back after a mistake like that? https://www.forbes.com/sites/jonathanponciano/2021/02/16/citi-cant-get-back-500-million-it-accidentally-wired-to-revlon-lenders-federal-judge-rules/?sh=5de94aed185d https://www.forbes.com/sites/jonathanponciano/2021/02/16/cit...
- jlarocco 5y agoI don't follow any of this too closely, but I thought the whole idea was to get rid of courts by using precisely codified contracts? What's the advantage if the result is the same system as before (lawsuits, courts, etc.) with added complexity of "smart contracts"?
- xyzzy_plugh 5y agoHow do you get rid of courts? Do you imagine an alternate reality where existing regulations do not and can not apply? Because I'd recommend continuing to imagine.
- jypepin 5y agoI think smart contracts are meant to automate the work behind contracts/agreements, but if someone hacks you, well, they did something illegal and you can sue?
- mondoveneziano 5y agoI think the question is: Why then deal with all those inefficiencies and cost of distributed computation, mining, and broadcast transactions, if you need courts to override decisions anyway, and insurance to cover yourself when something goes wrong? You can already "automate" without smart contracts.
- aaronharnly 5y agoI share the general skepticism, but I am open to the idea that (much like other electronic commerce), the smart contracts might make 99% of transactions much more efficient; so the expensive manual interventions are only used on a small proportion. Of course, it is not necessarily obvious that blockchain-powered smart contracts are the only way — or the best way — to achieve that automation and efficiency!
- deleted 5y ago[deleted]
- philangist 5y agoAll exploits are technically some version of “just doing what the code allows”, I don’t see how that would change whether or not a hack/theft actually occurred.
- 2OEH8eoCRo0 5y agoReminds me of a Team Fortress 2 griefing video where they kept putting turrets underneath the map that couldn't be killed but could shoot players. "If they didn't want you to do that then why did they put it in the game?"
- dragonwriter 5y agoOne view of smart contracts is that the code defines the intent/agreement, so if the code allows it, the it is, ipso facto, not theft. Of course,
- nkrisc 5y agoSeems like these smart contacts should include written contracts as well to outline what the code is intended to do, if you can’t rely on the code.
- crooked-v 5y agoAt that point, why have the smart contract? If you want 'automation', just get a trustworthy third party to execute the financials for you , as is already done with (for example) most real estate contracts.
- solveit 5y ago> trustworthy third party Merits aside, sidestepping the need for this is the whole point of blockchain.
- withinboredom 5y agoApparently you can’t even trust the um, paper, it’s written on
- fpig 5y agoI think that's the wrong question. If a court can decide (and enforce) what a smart contract "really means", then smart contracts don't really bring much to the table. It doesn't matter what the court would actually decide. The main thing smart contracts bring to the table is a mechanism of enforcing contracts without government involvement or control. The contract gets enforced, period. The parties can be anonymous, it doesn't matter which country they're from, and so on.
- klodolph 5y agoIf a court can decide/enforce what a smart contract "really means", then the smart contract still decides who has possession of the related assets before the courts get involved. That's for ill or for good. Anyone who wants to get the courts involved has to care enough about changing the status quo to pay for a lawsuit. Changing what the status quo is, before the lawsuit, changes the balance of power.
- solveit 5y agoAutomation is valuable in itself. Imagine a system of thousands of smart contracts interacting with each other millions of times a second. No court system is (currently) equipped to deal with that except in the most superficial way.
- bseidensticker 5y agoProponents of Ethereum will say that smart contracts obviate the need for courts. I don't think this sort of Ethereum bug/hack thing has ever shown up in the court system yet. I'm sure someone will bring a case if they know who did it. If gaining access to someone's system using default credentials or no credentials is a violation of the CFAA then I'm sure this is as well.
- timoth3y 5y ago> so where does one draw the line between theft and just doing what the code allows? This is the heart of the problem with smart contracts. The theory is that the code is the law. There is no theft. There is no need to trust, authority, or arbitration. Of course, this only works when the smart contracts perfectly meet a correctly defined spec and have no bugs.
- mondoveneziano 5y agoThat's not enough, all parties would have to have 100% awareness and understanding of the smart contract, detail by detail. Real life contracts sometimes turn out to have non-enforceable clauses within our legal framework, or may be entirely invalid if, for example, signed under pressure or false pretense.
- adflux 5y agoAnd a judge will decide whether the contract was signed under duress. Who will judge smart contracts?
- ryanmentor 5y agoKleros Digital Courts, if their story holds through.
- rtpg 5y agoA judge! A judge can just claim jursidiction! Imagine if Goldman Sachs did this. A judge can say "look, you can follow our rules or we start seizing assets etc". And when you're sitting around trying to be anonymous, well... you're doing everything on a public ledger, so now you're extremely restricted. Hell, courts/legislative bodies could even go down the "force all miners within their jurisdiction to rollback an unwanted transaction". You think miners care enough to make a stand on this kind of stuff? Unless you're going to like.... download your consciousness onto the blockchain you are still just as liable to being told by a court what to do as anything else.
- 5y ago
- Scarblac 5y agoFuture crypto courts? This whole crypto circus exists to solve the problem of having no central authority. If you can use courts, you have no reason to use "smart" contracts.
- anoncake 5y agoThe "point" of smart contracts is that the code is the contract. The "victim" voluntarily gave that money away.
- crooked-v 5y agoThat only holds right up until a judge disagrees and orders the transfer reversed.
- TeMPOraL 5y ago> The "victim" voluntarily gave that money away. This explanation, much like its sibling "voluntary transaction" defense of market failures and economic coercion, sounds to me like a bully who hits their victim with their own arm, and then exclaims, "stop punching yourself!".
- anoncake 5y agoIf the person who lost the money had to use smart contracts, you've got a point. If they used them because they thought they were a good idea, I hope they learned their lesson.
- TeMPOraL 5y agoAgreed, but the crypto crowd wants smart contracts to be ultimately used by everyone, which means (in their hypothetical world, which I hope never materializes) many if not most uses will be of the "had to use" kind.
- davidwritesbugs 5y agoex-lawyer here. Where big money is at stake most sensible judges will, or will /try/ to, look behind absolutist language in a contract (be it smart or not). Courts are very good at looking at contracts and asking what the parties intent was. They will ask things like "was it intended not to initialize this function?" They may then answer the question with, "No of course not, it was a bug. The person exploiting that bug knew that and cannot reap the benefit". Maybe, or maybe not: trying to guess what a judge will say is a mugs game, but my point is that saying it's a smart contract not operated humans renders it "Absolute Code-as-law" one can't interfere with is unlikely to fly.
- intricatedetail 5y agoWhy contracts don't have a test suite that verifies them?
- o-__-o 5y agoThey do, if you don’t have 100% code coverage then you get what you get
- NateEag 5y ago100% code coverage isn't even close to a guarantee of correctness.
- o-__-o 5y agoBut is the easiest metric to guage test quality. What I’m saying is this code is probably not well tested
- dr_zoidberg 5y agoThis code isn't tested at all. They messed up copying code from a previous implementation, that's how bad this is. If they had had a few basic tests in place they would've spotted this before it even had a chance to be a problem.
- o-__-o 5y agoThen the problem has zero to do with the type of testing, now does it :)
- masklinn 5y agoBecause the entire field is nonsense and pyramid schemes. Ethereum derives their smart contract langage from JavaScript for fuck’s sake. That alone should tell you that their interest was always to disregard everything in order to maximise adoption. And then they added pitfalls to JavaScript because it was not broken enough for their tastes.
- drdrey 5y agoCan the deployment and the initialization happen in the same transaction? Or would it be in principle possible for a 3rd party to swoop in and initialize it ?
- stjohnswarts 5y agoSo I wonder if someone watches the block chains for these kinds of bugs then swoop in when it happens.
- bouncycastle 5y agoReminds me of the 2nd "Parity wallet hack", where they forgotten to initialize the contract, despite extensive audits after a previews hack. That one lost around $154 million USD at the time. The hacker didn't get anything though, the funds became permanently trapped. Imagine having a bad day at work? https://hackernoon.com/parity-wallet-hack-2-electric-boogaloo-e493f2365303 https://hackernoon.com/parity-wallet-hack-2-electric-boogalo...
- lordnacho 5y agoIIRC the DAO "hack" was also caused by an init that could be called twice. Kinda interesting how this could happen again. I haven't looked at the smart contract as I'm on a phone but it's imagine you'd at the very least put a comment explaining what the purpose of stopping the reinit was.