News for hackers. Stuff that matters.
Re:The math prodigy whose hack upended DeFi won’t return funds by er4hn on Monday May 23, 2022 @04:20PM (#31484341)
Let's say that I place a vending machine in a public space, such as a street or a park. The public is able to interact with it by inserting FIAT coins to purchase DRNK. Someone clever figures out a way to interact with the vending machine to extract DRNK at less than it's intended FIAT price. Two questions at this point:

(a) Is this a theft from the person who placed the vending machine? Why or why not?

(b) How is this different from a smart contract on a blockchain?

Re:The math prodigy whose hack upended DeFi won’t return funds by cogman10 on Monday May 23, 2022 @04:49PM (#31484613)
That sort of depends on what the exploit is, right?

For example, if DRNK costs $1 per unit, but I find out that by putting in $1.25 I get 2 units, have I actually exploited the machine? Is it not reasonable to assume that discount was intended?

Now, of course, if I'm prying open the machine with a prybar then we could argue that's just theft. But, putting money in the machine and getting units out is the intended interaction.

Similar to how if a gas station accidentally puts the price of gas at $0.20 per gallon, even though everyone knows that's probably a mistake, it isn't on them for taking advantage of the artificially low price.

So, that's what I'd say the difference is. A smart contract defines all the interactions that are valid. Thus, it is impossible to interact with a smart contract in a way that is "invalid" or "stealing". That'd be different if the user could modify the contract (apply a prybar) however, that's sort of the point, that you can't modify the contract to fix it.

If the contract said "all your deposited crypto goes to cogman10" would we call that a theft when someone put their crypto into that contract? Perhaps if I misrepresented the contract, but then the whole point of these contracts is they are visible to anyone that wants to read/use them.

Re:The math prodigy whose hack upended DeFi won’t return funds by IanCal on Monday May 23, 2022 @06:22PM (#31485569)
> For example, if DRNK costs $1 per unit, but I find out that by putting in $1.25 I get 2 units, have I actually exploited the machine? Is it not reasonable to assume that discount was intended?

What if you remove the last part? What if you know, clearly, that your interaction what not what the designer wanted?

> So, that's what I'd say the difference is. A smart contract defines all the interactions that are valid.

Implementations are not specifications. What do you mean by "valid"?

Re:The math prodigy whose hack upended DeFi won’t return funds by cogman10 on Monday May 23, 2022 @07:08PM (#31485964)
> What if you know, clearly, that your interaction what not what the designer wanted?

Well, then they should have designed a better vending machine, shouldn't they? It may be unethical but I certainly wouldn't call it illegal. Again, back to the gas analogy, I don't think someone pumping gas at $0.20 is breaking the law even though that's clearly not the intent.

> What do you mean by "valid"?

None of the interactions for this attack were using the system in a way it wasn't meant to be used. It wasn't exploiting code. It was buying and selling assets in a way that enriched the attacker. That is a valid interaction.

Also, the whole point of these contracts IS that the code is the specification. That's the whole point of crypto in general. Trust nobody and let the blockchain determine truth.

Re:The math prodigy whose hack upended DeFi won’t return funds by UncleEntity on Monday May 23, 2022 @08:46PM (#31486710)
> What if you know, clearly, that your interaction what not what the designer wanted?

This is what I like to refer to as “stupid tax”.

I’ve had cases where I put money into a soda machine and it gave me a drink plus more than I deposited into it. Or kicked out more than one item because one was stuck and my purchase obviously unstuck it.

Does this make me a criminal?

As an aside I used to work at a place with a soda machine that was basically like a slot machine with slightly higher payouts than one in Los Vegas. This was at a grocery warehouse and the drinks were at cost so “losing” your bet cost like a quarter. Probably designed that way, who knows?

Re:The math prodigy whose hack upended DeFi won’t return funds by jdmichal on Monday May 23, 2022 @06:23PM (#31485580)
And what if the vending machine measures coins by weight, and you so happen to have a "coin" that is just a properly-weighted blank. You're still interacting with the vending machine as technically intended. But by not inserting the correct amount of money, you are not interacting with it as intended by the creators.

The smart contract implements a technical intent, just like the vending machine. But that technical intent will always have limitations. Some exploits are non-destructive, such as properly-weighted blanks. Some are destructive, such as crowbars. But let's not pretend that they aren't, in fact, exploits.

Re:The math prodigy whose hack upended DeFi won’t return funds by cogman10 on Monday May 23, 2022 @07:03PM (#31485929)
That'd make sense IF this attack was one that was along the lines of "Hey, I did an injection attack on the contract which caused it to do something bad".

However, that's not what happened in this attack. This attack was far more akin to the "getting 2 units for $1.25" that I described. In fact, that's exactly what it was at the root of it. At no point did the attacker actually exploit code.

The technical and explicit intent was followed to a T here. The attacker got a loan (perfectly within the intent) bought a bunch of the index (again, within the intent) sold a bunch of a underlying stock of the index (Again, within intent), sold the index, and sold the loan. Nowhere in this process was there a "this violates the essence of the contract".

And, let's be frank here, it's not like the attacker didn't open themselves to a huge liability. Anyone that saw this attack in progress could have bought sushi coin or UCI and ultimately drained away the income this attacker was earning, potentially putting them on the hook for a pretty massive loan.

Now, would such a scheme be legal if this were actual securities and not crypto? Nope, because we put more protection around real securities in the US and other countries. However, crypto went out of it's way to make itself above the law and outside of securitifaction. That, in fact, was the entire point of crytpo, to be something governments COULDN'T regulate.

Re:The math prodigy whose hack upended DeFi won’t return funds by jdmichal on Tuesday May 24, 2022 @10:35AM (#31492672)
The article makes it very clear where things were exploited. Especially the circumnavigation of the new token limit seems pretty relevant to the discussion of whether this was playing within the intent.

If he’d wanted, Medjedovic could now have traded $3,200 worth of Sushi for DEFI5 tokens worth $1,172,000. And had he simply done that, Indexed would have been fine. The protocol places limits on the amount of a new token that users can swap into the pool, so he would have been able to extract only about 1.5% of the pool’s value—which, given transaction fees, wouldn’t have been profitable for him.

Instead, Medjedovic’s script took out another flash loan consisting of $2.4 million worth of Sushi tokens. And rather than swapping them into the pool, it gifted them to it—a seemingly irrational move that Indexed’s algorithm wasn’t designed to handle. The “donation” overwhelmed the pool and circumvented its usual trade limit for new tokens. This allowed Medjedovic’s program to freely trade overvalued Sushi for undervalued DEFI5 tokens, then cash those out for the pool’s underlying assets, pay back the loans, and keep the rest, now worth $11.9 million. The attack on the CC10 pool brought the total haul to $16 million.

Re:The math prodigy whose hack upended DeFi won’t return funds by hnfong on Tuesday May 24, 2022 @10:35PM (#31499993)
> A smart contract defines all the interactions that are valid.

A smart contract defines all the interactions. Whether they are legally valid is another matter. In contract law, usually the intentions of the parties (at the moment of agreeing to the contract) are taken into consideration. In most other cases, the legal system has rules to determine the validity. The customary practices of the crypto ecosystem is something they might take into account, but it's not necessarily a final outcome.

Re:The math prodigy whose hack upended DeFi won’t return funds by stickfigure on Monday May 23, 2022 @04:58PM (#31484690)
I'll try to steelman the code-is-law argument (not really sure how I feel about it myself):

In the case of the smart contract, you don't own the vending machine. It doesn't have an owner, it just "is". If it did have an owner, that person is probably violating all sorts of securities laws in countless jurisdictions. That's at least part of the point of all this smart contract stuff.

To make the analogy a little more apt, let's say the smart autonomous vending machine 1) lets people buy DRNKs by inserting money, 2) incentivizes people to refill it with DRNK by spitting out money, 3) once a month spits out money to the amused landlord, and 4) was deposited by aliens who disappeared without trace.

Presumably the smart vending machine would continue on its merry way like this until it either broke down or someone figured out a way to jimmy the lock. Looks like the later happened. Though everyone is upset, it's not clear who has the right to prosecute.

Re:The math prodigy whose hack upended DeFi won’t return funds by glerk on Monday May 23, 2022 @05:30PM (#31485002)
> If did have an owner, that person is probably violating all sorts of securities laws in countless jurisdictions.

That's probably what upsets me most about this story. These developers want to have it both ways: it is decentralized finance and nobody owns the contract as long as we are making money, but we want all the laws and regulations of traditional finance to protect us if things don't go our way.

I am saying this as someone who is pro-crypto. There are trade-offs to this technology. We need to pick a lane be prepared to deal with the consequences.

Re:The math prodigy whose hack upended DeFi won’t return funds by nicoburns on Monday May 23, 2022 @06:45PM (#31485789)
Frankly, I don't think it's up to you to pick a lane. It's the wild-west at the moment because the technology is new. But it won't be long before the law catches up and crypto will be subject to it the same as everything else.
Re:The math prodigy whose hack upended DeFi won’t return funds by glerk on Monday May 23, 2022 @07:10PM (#31485995)
Publishing a piece of code on a public blockchain cannot be made illegal. The Court of Appeal already ruled that code is speech making this a first amendment issue [1].

Decentralized finance is here to stay as an alternative to the traditional system. Some things are just impossible to regulate.

[1] https://www.trustnodes.com/2018/11/09/smart-contract-code-is...

Re:The math prodigy whose hack upended DeFi won’t return funds by nicoburns on Tuesday May 24, 2022 @04:52AM (#31489622)
Perhaps not in the US (but many countries have no such constitution), but redeeming said tokens for fiat currency could still be made illegal, which would dramatically reduce the usefulness of such a a system.
Re:The math prodigy whose hack upended DeFi won’t return funds by QuantumGood on Monday May 23, 2022 @08:17PM (#31486498)
The "laws and regulations of traditional finance" also protect them if things "go their way". They're not trying to "have it both ways", the law protects everyone in all scenarios.
Re:The math prodigy whose hack upended DeFi won’t return funds by glerk on Tuesday May 24, 2022 @06:23PM (#31498236)
In practice, the law would protect them if they were the owners of the exchange. But here the "exchange" is just a public piece of code that all participants agree to interact with. I can't even begin to imagine the legal hoops they would have to go through to run a centralized regulated exchange.
Re:The math prodigy whose hack upended DeFi won’t return funds by s1artibartfast on Monday May 23, 2022 @05:33PM (#31485030)
Imagine in your example the vending machine has a variable pricing and lowers its price if nobody purchases soda. Is it theft to wait longer than the designers thought people would wait and purchase the DRNK at price lower than the machine owner thought they would.

I think a better example is a claw gambling machine. You pay Fiat for a chance to grab fiat out of a pool.

If you come up with a strategy whereby you can grab more or all of the Fiat in a way that the game/machine designer and other players did not anticipate, is that theft?

Alternatively, people are playing a modified version of Poker with rules they don't understand, and someone understands the rules better and gets their money, is that a crime?

Re:The math prodigy whose hack upended DeFi won’t return funds by jdmichal on Monday May 23, 2022 @06:28PM (#31485629)
Broken slot machines do happen, and it's been made very clear that the player does not benefit.

https://www.aol.com/2016-11-02-broken-slot-machine-dupes-wom...

https://www.foxnews.com/us/not-a-winner-oregon-woman-denied-...

However, this works both ways. If the mistake is in the favor of the player, they are obligated to pay out:

https://www.msn.com/en-us/news/us/a-slot-machine-in-las-vega...

Re:The math prodigy whose hack upended DeFi won’t return funds by FireBeyond on Monday May 23, 2022 @07:07PM (#31485955)
Right, "it's been made very clear".

"Malfunction voids all wins."

Here, it's also been made very clear. "Code is law".

Re:The math prodigy whose hack upended DeFi won’t return funds by DangitBobby on Monday May 23, 2022 @08:04PM (#31486396)
Well, no. Law is law. Code is law is a game of make-believe.
Re:The math prodigy whose hack upended DeFi won’t return funds by s1artibartfast on Monday May 23, 2022 @06:39PM (#31485730)
I would argue that the fund wasn't broken-it was working exactly as designed. It was just a bad design