Better HN
topnewbestaskshowjobs
Log inSign up

CiPHPerCoder

6,663 karma · joined Feb 25, 2016 (10y ago) · 1,775 submissions

My name is Scott. I do a lot of open source security research, and cryptography.

Previously AWS Cryptography (2019 - 2023).

Unless otherwise stated, my opinions are my own and do not reflect my employer.

https://scottarc.blog/about/

Submissions

comment 6y ago · link · parent

The whole point of strong encryption is to prevent adversaries (including forensic scientists) from extracting any information without possession of the key.

If the key involves a password that you, a human, have memorized in your squishy pink organ, it's privileged under the Fifth Amendment. (This hasn't been tested in court yet, of course. There's no precedent to fall back on.)

comment 6y ago · link · parent

No, it's not more like making you open a safe.

Telling someone the encryption key is being compelled to act as a witness against yourself, which the 5th amendment provides protection against (if used).

comment 6y ago · link · parent

The irony is real, but I appreciate P0's transparency here.

comment 6y ago · link · parent

> On Android, it is normal for vendors to add device-specific code to the kernel.

https://i.imgur.com/DnRNrZe.png

Normal for Android : Normal in general :: Madness : Sanity

> This code is a frequent source of security vulnerabilities.

If the first sentence was the shot, that's the chaser.

245.

Show HN: Gossamer, an authority-free PKI for securing software updates(github.com ↗)

3 points · by CiPHPerCoder · 6y ago · discuss

comment 6y ago · link · parent

Incidentally, this is a problem I've worked on previously.

https://github.com/paragonie/libgossamer/tree/master/docs

comment 6y ago · link · parent

See https://news.ycombinator.com/item?id=9437021

comment 6y ago · link · parent

> I would argue the Merkle tree (or any other recursive signature algorithm)

A Merkle tree is not a recursive signature algorithm, because a hash function is not a signature algorithm.

https://paragonie.com/blog/2015/08/you-wouldnt-base64-a-pass...

(Yes, you can build signature algorithms out of hash functions, but definitions matter.)

comment 6y ago · link · parent

> Actually, Git is technically a blockchain.

No.

You can say that git reduces to a Merkle tree. And blockchains use Merkle trees.

But you can't say that git is a blockchain.

https://gist.github.com/joepie91/e49d2bdc9dfec4adc9da8a8434f...

https://paragonie.com/blog/2017/07/chronicle-will-make-you-q...

comment 6y ago · link · parent

...does the "0.6 of a worker" bit remind anyone else of the "Three-Fifths compromise" from American History class?

https://en.m.wikipedia.org/wiki/Three-Fifths_Compromise

Not sure if an intentional dog whistle

comment 6y ago · link · parent

This one's my favorite:

https://imgur.com/YV7vRFt

comment 6y ago · link · parent

Loosely. The majority have given up on the public understanding of nuances and just phone it in with "just don't write crypto".

Because AES-CTR and ChaCha both refer to it as a nonce, and CBC calls it an initialization vector, the IV/nonce distinction does matter. But if you misuse the terms folks will know what you meant to say. Just don't mix it up when it comes time to implement.

comment 6y ago · link · parent

NaCl is djb abandonware. Libsodium is actively maintained.

Libsodium offers Argon2 password hashing and key stretching, XChaCha20-Poly1305 AEAD constructions, BLAKE2b generic hashing, SipHash-2-4 for collision-resistant hash tables, etc.

Most people who say "use NaCl" really mean "use NaCl/libsodium".

Regarding my project: sodium-plus will wrap sodium-native (a thin Node wrapper to libsodium proper, which has been audited) if it is installed. To date, libsodium.js has not. Therefore, if you care about public code audits, you can use audited libsodium with sodium-plus just by installing sodium-native alongside it.

comment 6y ago · link · parent

> That section is talking about using an incrementing counter as the IV--it doesn't say anything about a PRNG being a bad choice (in this case, the PRNG being a SHA256).

Let's try this again.

You have two types of inputs that APIs refer to as "IVs".

Nonces: Must never repeat.

Initialization vectors: Must never repeat AND must be unpredictable.

Counters are acceptable for nonces. When an academic cryptographer says in a security proof that a counter doesn't suffice for the security of a scheme, what they're really saying is that you're in the latter category (must be unpredictable too) rather than the former (where predictable is okay as long as it never repeats).

If it can be predictable, it can be a counter. If it can't be a counter, it must be unpredictable.

The correct way to get an unpredictable IV is to use a CSPRNG.

SHA256(some predictable low-entropy inputs) fails to meet the bar for unpredictability.

> Are you talking about brute forcing the IV? The IV is not a secret to anyone--it's usually appended to the cipher text.

IVs aren't secret, but given the security proof I linked, IVs cannot be predictable. They must be unpredictable.

comment 6y ago · link · parent

> 3. They should be authenticated.

I covered that:

> Furthermore, not authenticating your ciphertext means padding oracle attacks can be launched against the app.

The list above was just the requirements for the initialization vector, not the list of problems with the code.

comment 6y ago · link · parent

https://web.cs.ucdavis.edu/~rogaway/papers/sym-enc.pdf

