Let me say up front, Iâm no stranger to negative or ridiculous feedback. Itâs incredibly hard to hurt my feelings, especially if you intend to. You donât openly participate in the furry fandom since 2010 without being accustomed to malevolence and trolling. If this were simply a story of someone being an asshole to me, I would have shrugged and moved on with my life.Itâs important that you understand this, because when you call it like you see it, sometimes people dismiss your criticism with âtriggeredâ memes. This isnât me being offended. I promise.
My recent blog post about crackpot cryptography received a fair bit of attention in the software community. At one point it was on the front page of Hacker News (which is something that pretty much never happens for anything I write).
Unfortunately, that also means I crossed paths with Zed A. Shaw, the author of Learn Python the Hard Way and other books often recommended to neophyte software developers.
As someone who spends a lot of time trying to help newcomers acclimate to the technology industry, there are some behaviors Iâve recognized in technologists over the years that makes it harder for newcomers to overcome anxiety, frustration, and Impostor Syndrome. (Especially if theyâre LGBTQIA+, a person of color, or a woman.)
Normally, these are easily correctable behaviors exhibited by people who have good intentions but donât realize the harm theyâre causingâoften not by what theyâre saying, but by how they say it.
Sadly, I canât be so generous about⌠whatever this is:
https://twitter.com/lzsthw/status/1359659091782733827
Having never before encountered a living example of a poorly-written villain towards the work I do to help disadvantaged people thrive in technology careers, I sought to clarify Shawâs intent.
https://twitter.com/lzsthw/status/1359673331960733696
https://twitter.com/lzsthw/status/1359673714607013905
This is effectively a very weird hybrid of an oddly-specific purity test and a form of hazing ritual.
Letâs step back for a second. Can you even fathom the damage attitudes like this can cause? I can tell you firsthand, because it happened to me.
Interlude: Amplified Impostor Syndrome
In the beginning of my career, I was just a humble web programmer. Due to a long story I donât want to get into now, I was acquainted with the culture of black-hat hacking that precipitates the DEF CON community.
In particular, I was exposed the writings of a malicious group called Zero For 0wned, which made sport of hunting âskiddiezâ and preached a very âshut up and stay in your laneâ attitude:
Geeks donât really come to HOPE to be lectured on the application of something simple, with very simple means, by a 15 year old. A combination of all the above could be why your room wasnât full. Not only was it fairly empty, but it emptied at a rapid rate. I could barely take a seat through the masses pushing me to escape. Then when I thought no more people could possibly leave, they kept going. The room was almost empty when I gave in and left also. Heck, I was only there because we pwned the very resources you were talking about.Zero For 0wned
My first security conference was B-Sides Orlando in 2013. Before the conference, I had been hanging out in the #hackucf IRC channel and had known about the event well in advance (and got along with all the organizers and most of the would-be attendees), and considered applying to their CFP.
I ultimately didnât, solely because I was worried about a ZF0-style reception.
I had no reference frame for other folksâ understanding of cryptography (which is my chosen area of discipline in infosec), and thought things like timing side-channels were âobviousââeven to software developers outside infosec. (Such is the danger of being self-taught!)
âGeeks donât really come to B-Sides Orlando to be lectured on the application of something simple, with very simple means,â is roughly how I imagined the vitriol would be framed.
If it can happen to me, it can happen to anyone interested in tech. Itâs the responsibility of experts and mentors to spare beginners from falling into the trappings of other peoplesâ grand-standing.
Pride Before Destruction
With this in mind, letâs return to Shaw. At this point, more clarifying questions came in, this time from Fredrick Brennan.
https://twitter.com/lzsthw/status/1359712275666505734
What an arrogant and bombastic thing to say!
At this point, I concluded that I can never again, in good conscience, recommend any of Shawâs books to a fledgling programmer.
If youâve ever published book recommendations before, I suggest auditing them to make sure youâre not inadvertently exposing beginners to his harmful attitude and problematic behavior.
But while weâre on the subject of Zed Shawâs behaviorâŚ
https://twitter.com/lzsthw/status/1359714688972582916
If Shaw thinks of himself as a superior cryptography expert, surely heâs published cryptography code online before.
And surely, it will withstand a five-minute code review from a gay furry blogger who never went through Shawâs prescribed hazing ritual to rediscover specifically the known problems in OpenSSL circa Heartbleed and is therefore not as much of a cryptography expert?
(Art by Khia.)
May I Offer You a Zero-Day in This Trying Time?
One of Zed A. Shawâs Github projects is an implementation of SRP (Secure Remote Password)âan early Password-Authenticated Key Exchange algorithm often integrated with TLS (to form TLS-SRP).
Zed Shawâs SRP implementation
Without even looking past the directory structure, we can already see that it implements an algorithm called TrueRand, which cryptographer Matt Blaze has this to say:
https://twitter.com/mattblaze/status/438464425566412800
As noted by the README, Shaw stripped out all of the âextraneousâ things and doesnât have all of the previous versions of SRP âsince those are known to be vulnerableâ.
So given Shawâs previous behavior, and the removal of vulnerable versions of SRP from his fork of Tom Wuâs libsrp code, it stands to reason that Shaw believes the cryptography code he published would be secure. Otherwise, why would he behave with such arrogance?
SRP in the Grass
Headâs up! If you arenât cryptographically or mathematically inclined, this section might be a bit dense for your tastes. (Art by Scruff.)
When I say SRP, Iâm referring to SRP-6a. Earlier versions of the protocol are out of scope; as are proposed variants (e.g. ones that employ SHA-256 instead of SHA-1).
Professor Matthew D. Green of Johns Hopkins University (who incidentally used to proverbially shit on OpenSSL in the way that Shaw expects everyone to, except productively) dislikes SRP but considered the protocol ânot obviously brokenâ.
However, a secure protocol doesnât mean the implementations are always secure. (Anyone whoâs looked at older versions of OpenSSLâs BigNum library after reading my guide to side-channel attacks knows better.)
There are a few ways to implement SRP insecurely:
- Use an insecure random number generator (e.g. TrueRand) for salts or private keys.
- Fail to use a secure set of parameters (q, N, g).
To expand on this, SRP requires q be a Sophie-Germain prime and N be its corresponding Safe Prime. The standard Diffie-Hellman primes (MODP) are not sufficient for SRP.This security requirement exists because SRP requires an algebraic structure called a ring, rather than a cyclic group (as per Diffie-Hellman).
- Fail to perform the critical validation steps as outlined in RFC 5054.
In one way or another, Shawâs SRP library fails at every step of the way. The first two are trivial:
- Weâve already seen the RNG used by srpmin. TrueRand is not a cryptographically secure pseudo random number generator.
- Zed A. Shawâs srpmin only supports unsafe primes for SRP (i.e. the ones from RFC 3526, which is for Diffie-Hellman).
The third is more interesting. Letâs talk about the RFC 5054 validation steps in more detail.
Parameter Validation in SRP-6a
Retraction (March 7, 2021): There are two errors in my original analysis.
First, I misunderstood the behavior of SRP_respond()
to involve a network transmission that an attacker could fiddle with. It turns out that this function doesnât do what its name implies.
Additionally, I was using an analysis of SRP3 from 1997 to evaluate code that implements SRP6a. u
isnât transmitted, so thereâs no attack here.
Iâve retracted these claims (but you can find them on an earlier version of this blog post via archive.org). The other SRP security issues still stand; this erroneous analysis only affects the u
validation issue.
Vulnerability Summary and Impact
Thatâs a lot of detail, but I hope itâs clear to everyone that all of the following are true:
- Zed Shawâs libraryâs use of TrueRand fails the requirement to use a secure random source. This weakness affects both the salt and the private keys used throughout SRP.
- The library in question ships support for unsafe parameters (particularly for the prime, N), which according to RFC 5054 can leak the clientâs password.
Salts and private keys are predictable and the hard-coded parameters allow passwords to leak.
But yes, OpenSSL is the real problem, right?
(Art by Khia.)
Low-Hanging ModExp Fruit
Shawâs SRP implementation is pluggable and supports multiple back-end implementations: OpenSSL, libgcrypt, and even the (obviously not constant-time) GMP.
Even in the OpenSSL case, Shaw doesnât set the BN_FLG_CONSTTIME
flag on any of the inputs before calling BN_mod_exp()
(or, failing that, inside BigIntegerFromInt
).
As a consequence, this is additionally vulnerable to a local-only timing attack that leaks your private exponent (which is the SHA1 hash of your salt and password). Although the literature on timing attacks against SRP is sparse, this is one of those cases thatâs obviously vulnerable.
Exploiting the timing attack against SRP requires the ability to run code on the same hardware as the SRP implementation. Consequently, itâs possible to exploit this SRP ModExp timing side-channel from separate VMs that have access to the same bare-metal hardware (i.e. L1 and L2 caches), unless other protections are employed by the hypervisor.
Leaking the private exponent is equivalent to leaking your password (in terms of user impersonation), and knowing the salt and identifier further allows an attacker to brute force your plaintext password (which is an additional risk for password reuse).
Houston, The Ego Has Landed
Earlier when I mentioned the black hat hacker group Zero For 0wned, and the negative impact their hostile rhetoric, I omitted an important detail: Some of the first words they included in their first ezine.
For those of you that look up to the people mentioned, read this zine, realize that everyone makes mistakes, but only the arrogant ones are called on it.Zero For 0wned
If Zed A. Shaw were a kinder or humbler person, you wouldnât be reading this page right now. I have a million things Iâd rather be doing than exposing the hypocrisy of an arrogant jerk who managed to bullshit his way into the privileged position of educating junior developers through his writing.
If I didnât believe Zed Shaw was toxic and harmful to his very customer base, I certainly wouldnât have publicly dropped zero-days in the code he published while engaging in shit-slinging at othersâ work and publicly shaming others for failing to meet arbitrarily specific purity tests that donât mean anything to anyone but him.
But as Dan Guido said about Time AI:
https://twitter.com/veorq/status/1159575230970396672
Itâs high time we stopped tolerating Zedâs behavior in the technology community.
If you want to mitigate impostor syndrome and help more talented people succeed with their confidence intact, boycott Zed Shawâs books. Stop buying them, stop stocking them, stop recommending them.
Learn Decency the Hard Way
(Updated on February 12, 2021)
One sentiment and question that came up a few times since I originally posted this is, approximately, âWho cares if heâs a jerk and a hypocrite if heâs right?â
But he isnât. At best, Shaw almost has a point about the technology industryâs over-dependence on OpenSSL.
Shawâs weird litmus test about whether or not my blog (which is less than a year old) had said anything about OpenSSL during the â20+ years it was obviously flawedâ isnât a salient critique of this problem. Without a time machine, there is no actionable path to improvement.
You can be an inflammatory asshole and still have a salient point. Shaw had neither while demonstrating the worst kind of conduct to expose junior developers to if we want to get ahead of the rampant Impostor Syndrome that plagues us.
This is needlessly destructive to his own audience.
Generally the only people youâll find who outright like this kind of abusive behavior in the technology industry are the self-proclaimed âneckbeardsâ that live on the dregs of elitist chan culture and desire for there to be a priestly technologist class within society, and furthermore want to see themselves as part of this exclusive casteâif not at the top of it. I donât believe these people have anyone elseâs best interests at heart.
So letâs talk about OpenSSL.
OpenSSL is the Manifestation of Mediocrity
OpenSSL is everywhere, whether you realize it or not. Any programming language that provides a crypto
module (Erlang, Node.js, Python, Ruby, PHP) binds against OpenSSL libcrypto.
OpenSSL kind of sucks. It used to be a lot worse. A lot of people have spent the past 7 years of their careers trying to make it better.
A lot of OpenSSLâs suckage is because itâs written mostly in C, which isnât memory-safe. (Thereâs also some Perl scripts to generate Assembly code, and probably some other crazy stuff under the hood Iâm not aware of.)
A lot of OpenSSLâs suckage is because it has to be all things to all people that depend on it, because itâs ubiquitous in the technology industry.
But most of OpenSSLâs outstanding suckage is because, like most cryptography projects, its API was badly designed. Sure, it works well enough as a Swiss army knife for experts, but thereâs too many sharp edges and unsafe defaults. Further, because so much of the world depends on these legacy APIs, itâs difficult (if not impossible) to improve the code quality without making upgrades a miserable task for most of the software industry.
What Can We Do About OpenSSL?
There are two paths forward.
First, you can contribute to the OpenSSL 3.0 project, which has a pretty reasonable design document that almost nobody outside of the OpenSSL team has probably ever read before. This is probably the path of least resistance for most of the world.
Second, you can migrate your code to not use OpenSSL. For example, all of the cryptography code Iâve written for the furry community to use in our projects is backed by libsodium rather than OpenSSL. This is a tougher sell for most programming languagesâand, at minimum, requires a major version bump.
Both paths are valid. Improve or replace.
But whatâs not valid is pointlessly and needlessly shit-slinging open source projects that youâre not willing to help. So I refuse to do that.
Anyone who thinks that makes me less of a cryptography expert should feel welcome to not just unfollow me on social media, but to block on their way out.
https://soatok.blog/2021/02/11/on-the-toxicity-of-zed-a-shaw/
#author #cryptography #ImpostorSyndrome #PAKE #SecureRemotePasswordProtocol #security #SRP #Technology #toxicity #vuln #ZedAShaw #ZeroDay