Better HN
topnewbestaskshowjobs
Log inSign up

sdevlin

1,326 karma · joined Jul 6, 2009 (17y ago) · 248 submissions

Submissions

comment 12y ago · link · parent

The web is not a secure medium for this kind of application.*

This is because all the encryption features they tout depend implicitly on content (HTML and JavaScript) the server sends you every time you use the application. Because you receive this content anew on every usage, there's no way to verify what you're getting. Today it might be fine, but tomorrow it might contain a key logger or subtle cryptographic flaws.

You also can't depend on the community for help verifying this content, because it can be distributed selectively. The mass of users might get benign content while interesting targets get backdoored software.

* It might be safe to distribute something like this as an installable sandboxed web application. I'm actually not 100% certain. But the no-install-just-browse-to-this-url model is definitely insecure.

comment 12y ago · link · parent

Simply: performing a timing attack against a hash function implies performing a second-preimage attack against the hash function.

comment 12y ago · link · parent

That is a good way to think of it. Indeed, that is how cryptographic randomness is typically defined.

Simply put: given the first k bits of a random stream, can you predict the k+1th bit (more than 50% of the time)?

A generator that passes this test will pass any statistical randomness test, but the converse is not necessarily true. For example Mersenne Twister is a good generator from a statistical perspective, but it's actually quite easy to recover its internal state by observing a small amount of output. (Around 20k bits, if I recall correctly.)

154.

Entropy Attacks(blog.cr.yp.to ↗)

16 points · by sdevlin · 12y ago · 1 comment

comment 12y ago · link · parent

Python has a decimal package in stdlib. It provides an arbitrary-precision floating point type. The performance will obviously be worse than with floats, but I doubt it matters in an intro programming class. The only real drawback is that there are no decimal literals.

Actually, several languages I know of have decimal types in stdlib. Two that do not are C and JavaScript.

comment 12y ago · link · parent

Then what's the point?

comment 12y ago · link · parent

> "Nobody is going to die."

This isn't accurate, e.g. http://cryptome.org/2012/07/chile-comments.htm .

Bad crypto is actually much more dangerous than a single rogue dentist.

comment 12y ago · link · parent

> However, it is not a matter of debate that the RSA backdoor of BSAFE was and is not open merely to the NSA. It is an objective fact that anyone can take advantage of a backdoor like this.

This is not accurate. You need to know the private key for the generator, and this is not publicly known.

comment 12y ago · link · parent

That's an old-school C function declaration. Note that the function return type are parameter types are implicitly int. nE is then explicitly declared to be a char pointer pointer.

comment 12y ago · link · parent

More importantly, all encryption keys are either fixed or stored directly alongside ciphertext.

The cryptography in this system seems to be 100% cosmetic, so I'm not sure things like ECB mode or absence of MAC really matter.

EDITED for clarity.

comment 12y ago · link · parent

Sorry, I'm afraid my original post wasn't very clear. I was describing potential problems with Moxie's intentionally weak protocol, not with Telegram.

The hash in question is MD2 used to reduce the 32-byte random secret to a 16-byte shared encryption key. MD2 is weak, but I'm not sure if it matters in this context. As I said above though, I'm also not sure that it doesn't matter.

comment 12y ago · link · parent

You're right and I'm wrong. Mea culpa. I dashed these off quickly.

Unfortunately I can't edit anymore, so the erroneous #5 will have to stay there.

The main bad thing here is the null padding (covered in #4). This gives the attacker a lot of knowledge of the plaintext (the most significant bytes are all null), which can be used to decrypt if this format is validated on the other end. Bleichenbacher's attack only requires knowledge of one plaintext byte (the leading 02h), and we have many.

comment 12y ago · link · parent

To be clear, I'm describing problems with Moxie's hypothetical broken protocol, not with Telegram. Telegram does not (as far as I know) use Dual_EC_DRBG.

comment 12y ago · link · parent

This is true, but you could easily respond by increasing the RSA key size. This would make the protocol Telegram-secure without meaningfully improving its actual security profile in any way.

comment 12y ago · link · parent

Also no side channel observations.

comment 12y ago · link · parent

For reference, here's a list (probably incomplete? (EDIT: and feel free to add!)) of ways this protocol is broken:

  1. There's no authentication at any point. The whole thing is trivially MITM-able.
  2. The RNG is Dual_EC_DRBG, which is backdoored.
  3. The RSA public key is small enough that an attacker of sufficient means could break it.
  4. The RSA plaintext is unpadded. Proper padding is critical for safe RSA encryption. See e.g. Bleichenbacher '98.
  5. RSA is used to encrypt semantic data. Dangerous for the same reasons as above.
  6. The hash function is broken. I'm not sure if this matters too much here, but I'm also not sure that it doesn't matter.
  7. The ciphertext seems to be restricted to messages of exactly 128 bits. It's not clear how or if the plaintext is padded if it's too short, and it's not clear how the protocol handles a longer message. These are noteworthy considerations.
And yet it's still (basically) safe against the kind of contest Telegram has outlined. Someone could win by factoring the RSA public key, but I'm not sure if that would be cheaper than the $200k prize. This vulnerability can also be mitigated trivially by using bigger RSA keys, making the protocol Telegram-secure.

comment 12y ago · link · parent

Your analysis is correct. Their terms and conditions rule out just about every form of attack.

comment 12y ago · link · parent

This is really chickenshit, which is completely in line with everything else these guys have said or done.

Just so we're clear, this rules out:

  * Chosen plaintext attacks
  * Chosen ciphertext attacks
  * Adaptive chosen ciphertext attacks
  * EDIT: Also any kind of side channel
If you're keeping score at home, that's just about everything.

The only thing that would fail to meet this definition of security is repeating key XOR. And RC4.

comment 13y ago · link · parent

Nit: "Paterson", not "Peterson".

comment 13y ago · link · parent

Matasano - New York City, Chicago, San Francisco Bay Area

We test software for vulnerabilities.

Sorry, that's too clinical - the reality is that we torture and flay software, twisting it to serve our nefarious ends.

If that sounds like fun, consider applying.

NO PRIOR APPSEC EXPERIENCE IS REQUIRED. Just a keen technical acumen and a thirst for blood.

Perks: crazy-smart coworkers, health benefits, free books, etc. For more information, visit http://www.matasano.com/careers/

FEED YOUR HEAD:

As a bonus, try your hand at this problem from our never-before-published set of crypto challenges: https://gist.github.com/sdevlin/52e1d8898bda7ad35567

It's not required, but writing code to solve this problem would be a good way to get our attention. For more information on the crypto challenges, visit http://www.matasano.com/articles/crypto-challenges/

comment 13y ago · link · parent

If 2048-bit RSA is vulnerable, then RSA is probably toast.

comment 13y ago · link · parent

> Is the Thoreau in the Thoreau 2.0 picture wearing Google Glass glasses? As I understand Thoreau, he would today look exactly as he looked then. He surrounded himself with vegetables, beans, trees, critters, and such. Maybe a t-shirt or other more casual clothing than the high-collared stuff in his photograph, but I don't see him using any latest technology. Rather I see him shunning it. I would expect Thoreau would look and act the same if her lived a thousand years from now or a thousand years ago -- connecting with and valuing bean fields, ponds, winter animals, farms, and other parts of nature where people live harmoniously with it.

I'm fairly confident that was a joke.

comment 13y ago · link · parent

What problem does a predictable nonce cause?

comment 13y ago · link · parent

You put quotes around several phrases that are not used in the featured article. I suspect you do not understand this punctuation mark.

comment 13y ago · link · parent

Suite B does not contain RSA.

EDIT: To your latter point, some people would consider this to be a telling fact.

comment 13y ago · link · parent

I guess that's true, but in practice XSS is a much bigger threat to your application than someone MITM'ing an HTTPS connection to Google's (or whomever's) CDN.

comment 13y ago · link · parent

How would this protect you against a malicious server?

comment 13y ago · link · parent

Well, let me explain my thinking.

Suppose we sign https://server.com/sjcl.js. That resource is now tamper-proof in the event that server.com is compromised. But what about the rest of the application HTML/js? For example, an attacker could just say:

    <script src="/sjcl.js"></script>
    <script>sjcl = ...</script>
And overwrite the library on the client side.

Ok, suppose the browser support for content-signing prevents this somehow. The attacker can still modify the application-level code to use the library unsafely. I'm not totally familiar with the API sjcl exposes, but consider something like the e=1 RSA bug that was found recently.

Even if sjcl's API is so great that it's impossible to misuse, an attacker could simply render application code that doesn't use it at all. Or he could just log keystrokes and phone home the pre-encryption content.

What if we sign everything, including application HTML/js? Now we have another problem. We've basically resigned ourselves to serving only static content. We can't render any user input, because this would require a new signature. Probably not a useful web app.

comment 13y ago · link · parent

If you don't trust the server, you're screwed anyway.

comment 13y ago · link · parent

A few reasons.

The overarching problem is that you don't really get any feedback about whether what you're doing is right or wrong. For example, no cryptographer would use RSA like that, but that's not obvious just from studying the wiki article. Or from looking at the function output - it does turn ASCII into gibberish, as advertised, and that's where most developers will call it a day.

The moving parts are also treacherous. You're not just going to encrypt a string - someone is meant to decrypt it. Have you authenticated the ciphertext? Are you exposing a padding oracle? Or timing attacks? Are messages susceptible to replay? In crypto systems, these things are equivalent to locking the front door and leaving the window wide open.

In practice, most insecure crypto constructions aren't due to bugs in the implementation of RSA or AES. They're because of developers choosing inappropriate primitives, gluing them together incorrectly, or inadvertently exposing dangerous side channels.

Fortunately, there are libraries that can help. As mentioned elsewhere, NaCl/Sodium and KeyCzar provide higher-level interfaces that can abstract away many of these issues.

1
56789