See the section about "CBC with Counters".

The consequence of the security proof by Rogaway, et al. for CBC mode is that IVs must be unique AND unpredictable for CBC mode to be secure*.

SHA256 is a deterministic pseudorandom function if you know all of the inputs. By studying the source code, we can see what gets fed into the SHA256 inputs. The cost to brute force all possible inputs is definitely much lower than 2^128, therefore it weakens the IND security of the AES-CBC scheme.

CBC security only provides indistinguishability. It isn't secure against adaptive chosen-ciphertext attacks.

comment 6y ago · link · parent

> > They must be unpredictable

> I am wondering if that is necessary,

Yes, it is necessary. The IND security of Cipher Block Chaining (CBC) depends entirely on the IV being from a cryptographically secure random generator.

CBC mode requires unique and random IVs. CTR mode requires unique IVs (but can be predictable).

That's why we call the CTR input a nonce (number to be used once) and the CBC input an IV (initialization vector). Since they have different security requirements, we refer to them differently. Unfortunately, some cryptography libraries just name the parameter IV.

comment 6y ago · link · parent

Libsodium (a fork of NaCl) is preferable to NaCl.

JS: https://www.npmjs.com/package/sodium-plus (I wrote this one.)

Lisp: https://github.com/orthecreedence/cl-sodium

Java (Android): https://github.com/terl/lazysodium-android

Other bindings: https://libsodium.gitbook.io/doc/bindings_for_other_language...

comment 6y ago · link · parent

> end-to-end encrypted

https://github.com/twinkle-labs/twinkle-notes/blob/45206f9d6...

For AES in CBC mode, IVs have two requirements:

1. They must never repeat.

2. They must be unpredictable.

Generating them from a SHA256 hash of some low-entropy data is not a good practice.

https://paragonie.com/blog/2016/05/how-generate-secure-rando...

Furthermore, not authenticating your ciphertext means padding oracle attacks can be launched against the app.

https://robertheaton.com/2013/07/29/padding-oracle-attack/

comment 6y ago · link · parent

This gives you a collision after 2^48 messages (via the birthday problem). Each message can be up to 2^36 - 256 bytes long.

This is less of a problem when each message also generates a random key, but still annoying to contend with.

XChaCha20-Poly1305 lets you generate 2^96 messages before having to worry about rekeying. https://libsodium.gitbook.io/doc/secret-key_cryptography/aea...

comment 6y ago · link · parent

PHP 7 didn't introduce a JIT. There was an experiment in the 7.x series, but it never surfaced.

comment 6y ago · link · parent

The problem isn't "RHEL ships ancient PHP for legacy apps".

The problem is "RHEL doesn't also ship newer PHP as an alternative and you need to instead rely on third-party repositories".

comment 6y ago · link · parent

I hope that it does, in the offchance that I need to do anything running on RHEL 10-15 years from now.

comment 6y ago · link · parent

Red Hat still ships ancient versions of PHP in their official packages.

I wouldn't bet on a backport unless you have a lot of clout (a.k.a. purchasing power) behind you.

comment 6y ago · link · parent

If a customer pays you to do the maintenance and update, I hope you're doing it.

But regardless, this is why integration testing is important.

"What will break if I update to Qt-latest?" being one click away.

comment 6y ago · link · parent

The same reason I tell people to stop running PHP 5.6:

If a security vulnerability is discovered, you always want to be on the latest version.

If updating requires a lot of effort and risks, the solution isn't "don't update". The solution is "fix those problems".

comment 6y ago · link · parent

This doesn't hurt open source users at all, though.

Only for-profit companies tend to actually need LTS releases. People don't.

comment 6y ago · link · parent

This seems like a good move to me.

The only people who really need LTS releases are companies that are able and [should be] willing to pay for LTS support.

If you're not willing to fulfill an invoice with 5+ digits, you don't need an LTS release.

comment 6y ago · link · parent

If it was true that trust is enough to market software, there would be much more investment in application security by the long tail of startups, consultancies, and webdev "shops".

What I've found over the years is that most people who sell software think of security as a value-add. At best, it's something to bill enterprise customers for. At worst, it's a cost center that will only be invested in if a big paying customer asks for it explicitly, and not a moment sooner. [1]

For background: I spent years pushing the PHP ecosystem forward in cryptography and security. I published a lot of open source libraries [2], cleaned up a lot of StackOverflow answers [3], and had a lot of discussions with small and medium businesses about security improvements that ultimately went nowhere because they couldn't find budget for security.

I don't believe it's fair to say that trust is "at the core" of software marketing if so many successful software companies can get by without investing in making their products trustworthy. After all, deception can obviate trust in this context.

(I do believe that software ought to be more trustworthy, and society should reward companies that act with integrity. But at the end of the day, that's not my call to make.)

[1]: https://sso.tax

[2]: https://github.com/paragonie

[3]: https://paragonie.com/blog/2018/01/our-ambitious-plan-make-i...

comment 6y ago · link · parent

Memory leaks don't surprise me. Segfaults do.

Have you reported them upstream? That implies a memory safety or garbage collection bug.

1
8910
60