Hacker News new | past | comments | ask | show | jobs | submit | midas007's comments login

Outbound leads (investment, jobs, customers) are way, way harder than inbound. Even for YC alums, inbound is your friend.

[0] http://techcrunch.com/2014/02/15/was-y-combinator-worth-it/


TL;DR For random-seek block encryption, don't use XTS, use CTR.

It's simple. I like simple maths and code, it's less to screw up and less for implementations to screw up. For example, I don't trust EC or GCM, even if some people thinks they're the new hotness, because complexity creates more opportunities for obfuscation and puts the code further out of reach of the already few eyeballs actually (or not) looking at it.

Maybe 'cpervica explain why


What? No. Don't do that.


This is why you should never tell people what not to do, without also telling them what they should be doing ;)


? What's wrong with CTR? CTR is basically an OTP. Being OTP, encryption and decryption are basically the same construction (thank you XOR).

    cipherblockdata = blockcipher(key, nonce . block #) ^ plainblockdata
    plainblockdata = blockcipher(key, nonce . block #) ^ cipherblockdata
If MAC is needed, that can happen after encrypting, before decrypting. (Needed if bytes traverse network, but maybe not for local disk or file encryption unless.)

Edit fixed my maths:


It's explained pretty well in the article. Basically with CTR using the block # as the nonce you break the security assumptions of a nonce (use only once). If the cryptofunc is static, and you are editing a document in place, an attacker can see exactly which bytes changed and do other statistical attacks.

Think about a file that you preallocate with NULLs. If you get an image of the disk before you write to the file and then an image once you write to the file, you can simply XOR the before and after to get the ciphertext.

e.g.

  using block 100
  cipherblock_before = cryptofunc(100) ^ 0x00 = cryptofunc(100)
  cipherblock_after = cryptofunc(100) ^ data
  cipherblock_after ^ cipherblock_before = data


Yes, it's a known weakness. You have to rekey every X blocks.


No, rekeying does not solve that problem, not to mention which you've just handwaved a hard problem (varying the key over different sectors). That's doable (though it again doesn't fix the problem with your proposal), but the resulting mode isn't CTR.


Yes it does, and it's still CTR.

Further, every solution is going to have other machinery solving specific concerns.

You don't call XTS something else because you've used scrypt or PBKDF2 as the PBKDF.

Work is work.


This is a sequence of non-sequiturs, none of which respond to my comment. I'll make it easier for you:

Propose a scheme whereby you use AES-CTR to encrypt a 100 megabyte disk of 512-byte sectors, whereby the scheme "rekeys" every "few sectors". Be specific.


Don't need your "help," don't care.

"It's unreasonable to debate with an unreasonable person."

Bye.


CTR is not a one-time pad. Read the article: it discusses using CTR for disk encryption.


Pretty hilariously wrong, and you know it.

Supposed OTP constructions are defined as

e(i) == E(...) ^ m(i)

m(i) == D(...) ^ e(i)

where E(...) = D(...)

and where ... doesnt contain any of the following

e(j) for any j

m(k) for any k

j and k in same domain as i

Then, take a look at CTR...

CTR is E(i) = blockcipher(key, nonce . i) and D(i) = E(i)

e(i) == blockcipher(key, nonce . i) ^ m(i)

m(i) == blockcipher(key, nonce . i) ^ e(i)

(i == counter, since it's the same in this example where counter and blocks start at the same number)

Therefore CTR is an OTP.


CTR isn't an OTP in the classic sense of OTP, because you rely on the security of blockcipher. For example, if you used blockcipher=single DES, the attacker can break the cipher by breaking single DES by brute force.

Indeed, even if blockcipher=AES256, the attacker can still break CTR by merely guessing key in 2²⁵⁶ operations. (Likely only one such value of key will yield meaningful plaintext throughout the entire multi-block message.) That is contrary to the information-theoretic security property of OTP, where the attacker can't tell whether they've correctly guessed the key.

More to tptacek's point, if you're using the block offset as i, then if you write the same block 30 times, you used the same value blockcipher(key, nonce . i) each time. That isn't a one-time use of that part of the pad, it's a 30-time use of that part of the pad. It's extremely possible that an attacker who has observed all 30 ciphertexts can actually decrypt many of them in combination. In Boneh's Coursera class, we did it successfully with like 4 or 5 ciphertexts, and I've seen a paper that describes doing it automatically for the majority of the text with only two ciphertexts, assuming the plaintext is English written in ASCII.


That's trivial to add on, outside of CTR.

You have a system of keys derived from a master key. Too many bytes encrypted with one key? Use a new key for subsequent writes.

(And for god's sake use a PBKDF to derive a master key from a password, don't memcpy() it directly.)


Can I suggest you reread the article? I felt bad that I spent so much time on the mechanics of tweakable ciphers because people didn't really need to understand them to see why not to use XTS, but here you've vindicated all those paragraphs by stating the exact problem they solve, and did it be presenting an unsafe alternative to them.


Unsafe for what, how? You're making all sorts of claims and now an accusation without backing them up with a shred of evidence.

XTS is only useful for FDE, everything else should look for simpler constructions.

Maybe you need to read:

http://cactus.eas.asu.edu/partha/Teaching/539-CommonFiles/Cr...

Would really appreciated if you would know you're talking about and provide evidence before saying "it's wrong" or "it's bad advice."


Did you just propose a disk encryption scheme whereby PBKDF2 is called on a sector by sector basis?

Later: FWIW, it looks like the parent comment was edited after I wrote this.


Absolutely not, that would NOT SCALE.

Again, you're making accusations, shifting the conversation without providing evidence. Talking with you is pointless.


So when I "derive a new key" for a sector when it gets "rewritten", that key comes from...


Presumably the sector key is derived from the master key using one of the numerous fast KDFs, with PBKDF used only to derive the master key from the password. That's the obvious way to do it and midas007 explicitly mentions PBKDF as a way to generate a master key from a password with sector keys derived from that master key using some unspecified technique. You appear to have come up with your own obviously daft way of implementing the suggestion and then criticized that rather than the original proposal. Please don't do that.


Did you just propose running a KDF for every sector of the disk? Which of these numerous "fast KDFs" that derive related keys from master keys are you referring to?


Dunno, probably a generic HMAC-based one if for some weird reason I felt the urge to implement a crypto system that worked this way. Could probably use KDF1 or another KDF in that family too. (Honestly, there's probably no good reason to do things this way, it's just not obviously broken or infeasable.)


First, running an HMAC for every sector would be extremely slow.

Second, KDF1 would be even slower.

Third, you still haven't explained how KDF1 or HMAC takes you from the master key, derived from the user's password, to several million per-sector keys. What's the relationship between the keys?

Fourth, deriving keys from other keys is potentially dangerous; it's something you avoid doing if you can.

Fifth, as the article mentions, one of the reasons nothing in the universe does this is that running the key schedule millions of times is itself pointlessly time-consuming.

Sixth, you're running CTR mode deterministically. As the article points out, you can't do that: every time you alter a sector, you'll be encrypting data under the same keystream. Higher-level code gets to use CTR because it can arrange to randomize it, but in sector-level crypto you don't get to store a nonce.

What's frustrating to me here is that you basically just made a bunch of stuff up, and then feigned offense that I wouldn't have taken this nonsensical scheme seriously. But that's what it is: nonsensical. Nobody generates individual keys per sector. The article covers this: you'd like to do that, but it's too difficult.

Hence tweakable ciphers.

Lodge objections with Liskov, Rivest, Wagner, and Rogaway, not me.


> every time you alter a sector, you'll be encrypting data under the same keystream

I'm not sure that everybody has developed the intuition that this is horrifically dangerous. Maybe point them to something like

http://www.cs.jhu.edu/~jason/papers/mason+al.ccs06.pdf


That looks like the definition of a symmetric stream cipher, not OTP. You're missing the part where the OTP keystream has to be truly random. The output of a block cipher in CTR mode is not truly random.


Indistinguishable from a PRF A good block cipher satisfied this property, otherwise it's not a PRF and insecure.

Hair-splitting, really. Actual OTP is an imaginary construction that requires an endless supply of truly random bits that have to be securely stored or somehow recreated during decryption. It shifts the hard part to that fn, and just XORs the result with the pt or ct block.


No. What you've done here is redefined "OTP" to mean "any stream cipher". No.


That's the whole point of OTP as an imaginary construction!

It's a way to take any block cipher and turn it into a stream cipher with the power of XOR.

(I'm only going to ask this nicely once: cease and desist stalking and harassment.)


No, you have your terminology thoroughly confused. An OTP is an information-theoretically secure cipher where the key is as long as the plaintext. The only relationship between a one-time pad and CTR is the XOR operation. Furthermore, the article you're responding to explains what's wrong with simple stream ciphers for disk sector encryption.


No.


Uh, yeah, except not a cryptographic hash function, first of all :-)

Secondly, CTR has serious issues too. It is trivial to bit-fiddle. The naive implementation you're suggesting leaks the keystream in one CCA query.

Just because CTR in and of itself is easy to get right doesn't mean that any system composed using CTR is easy to get right.


The trivial malleability of CTR is apparently why NIST rejected it, but it's important to remember that most unauthenticated block cipher modes are malleable, including XTS.


Fixed.

That's beyond the scope of which mode, but it's important. However the less code one has, the fewer places there are for things to hide.


No, malleability is not beyond the scope of which "mode" you encrypt something with. That's like saying that security is beyond the scope of which "mode" you encrypt with. People used to believe you could divorce confidentiality from integrity, back in the 1990s, but that turned out not to me true, due to adaptive chosen ciphertext attacks.


Yes. \o/

Anything less is control-freak, incumbent cronyism with a mafia protection fee.


That's part of it, but this is something governments have to take leadership on right now. That will only happen with direct pressure. Waiting until it's the leading cause of death will be too late, because of drug development pipeline timeframes.


It doesn't have to be that way, and waiting around for "someone else to handle it" will likely lead to a Tragedy of the Commons.

Call your representatives [US: 0,1] or regional government representative (I just called my senator, and on hold for house rep now), tell them we need an emergency crash program to develop new, tightly-regulated antibiotics so that infection doesn't become the leading cause of deaths in 2025. Because it takes years and billions to develop new antibiotics, this is something companies will not pursue on their own initiative. If not, it'll be a return to the 19th century. Good luck with that.

[0] http://www.house.gov/representatives/find/

[1] http://www.senate.gov/general/contact_information/senators_c...


You're not going to have new antibiotics without biotech or pharmaceutical companies helping.

The government needs to provide incentive for antibiotic research, right now regulatory and reimbursement issues are making the therapeutic area very unattractive.


Exactly. But because of the difficulty, time and capital requirements, this is something that can't be left to the market economics. It will be too late by the time we need them because of the years it takes to develop a single new drug. This is a "going to the moon" type thing that needs to happen if we intend to survive. Because that's what's at stake.


Two comments:

(1) You say it can't be left up to market economics, but two of the big hurdles to new antibiotic development are government regulations: (I) In the past the FDA was not very responsive to the resistance problem, if you had a new drug, you went through a normal review; luckily they have changed their approach recently (II) The way that Medicare and Medicaid pays for antibiotics doesn't encourage investment in novel agents

(2) I have to push back on the "going to the moon" type thing. This is more like we've already been to the moon and we need to go back and do something different. Drug companies know how to develop new antibiotics (not to say it's easy, but they have ideas) and they know how to get them approved. There are new discoveries all the time. We just need to create an ecosystem that encourages further investment.


Edge cases. The big picture is that it's not happening fast enough, which is why the government will need to step in and will need to assume a leadership role to push hard on this.


That's not going to happen. The gov't will change the regulatory and reimbursement environment but the heavy lifting will be done by academic and pharmaceutical researchers.


>But because of the difficulty, time and capital requirements, this is something that can't be left to the market economics. It will be too late by the time we need them because of the years it takes to develop a single new drug.

Isn't this exactly what people used to say about the food supply?


Nope. It is what it is: capital-intensive research that is hard and it takes a long time to come up with a molecule that will stop an infection without killing or disabling the patient. That can't be done last minute like in the movies.

FYI: One of the last-ditch antibiotics (I forget the name) has a side-effect of permanently damaging hearing. I have to basically yell at 95 yo grandmother for her to hear me. :)


That's one side, the other side would be a crash program to develop a spectrum of closely-guarded, last-resort antibiotics.


I don't eat meat or consume animal-derived products for this reason. This is where the next pandemic is mostly likely to originate, and it's completely preventable.


Unless you also avoid meat for other reasons, wouldn't it be better to eat meat, but only from those farmers that raise livestock in humane, sustainable conditions (organic/free range/...)? That would increase competition and support their business models.


On a personal note, my mom is still under the weather, having stuck to three different courses of antibiotics for a simple nasal infection.

It's frightening when this becomes the norm, not the exception because we're basically running out of options by natural selection moving faster than research.

We need a crash program to develop antibiotics before it's too late.


TL;DR: If owned, start from a fresh base system.

I think you meant "someone gets privileged code execution," which is a sensible assumption. Even still, app-permission (less than privileged) code execution can still do damage like host malware, IRC dumpsites/bot control, diodes, tor relays, vandalize web properties, etc.

The only way to know that a system is no longer owned for certain is to reimage it to a known good state. Doing anything less is tons of work, and unlikely to catch everything (rootkits, backdoors, hidden services, replaced system files, etc.). Even when running HIDS, HIDS cant be trusted because rootkits can hide things from it because it's running from the system with a possibly infected kernel. So, it turns out reimaging is less work and more trustworthy if the box is rebuilt and the 'sploit can be mitigated before bringing it online to the outside world (build and patch offline to avoid getting re-owned).


While I agree in principle that when owned one should start from scratch, my advice would be to learn something. Often I am asked to analyse attacks and I now have a collection of about 15 malware scripts that not only show me the intent but they are also useful (and remarkably well coded) for my daily admin tasks.

So, fresh start but at least get something out of it!


"and the 'sploit can be mitigated before bringing it online to the outside world"

You should read more carefully.

Also, keeping people waiting without an ETA for a down service because you're learning isn't going to result in happy customers.

Furthermore, whomever is running these boxes needs to deploy NIDS and HIDS and properly secure their boxes, because clearly they don't understand what an attack surface is.


Yes, whatever your security problem is, I'm sure some NIDS will clear it right up.


What a flippant, uncivilized, unconstructive comment.

Defense in-depth, every little bit helps.


Disagree, both in spirit and to the letter; for starters, I'm pretty sure there's still validity in a very long blog post I wrote about NIDS back in 1998:

http://insecure.org/stf/secnet_ids/secnet_ids.html

People running SAAS apps probably shouldn't waste much time with NIDS.


I'd assume s/he would isolate that machine for post-mortem and spin up a new service on a different box, unless we're talking poverty IT.


I think he said it precisely as he meant it.


Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: