3 ms·
While I'm sure you are right that you would totally never do something like that, it's likewise a truism that virtually all security goofs like this are commite
by ajross 10y ago
While I'm sure you are right that you would totally never do something like that, it's likewise a truism that virtually all security goofs like this are commited by programmers who think they'd totally never do something like that. To wit: I don't believe you.
What almost certainly happened here is that, as someone else in this thread mentions, someone came by to fix an automated warning about the use of strcmp(a, b) and replaced it with strncmp(a, b, strlen(a)) instead of strncmp(a, b, strlen(b)). Easily 90% of code reviewers wouldn't catch that mistake (especially if it came along with a truckload of other such fixes), and as it's a maintenance change no new tests would have been written for it.
The only way to catch this would have been to already have written and deployed a test that expressly tested an empty string password. That's surely a good test to have, but come on, be honest: you've probably written a bunch of "password" style checkers in your career. Did you deploy a test and integrate it into CI for every one of them?
- tyingq 10y agoIt was trickier that that even. It wasn't an empty password. It was an empty digest auth response, something like this is the normal path, inside the browsers code...not your own code. HA1=MD5(username:realm:password) HA2=MD5(method:digestURI) response=MD5(HA1:nonce:HA2) So you have to hijack the header value the browser sends...not just send an empty password.
- lightedman 10y ago"That's surely a good test to have, but come on, be honest: you've probably written a bunch of "password" style checkers in your career." No, not a single one. I tend to work on projects with a bit more complexity than that (including designing the required hardware on top of it if something suitable doesn't already exist.)