Secrets are bad. Secrets in source code are an order of magnitude worse.
Secrets are difficult to protect. Every attacker goes after the secrets and we must protect our secrets against all of them. The secrets are the valuable part of our software and that’s why they are bad – they represent an area of heightened risk.
What would a developer do when his piece of software needs to access a password protected server? That’s right, he will write the user name and the password into some constant and compile them into the code. If the developer wants to be clever and heard the word “security” before, he will base64 encode the password to prevent it from “being read by anyone”.
The bad news is, of course, that whoever goes through the code will be able to follow the algorithm and data through and recover the user name and password. Most of the software is available to anyone in its source form, so that is not a stretch to assume an attacker will have it as well. Moreover, with the current level of binary code scanning tools, they do not need the source code and do not need to do anything manually. The source and binary scanners pick out the user names and passwords easily, even when obscuring algorithms are used.
So, the password you store in the source code is readily available. It’s really like placing the key to your home under the doormat. It’s that obvious.
Now, you shipped that same code to every customer. That means that the same password works at every of those sites. Your customers and whoever else got the software in their hands can access all of the sites that have your software installed with the same password. And to top it off, you have no way of changing the password short of releasing a new version with the new password inside.
Interestingly, Facebook had this as one of their main messages to the attendees of the F8 Developers Conference: “Facebook security engineer Ted Reed offered security suggestions of a more technical nature. Reed recommended that conference attendees—particularly managers or executives that oversee software development—tell coders to remove any secret tokens or keys that may be lurking around in your company’s source code.”
Which means the story is far from over. Mainstream applications continue to embed the secrets into the source code defying the attempts to make our software world secure.
The thought of compiling the user names and passwords into the application should never cross your mind. If it does, throw it out. It’s one of those things you just don’t do.
Security engineer and architect with 30+ years across Alcatel, Sony, Software AG, and Toyota. Started in embedded systems and telecom, moved through R&D, senior management, and back to engineering by choice.
Co-invented Near Field Communication (NFC) and authored 5 international standards for ISO, ECMA, and ETSI. Built enterprise security programs from zero twice, for Sony FeliCa and for Software AG (1500+ engineers, 100+ products). Patent holder in applied security automation, with a second patent pending for hermetic build systems.
I work across the full stack of security: application security, embedded systems, cryptography, supply chain, cloud infrastructure, and vulnerability management. My background in both engineering and management means I operate at the architecture level and at the policy level, whichever the problem requires.
advice attack authentication breach cloud cost costs Cryptography database Development disk encryption economics embedded encryption general Google guidance hash hashing inevitability internet management mobile network news NFC NSA Password password database password management passwords philosophy Physical security privacy protection quality risk rules security security investment society software software design technology user information