Podcast
Root Causes 346: Private Credentials in Public Code


Hosted by
Tim Callan
Chief Compliance Officer
Jason Soroko
Fellow
Original broadcast date
December 8, 2023
We uncover the epidemic of private credentials in public-facing code repositories, including why it occurs and what do to about it.
Podcast Transcript
Lightly edited for flow and brevity.
When you say key, Tim, this isn’t some sort of cryptographic key, you know, esoteric thing. These literally open the door. Right? These keys, which can be cryptographic in nature, they can be essentially shared secrets, these, regardless of the form factor, are literally keys to open digital doors. It allows you to log into systems. It allows you to remotely administrate these systems. So, we haven’t even talked about the associated privileges and entitlements of these credentials. The credential opens the door. When I see something like an Auth0 key or an SSH credential or an Active Director API key, we are talking about things that essentially open up databases, open up servers to sometimes, if not root level access, sometimes very, very privileged access. Because, the typical person who is using an SSH credential is typically some sort of administrator or developer with a lot of credential. Right? A lot of privilege is what I mean.
Well, developers who are creating scripts, developers who are creating, I need to have my computer system whether it’s an API or an application talking to an API, it could be any number of computing functions. Well, in a modern application, Tim, that it’s extremely common to log into for a piece of code itself to need to log into a database.
So, the problem is this. It’s just so easy to take a shared secret credential and just stick it in the code so that when the code runs, the code has the credential it needs to log into a database.
Because it’s so easy for people to go in and find it but also, you never, ever be doing this anyway. So, here’s what is interesting. I want to get to the heart of the matter. There are ways to solve this, Tim. There are ways to solve this. And, in fact, the entire secrets involved industry – and we could rhyme off all the usual suspects, right – HashiCorp Vault, Akeyless, Doppler – there’s a bunch out there. And in fact, heck, your privileged access management systems, right? CyberArk and Delinea. Those guys have vaults. And Sectigo has vaults even for things like S/MIME certificates. Right? So you can go and generate those things and be sGrow those things. There’s so many reasons to keep your secrets in a repository that can be accessed by code. So, where your hardcoded credential would have gone, instead of hardcoding the credential, you code a routine which then says, hey, I’m gonna reach out to my - -
And I think that that’s a form of laziness in the sense - - and that’s why I say that because ignorance is a whole other thing. This is where that it could be done better but you’re cutting corners.
And I would say, Tim, this is one of the most unspoken about problems that are out there and one of the reasons why we call this out, yes, some of these credentials are shared secret based, they are alphanumeric tokens, which are not the equivalent to an asymmetric key. Key pair. Such as what would be contained - - a digital certificate which is bound to a public key. Yes, these things can also be hardcoded and so that’s the reason why we are bringing it up this podcast, it’s because, hey, all you folks out there that are using some sort of certificate based authentication, this is a problem for you too. And so, I’m gonna call out everybody here. Everybody who is in the governance business. For those of you who are risk officers and all the way up to CIOs and CISOs, I think we gotta start demanding code reviews and looking very specifically for these credentials that are floating around inside of code. Whether it’s publicly posted or not and just eradicate the practice and I think those of us who come from the PKI world and the world of governance and compliance, we should be the leadership in pounding our fist on the table for everybody else and say, guys, that’s just not acceptable. And an article like this – it’s a call to arms to get that going.
So, that kind of shows the trouble. Right? The trouble is I don’t think a lot of people sit and deliberately say I’m gonna include my secret in my code and then publish my code. I think what you get is somebody decides to put their secret in their code and then either a different individual or that same individual when that original decision was lost in the sands of time, makes the decision to publish that code. Even if I felt like my code was completely secure and owned and I could put a secret in there because it didn’t matter, it was never gonna get out – if I really want to believe that – if there is some possibility now or in the future, that my company or my organization might decide to publish this without my knowledge or without my consent or without any visibility from me or enough time has passed that I don’t remember there’s a secret in there, then that’s how this kind of thing can happen.
And, in fact, of course, I’m not saying anything new. There are vendors out there that this is their bread and butter. They look for these things. They have tools to be able to do that. What I’m saying though is the holisticness of creating an application or an API, some sort of functional code, the holisticness of this has gone away in the sense that who cares if there’s a problem upstream. This thing works so I’m just gonna leave it be.

