r/AskProgramming • u/treyallday01 • Dec 29 '23
Other Are security flaws relatively common in software run by successful companies?
Last month I was surprised to read a thread where many of the experienced devs here said much of the software they've worked on (even in larger companies) was made of "hacky" code that is barely strung together.
I am curious - have many of you also come across security flaws? Is this common for large-scale applications to have exploits that are likely (or hopefully) never found?
41
18
u/bitspace Dec 29 '23
Almost all software uses third-party libraries and packages and other dependencies. A widely-publicized and well-known example of a critical security vulnerability that came about in one such dependency was the log4j vulnerability 2 years ago. This XKCD is not an inaccurate caricature of the state of affairs in modern software development.
Aside from flaws in dependencies, it's really easy to write software with flaws that can be exploited. Some languages and frameworks are less vulnerable to certain classes of vulnerabilities, but all software has the potential for vulnerabilities.
8
Dec 30 '23
Not only this... but try carving our time in sprints to resolve technical debt, reduce dependencies, and update 3rd party libraries not tied to a new feature. A lot of times funding is tied to new features and capabilities. I have heard naive managers claim that firewalls and security appliances will protect us, and we don't need to update that specific library because of mitigating controls, or worse, they accept the risk because the chance of an exploit is so low. Just look at all the company's sill using old versions of electron with known vulnerabilities.
5
13
u/Impressive_Class_892 Dec 29 '23
Yes. And, in my experience, it’s almost never due to laziness or lack of skill or bad code per se, it’s a mismatch in priorities at an organizational level. Secure design takes time, as does secure implementation, and it can be hard to make a case for those in the face of demands for “velocity”. And once insecure patterns and systems — maybe even latent ones — exist in the code, they get copied and relied upon more and more, amplifying or exposing problems.
Generally, organizational priorities get shuffled when there’s a major breach. Sometimes this helps and sometimes it just introduces hurdles which make everything slower (which does have the impact of less insecure code shipping, primarily because it results in less code of any kind shipping)
It’s super hard to talk about this stuff in specifics for obvious reasons, but I’ve worked at some very large and very successful companies and almost all of them had security problems which I’d consider embarrassing.
4
u/Riajnor Dec 29 '23
There is nothing more permanent than a temporary solution And once they’re in there, the cost of fixing it is exponential
1
21
u/codepc Dec 29 '23
All software has issues. No matter how smart the people who build things are or how much time they spend on it, there will always be ways for their code to be hacked.
The thing that people should optimize for is minimizing the risk if (and when) their software is broken into, and making it easy to discover when it happens. Regular audits are important (eg penetration testing). Anybody who says they’ve never written software with potential holes is lying
Worse — exploits can happen even outside of your code. Maybe your code is fine, but what about the server it runs on? The other software running on that server? Etc
1
u/Conscious_Support176 Dec 30 '23
It makes no sense to claim that there will always be ways for code to be hacked no matter what. It’s simple question of cost/benefit and priorities. The priority is getting software out the door that does something. If it useful enough, it will be used as soon as; software that always works correctly will be a distant second to that. Software that is secure and cannot be exploited is some distance behind that.
2
u/codepc Dec 30 '23
I’d challenge you that people who want to get into your systems (whether it be your house, your code, or your safe) will find a way to do it given enough time and resources. Can you make things reasonably secure against a standard script kiddy? Sure. A sophisticated attacker? Maybe. A nation state attacker, like the NSA? Probably not. The risk increases especially as your dependence on others does.
One great example I think about often is curl. One of the most utilized libraries on earth, with eyes on it by literally everybody. They still find exploits in code from decades ago in it.
1
u/Conscious_Support176 Dec 30 '23
Why exactly am I going to spend my time writing “my systems” to demonstrate what I have already explained and does not need to be demonstrated?
6
u/zenos_dog Dec 30 '23
Software Engineer here with 42 years experience. I ran an analysis tool against my last large project. A coworker and I had written a web application, including the backend. It was about 250,000 loc. Approximately 90% of the product was free open source software (FOSS), so 2,500,000 loc. Even if our code didn’t have security exposures, the remaining 90% likely would. It’s the nature of software development these days that you’re leveraging a vast amount of open source.
The company licensed a third party software tool that scanned our software, find the third party dependencies and checked those packages against a list of known vulnerabilities. We had bug fixes every single month.
3
u/amasterblaster Dec 30 '23
I'm a consultant worked on a product that manages a 20+ million dollar pool of cash. On a call with one of the senior managers hiring me, I again asked about please doing unit tests on the trade modules. Frustrated, he told me back, again, that since there are no bug reports he does not want to invest in testing.
Yes.
Driving blind over there.
2
Dec 30 '23
Yup. It may shock you to know but most people don't know what they are doing. This goes for basically every profession. Until you have about 20 years experience (and you have drive), you don't really know much.
2
u/astroNerf Dec 30 '23
have many of you also come across security flaws?
This happens quite often, so often that there are organizations whose job it is to centrally track such flaws and vulnerabilities. When some vulnerability is identified, there's a process in which it gets assigned a CVE number and is documented, tracked, and published, though not before steps are taken to mitigate it, typically with a patch or a work-around.
Not every vulnerability is the same. Some are more severe than others, due to how easy it is to exploit them or due to the damage they could allow if exploited. For example, a flaw in a web browser that can allow an attacker to take over your computer when you click a bad link is much more dangerous than a flaw that requires a hacker to be on the same local area network as your computer.
By way of example, Microsoft's patch Tuesday (the second Tuesday of each month in which many updates are bundled and released together through Windows Update) for this past November affected these programs and operating system components. In total, this was 57 CVEs that were dealt with.
Of course, not every bug is a security vulnerability. A bug that causes text to render incorrectly when a mouse hovers over it but otherwise does not break anything when saving or loading data isn't something you'd normally see as a CVE number. When a program breaks this way, it isn't failing in a way that allows an attacker to use it to their advantage.
... have exploits that are likely (or hopefully) never found?
Ideally, you want those exploits to be found and fixed. If they are found by an adversary, they can be used against you. An adversary could be a foreign government, your own government, private companies, and organized crime entities. And teenagers without proper supervision.
Best not to leave things to chance and build software using tools and practices that are less likely to cause such vulnerabilities in the first place. That includes using central databases to track common vulnerabilities.
2
u/elucify Dec 30 '23
I think the continuous drumbeat of news about successful exploits against software and hardware at all levels makes it pretty clear. Read up on SolarWinds https://www.techtarget.com/whatis/feature/SolarWinds-hack-explained-Everything-you-need-to-know
2
Dec 30 '23
Yes but I'll expand -- its actually worse than you expect. Think about this. Software built by major companies has more people targeting it then there are people to fix issues. But even with a whole team dedicated just to resolving issues isn't enough to deal with the backflow. So most of the time all those security issues sit in a queue.
There's so many issues, in fact, that only the most severe issues get priority. But because resources are stretched thin any excuse to deprioritize an issue means that legitimate issues get categorized as low when they're probably sitting higher at medium or even severe. Then they'll sit on the queue, which depending on the company means they will get around to fixing it anywhere from 6 months - 2 years.
2
u/ValentineBlacker Dec 29 '23
Many companies pay outside firms to do security audits, although obviously those aren't perfect. So there is a method to find flaws besides hoping none get put there in the first place.
1
1
u/onlythehighlight Dec 30 '23
Software is mostly made by janking a whole bunch of open-source things/ideas to create a working system that gets more and more bloated. There isn't always a single repository so there is a whole bunch of different ways to write the same piece of code or the same core concept but with different business rules.
i.e. A core idea I always tell people is: when do you think a sale is completed and are you sure its the same definition for sales (closed) v finance (revenue recognised) v operations v C-level and how does that affect the systems
1
1
u/Grouchy-Ad8338 Jan 02 '24
From my experience, companies use dependencies in their code base (npm or maven dependencies in java) and each of those versions can have potential security vulnerabilities from certain versions. So, since a release can't be scheduled everyday for a version update larger orgs could have some potential security vulnerabilities until they are resolved.
1
u/Lumethys Dec 30 '23
They are called zero-day exploitation.
Im guessing you havent learn about software testing yet. But it will be abundantly clear to you that each and every piece of software that have existed and will ever exist will contains bugs and vulnerabilities. The principle of testing literally say, "testing until the allocated time is up" and never "testing until there is no more bug", because that is simply impossible
10
u/codeedog Dec 30 '23
I’ve worked as a security architect for a very large software company; one of the largest in the world. Worked in two of their largest divisions. I also assisted with the creation of their security bug response team. Written crypto code libraries for internal teams and end users. Audited applications across the other division. Helped develop security eduction campaigns to improve developer code and reduce security holes. Assisted the operational security group with analysis and detection.
I can tell you with 100% certainty that every single piece of software and hardware has security vulnerabilities. Even the ones that have been around for years and you’d think have been cleaned up.
Some developers are careful, some are well meaning, some are sloppy. It doesn’t matter. There are code scanners that can look for buffer overflows, website scanners that can white noise, black noise and fuzz their way in. You can pentest for this year’s OWASP vulnerabilities. You can lock it down tight. There will still be vulnerabilities.
Just when you think you’re fine, adversaries will engage in a timing attack by watching how long a computation takes and deduce the prime number hiding the keys. Or, flip bits in the data stream and reveal parts of a key. Information leaks from side channels.
Want to read about an amazing hack? Read this. Phenomenal bit of work. Four zero days used to do it! Adversaries are hardcore. It’s an arms race.
There are always more bugs, security and non-security alike.
Big and successful companies aren’t special, they just have more code and therefore more vulnerabilities.