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 7y ago · link · parent

This line of discussion ("Make it so we can pay you $xxK/mo, don't ask for donations.") comes up a lot on HN.

Here's what I did:

First, I spent four years developing security libraries for PHP developers that can be considered core infrastructure. Random_compat was an API-compatible polyfill of PHP 7's random_bytes() and random_int() functions for PHP 5 projects (and has over 100 million downloads). sodium_compat reimplemented most of libsodium in pure-PHP, and currently powers WordPress's signature verification functions. That's just two examples, I have over a dozen of distinct and useful libraries-- many of which have been adopted into popular frameworks-- that make your software materially more secure. If you're a serious player in the industry and your code base is PHP, you're running my code.

Okay, value delivered through open source? Check.

All of the above was also published through an LLC rather than just under an individual's name.

Then, I began offering the usual HN recommendations (support contracts, especially for EOL versions of PHP for Enterprise Linux customers).

I even created a streamlined workflow section on the company website and linked all of our open source projects to it: https://paragonie.com/enterprise

To date, the SQL tables that power that section of our website only has test records I created to make sure it was turned on correctly.

So I believe this to mean one of two things:

1. There's a missing step that I'm not doing that, once executed, will rake in the dollars.

2. The prescribed advice on message boards about how to run an open source business doesn't work.

(Until I figure out which it is, I'll have to continue doing code audits and penetration tests. Not exactly hurting for money, but it's not coming from the channels that people expect for open source. Enjoy the anecdata.)

https://packagist.org/packages/paragonie/random_compat

https://packagist.org/packages/paragonie/sodium_compat

https://make.wordpress.org/core/2019/05/17/security-in-5-2

comment 7y ago · link · parent

You'd think, but everyone I know that explored this option ended up just implementing desktop software instead (e.g. with Electron).

comment 7y ago · link · parent

Usually the first thing I check in a project like this when it ends up on HN or Reddit is their symmetric cryptography features. Not because of any particularly scientific reason, but because it's a good heuristic on whether or not it's worth the time and energy to look at the rest of the code.

Tanker's looks like this:

https://github.com/TankerHQ/sdk-js/blob/master/packages/cryp...

Seems pretty OK to me.

comment 7y ago · link · parent

Okay, then let's work together to get better standards than the ones currently available.

comment 7y ago · link · parent

> the thrust of Marc's point is not that we should be "reinforcing public trust in standards"

It isn't?

https://twitter.com/realhashbreaker/status/11283305376455639...

https://twitter.com/realhashbreaker/status/11283322027758632...

https://twitter.com/realhashbreaker/status/11283784887324385...

"Marc Stevens wants to reinforce the public trust in standards, especially among non-experts" isn't an uncharitable summary of this conversation.

> That makes you seem disingenuous.

If I'm mistaken about the point he's defending, it's not an act of dishonesty.

Given that he at multiple points agreed with my arguments that standards bodies make dumb mistakes and yet continued to double down on "we should just follow standards anyway" without caveat, there aren't many alternative interpretations that I'm aware of.

If I still seem disingenuous, it might be that you want me to seem that way. In which case, there's no point in either of us continuing to participate because it has ceased to be about security and instead has become a discussion of ego, which I'm frankly uninterested in.

comment 7y ago · link · parent

> Is that a trite point? Yes

The next question I would ask myself in this context is, "Should I have even raised the trite point in the first place?"

comment 7y ago · link · parent

The answer is: Composer + Packagist. There's almost certainly a library that handles it in a sane and transparent manner for you so you don't have to deal with the pain.

comment 7y ago · link · parent

Has KangarooTwelve received more analysis than BLAKE2? Or are both recommendations morally equivalent in the context of standardization and confidence in security margins?

To be clear: I agree with Marc in general, but there are exceptions where I disagree with Marc's "only use {FIPS,NIST,etc.}-approved crypto":

* I prefer Ed25519 over foot-bullety ECDSA (i.e. before RFC 6979).

* I prefer to never use RSA at all.

* I prefer XChaCha20-Poly1305 over AES-GCM, since the former is always constant-time without requiring specialized hardware and you have a negligible chance of nonce misuse even after an absurd number of messages.

* I prefer Argon2id and scrypt over PBKDF2 for key stretching.

* I prefer Argon2id and bcrypt over PBKDF2 for password storage.

* I prefer BLAKE2 over SHA-256, especially when length extension attacks are within the threat model of the protocol being discussed. SHA3 is good. Most SHA2 hash functions are fine (as long as they're not being used stupidly). But BLAKE2 is not only faster, thanks to libsodium, it's more readily available to developers than SHA3 (which, like AES, is only performant with specialized hardware circuits in software that takes advantage of said circuits).

None of the algorithms I've mentioned above are random pet projects by hobbyists.

To resolve this impasse, what needs to happen is: Standards bodies (NIST, FIPS, ISO, etc.) need to stop digging their heels in on sunk-cost fallacies and give at least some of these algorithms a fair consideration. Then one of two things will follow:

1. They'll be found to be as secure as the cryptographers who have studied them already believe, and therefore appropriate for standardization.

2. New attacks will be found, and the state of the art can be moved forward.

And this trend of cryptography towards requiring specialized hardware to be fast and secure? I oppose it wholeheartedly.

comment 7y ago · link · parent

> The absurd logical conclusion of that criteria taken at face value is that we'd all be better off if we each used our own bespoke hash function, since cryptanalysis would never be able to keep up.

The reason this "logical conclusion" sounds so absurd is that your reasoning here is absurd.

What matters isn't "cryptanalysts haven't published an attack", what matters is "cryptanalysts tried and failed to attack the design".

If you conflate the two, you will end up confused.

comment 7y ago · link · parent

Saying "BLAKE2 is at least as secure as SHA-256" is saying that:

1. The best known attacks against SHA-256 have a cost of 2^i for some value of i.

2. The best known attacks against BLAKE2 have a cost of 2^j for some value of j.

3. j >= i

comment 7y ago · link · parent

There are reasons to prefer other functions, but none of those are disqualifying marks on SHA-3.

If you have SHA-3 available, just use it. Everything listed in that article is secure today and will probably be secure 10 years from now.

comment 7y ago · link · parent

Catalin was quoting me in the article, so it's only fair that I elaborate here.

There are four common flavors of the SHA2 family you're likely to run into:

  - SHA-224
  - SHA-256
  - SHA-384
  - SHA-512
And then there are two more variants of "truncated SHA-512" (except they also use different initialization vectors than SHA-512, which is kind of an important detail)

  - SHA-512/256
  - SHA-512/224
These latter two don't have nearly the cross-platform support as the first four.

For example, in PHP, hash('sha256', 'some text') worked since PHP 5.1.2 (without PECL), but hash('sha512/256', 'some text') didn't work until PHP 7.1.0 (which is only a few years old).

See for yourself: https://3v4l.org/A1dZc

As a typical software developer, you might see SHA-{magic/numbers} and probably discover from Google/StackOverflow/etc. that they're in the SHA2 family and that the SHA2 family is secure, and then reason that whatever you're doing must also be also secure.

But there's a problem.

SHA-256 and SHA-512 (not the truncated varieties) are known to be vulnerable to length extension attacks. This is only a problem if you're using these hash functions in a vulnerable way. (Which isn't as uncommon as you'd think in homebrew crypto.)

If you're using HMAC, length extension attacks are a moot point. There's a reason 'tptacek always recommends HMAC for symmetric authentication.

SHA-224, SHA-384, SHA-512/224, and SHA-512/256 are not vulnerable to length extension attacks.

BLAKE2 is not vulnerable to length-extension attacks. It's also at least as secure as SHA2, but faster than MD5. SHA3 is at least as secure as BLAKE2, but is significantly slower in software.

Thus, the recommendations are:

  - BLAKE2
    for speed and security
  
  - SHA-512/256
    if you want speed, length-extension attack resistance, and arbitrary standards compliance
  
  - SHA3-256
    if you care more about security and what the FIPS authors think than speed
  
  - SHA-384 
    if you're concerned about backwards compatibility but don't want to accidentally cause
    junior developers that poorly mimic your designs to introduce LEAs into their code
  
  - Any other SHA-2 family hash function 
    if you're not interested in all of this nuance and want something
    guaranteed to be secure for the next few years that is widely implemented
Of course, there should be a huge asterisk with this list: If you're not a crypto expert, you shouldn't be making this decision. Just stop using SHA1.

It's also worth noting that Marc Stevens-- hash function breaker extraordinaire-- disagrees with my recommendation because BLAKE2 isn't a {NIST,FIPS,ISO,whateverStandardsBodyYouTrust}-approved hash function, and for better or worse, believes strongly in reinforcing public trust in standards organizations. https://twitter.com/realhashbreaker/status/11283816001468948...

He has a point in general, but in this specific case, I think BLAKE2 is going to become the de jure SHA2 successor at least until SHA3 hardware acceleration becomes ubiquitous.

Also, standards bodies have a nasty habit of digging in their heels on their mistakes, instead of issuing new guidance in response to research. See also: WPA3 and Dragonfly vs SPAKE2-EE or OPAQUE.

For a higher-level example, look at the failures baked into the JOSE standards (JWT, etc.) versus PASETO.

Fun fact: If you take JOSE and replace JSON with CBOR, without fixing any of the protocol security problems, you get COSE... which reared its ugly head in W3C's WebAuthn standard. Bad standards never die.

Until we get a standards committee that isn't garbage, I don't entirely agree with Marc's appeal to faith here.

While NIST et al. certainly do a better job at deciding on primitives than self-styled post-2010 cypherpunks (y'know, the ones that try to cascade a bunch of ciphers together in case one is broken but then use CRC32 for mixing files into the encryption key?), their failure to correct (let alone learn from) their mistakes and update recommendations in a timely manner is a problem that can't be dealt with through blind adherence to whatever they publish.

comment 7y ago · link · parent

Either way, 85 bits of post-quantum security makes me feel safe.

comment 7y ago · link · parent

> If you're a Red Hat customer, you could file a support ticket to get it pulled back in.

I have never spent $1 of my own money on Red Hat. After seeing this, I never will.

comment 7y ago · link · parent

IIRC the best quantum attack against SHA256 clocked in at about 2^85 cost. It's still not practical for most modern hash functions.

comment 7y ago · link · parent

Nope. SHA-2 (known to developers as SHA224, SHA256, SHA384, and SHA512) was the replacement for SHA-1. SHA-3 was created as an insurance policy in case the SHA-2 family was broken too. So far, it hasn't been.

We won't need a SHA-4 any time soon. SHA-2 is fine, BLAKE2 is fine (and faster), SHA-3 is fine.

comment 7y ago · link · parent

Quite right.

comment 7y ago · link · parent

First SHA1 was shattered. https://shattered.io

Now it's reduced to shambles.

It's time to stop using SHA1. (HMAC-SHA1 is still okay.)

comment 7y ago · link · parent

I recommend the Tech Solidarity resource to people all the time, alongside https://decentsecurity.com

comment 7y ago · link · parent

No. https://twitter.com/fkooman/status/1125767993764536321

comment 7y ago · link · parent

Good news: They ship PHP 7.2

Bad news: ...without ext/sodium

That's a frankly irresponsible decision for Red Hat to make.

comment 7y ago · link · parent

If you're curious:

https://paragonie.com/blog/2016/10/guide-automatic-security-...

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

I've written a lot about the design and utility of append-only cryptographic ledgers for this use case.

Mozilla has their own implementation based on Certificate Transparency: https://wiki.mozilla.org/Security/Binary_Transparency

Filippo Valsorda is working on bringing something similar to the Go ecosystem, based on a Trillian personality.

There's a lot of work going on, there's just not a marketing team behind these efforts, so you only ever hear about blockchains and ICOs.

comment 7y ago · link · parent

> Web applications should run with the least possible privileges, ie. only with permissions to write to dedicated locations on the filesystem (user uploads), and read permissions for the code.

This isn't wrong but I'd argue it's a lower priority concern than you believe it is.

A comprehensively secure automatic update system would have process isolation between the normal web interface and the updater (and the latter would run as a different, more privileged user). However, not everyone can do that. (Shared hosting, etc.)

https://paragonie.com/blog/2016/10/guide-automatic-security-...

The goal of an automatic update mechanism should be to prevent the rampant exploitation of 1days, like what happened with Drupal not too long ago.

If you had to choose between "owned within 7 hours of the advsisory" or "less theoretically secure in a constrained environment but still securely self-updating" in the CMS/blog threat model, the latter wins.

There's no easy way to rearchitect WordPress to support the principle of least privilege and process isolation for their auto-updater in a way that ensures everyone still uses it. So for the time being, that's worthy of being called out, but isn't a big enough deal to label the whole shebang insecure. Because "insecure in which threat model?"

474.

WordPress 5.2: Mitigating Supply-Chain Attacks(paragonie.com ↗)

107 points · by CiPHPerCoder · 7y ago · 37 comments

comment 7y ago · link · parent

The permissions have been fixed. Thanks for the head's up!

comment 7y ago · link · parent

Location: Naples, FL

Remote: Yes

Willing to relocate: Yes

Technologies: PHP, Java, JavaScript (Node.js and client-side), C#, Python

Résumé/CV: https://drive.google.com/file/d/1FgDjlZCoMgX8yMCn6xsYYXEDy54...

Email: scott@arciszewski.me

Hi, my name is Scott. I'm a web developer turned application security engineer with a specialization on cryptography and zero-day vulnerability research.

I wrote the cryptography library that will be securing the next version of the software that powers over 33% of websites on the Internet. (It's due to be released next Tuesday, on May 6, 2019.)

I've got plenty of interesting stories from the many technical challenges I've helped solve. If your tech stack touches PHP, there's a good chance you're already using security code I wrote.

If you need someone capable of implementing cryptography securely (where "cryptography" can mean anything from high-level protocols combining existing primitives, or re-implementing curve25519 field arithmetic in a language that only has 32-bit signed integers-- without introducing timing side-channels), I might be that someone. I've done quite a bit of that over the past few years.

comment 7y ago · link · parent

An archive of both pages in case they try to play the "revise history" game.

https://archive.fo/0WTCE

https://web.archive.org/web/20190423172440/https://turbotax....

https://web.archive.org/web/20190426004701/https://turbotax....

comment 7y ago · link · parent

Responding to the headline: Because depression isn't sadness, it's a mental illness that causes a numbing, hollowing feeling that robs you of joy. In my experience, it's more akin to despair than sorrow.

Feeling anything (even sadness) can help make it easier to cope with it if you're unable to seek effective treatment.

Which is most people, probably. Most people I know who have depression can't (or won't) seek effective treatment, usually because of cost prohibition.

comment 7y ago · link · parent

I've never heard of Polar before. Tell me, in as few words as necessary, why I should care about it and what it is? (In that order.)

comment 7y ago · link · parent

You immediately lose your integrity protections, which allows you to launch attacks against AES-CTR as if it had no authentication tag.

https://cryptologie.net/article/361/breaking-https-aes-gcm-o...

1
151617
60