Learning Library

← Back to Library

Application Security: Early Bug Detection

Key Points

  • All software inevitably contains bugs, and a portion of those bugs become security vulnerabilities, meaning virtually every application has some security risk.
  • The majority of vulnerabilities are introduced during the coding phase, with fewer being discovered later during testing and production.
  • The cost to remediate a vulnerability skyrockets the later it is found—potentially up to 640 times more expensive after release than if caught during development.
  • Implementing a security‑focused Software Development Life Cycle (SDLC) that integrates security checks early and bridges the traditional dev‑ops divide is essential to reduce bugs and lower remediation costs.

Full Transcript

# Application Security: Early Bug Detection **Source:** [https://www.youtube.com/watch?v=nthEXs12nFE](https://www.youtube.com/watch?v=nthEXs12nFE) **Duration:** 00:16:31 ## Summary - All software inevitably contains bugs, and a portion of those bugs become security vulnerabilities, meaning virtually every application has some security risk. - The majority of vulnerabilities are introduced during the coding phase, with fewer being discovered later during testing and production. - The cost to remediate a vulnerability skyrockets the later it is found—potentially up to 640 times more expensive after release than if caught during development. - Implementing a security‑focused Software Development Life Cycle (SDLC) that integrates security checks early and bridges the traditional dev‑ops divide is essential to reduce bugs and lower remediation costs. ## Sections - [00:00:00](https://www.youtube.com/watch?v=nthEXs12nFE&t=0s) **Application Security: Bug Lifecycle Overview** - The speaker explains that because all complex software contains bugs—many of which become security vulnerabilities—developers must focus on the coding phase where most flaws arise, while subsequent testing stages (unit, functional, system, and release) progressively reduce these issues. - [00:03:07](https://www.youtube.com/watch?v=nthEXs12nFE&t=187s) **From Siloed Development to DevSecOps** - The speaker contrasts a traditional, disconnected development‑operations workflow that delays security with modern DevOps and DevSecOps models that integrate continuous feedback and embed security throughout. - [00:06:12](https://www.youtube.com/watch?v=nthEXs12nFE&t=372s) **Untitled Section** - - [00:09:20](https://www.youtube.com/watch?v=nthEXs12nFE&t=560s) **Importance of Software Bill of Materials** - The speaker emphasizes using SBOMs to track component origins, versions, and dependencies—leveraging resources like OWASP—to quickly identify and remediate vulnerabilities such as those seen in the Log4J incident. - [00:12:25](https://www.youtube.com/watch?v=nthEXs12nFE&t=745s) **Dual Scanning and LLM Risks** - The speaker emphasizes using both static and dynamic scanners within a DevSecOps cycle, while noting that generative AI chatbots can aid code creation and debugging but also risk injecting vulnerabilities. - [00:15:30](https://www.youtube.com/watch?v=nthEXs12nFE&t=930s) **Preventing Repeated Application Security Errors** - The speaker reviews introducing continuous processes and tooling, leveraging OWASP guidance to break the cycle of recurring application security mistakes, and previews a forthcoming video on protecting data as the next “crown jewels” topic. ## Full Transcript
0:00Welcome back to the Cyber Security Architecture Series. 0:03In previous videos, we covered security principles, some of the foundational concepts, 0:08and then we started talking about different cybersecurity domains like identity 0:12and access management and endpoint security and network security. 0:16Today, we're going to talk about application security. 0:18So let's get started. 0:20What are some of the things that we need to consider in this? 0:22Why do we have to care, maybe, is the best question. 0:25Well, it turns out that essentially all software has bugs. 0:30Nobody writes a software of any real complexity that's error free. 0:34And it turns out that some percentage of those 0:38bugs will be security vulnerabilities. 0:41So therefore, if you follow the logical conclusion, 0:45that means essentially all software is going to have security vulnerabilities in it. 0:49So what can we do to try to reduce those and why do we need to do it? 0:54Obviously, we don't want buggy software and we don't want security issues, 0:57but this will help drive the point home a little bit, I think. 1:01If we look at the various stages of application 1:04development and look at where security 1:08or vulnerabilities in general are introduced. 1:12Think about the injection phase. 1:14It turns out that most of the vulnerabilities 1:17and bugs are introduced in the coding phase, which is not surprising. 1:21And then as we move to unit test, functional test, system test 1:24and release, then we find fewer and fewer bugs. 1:27So that's the green curve, but that's when they're introduced. 1:32When are they found? 1:33Well, they're found as we kind of move along 1:35this process. During the coding phase is when we're introducing them, but not finding them; 1:39in the testing phase, we're finding them. 1:41And then hopefully when we get to the real world, we don't find quite so many. 1:45Now the interesting thing about all of this is the cost. 1:48How does the cost go? 1:50Well, it turns out cost goes about like this, where we go from 1x 1:54as the whatever you want to base the cost to fix a bug down here in the coding phase 1:59to -- in some cases 640x. 2:03It is vastly more expensive to fix a vulnerablity 2:07once it's in the field than it is to catch it early. 2:10So there's a huge incentive for us to get this right and get it early. 2:14Now, what can we do then in order to get this done more quickly? 2:18Well, let's take a look. 2:20We're going to take a look, by the way, at this software development lifecycle. 2:24That's the SDLC. 2:25And traditionally, this is how it's been done. 2:27We have some design phase here where we're going to figure out 2:31in general what we're going to do in this particular application. 2:34And then we're going to move to a coding phase. 2:37We're going to write the application itself. 2:40Then we're going to go to some sort of testing phase. 2:42And then ultimately we release it to the world and put it in production. 2:46Now, what is traditionally happened is there's a big line separating these two--where 2:51this is the dev part of the process and this is the ops part of the process. 2:56This is where we're developing. 2:58This is where we're releasing and then just operating it and running it in a continuous state. 3:03The problem with this traditional approach is that it's very linear. 3:07You can see how this process goes. 3:10It's also very siloed. 3:11This line right here could be very thick in some organizations. 3:16And it kind of leads to this sort of “over the wall” mentality. 3:20I'm going to write the code and then I'm going to throw it over there and make them operate it. 3:24And so there's not a lot of communication happening here. 3:26It can be a slow process and it's fairly inflexible. 3:30And by the way, I'm going to suggest to you, we didn't really introduce security very early in this process. 3:35Very often security gets introduced out here, and that's a problem. 3:40Now, a more modern approach to this is this thing called DevOps. 3:45So here we take the two processes, dev, where we're building the code, 3:50then we're releasing it, we're deploying it, we're operating it, and we're feeding back. 3:54With a DevOps process, now what we've got is a cyclical type of situation. 4:00This thing doubles back on itself. 4:03There's a feedback loop of continuous improvement. 4:06There's no over the wall. There's no us versus them. 4:09It's an integrated process. 4:11It's much more rapid, and it's designed for agility. 4:15So this is a much more flexible kind of capability moving away from this traditional linear approach. 4:21But again, we haven't really addressed the security here. 4:25And so what more modern approaches have done 4:28is introduce this notion of devSecOps, where now we're going to basically bathe 4:34or encompass the whole thing in a security layer. 4:38We're going to put security at every one of these phases. 4:41We don't want this to be something that we wait to the end. 4:45Security can't be a bolt-on. 4:47That is not going to be effective. 4:49We need security to be built in and looked at at every one of these phases. 4:54So, for instance, with a devSecOps approach, we're going to do what is referred to as shift left thinking. 4:59That if you were thinking of this in a linear phase or thinking of it this way, then we're going to put security 5:05not just here, we're going to introduce security at each one of these phases. 5:09We're going to do security by design. 5:12We're going to design the system so that it stands up 5:15and it's resilient to attack from the first. 5:18Not again as a bolt-on. 5:21Then we're going to create collaboration among what have been traditionally three 5:25different groups that maybe didn't always talk together. 5:28But with devSecOps, we have it all working together with a lot of collaboration, a lot of feedback. 5:34And then ultimately try to leverage a lot of automation. 5:36I'll talk about that in terms of tooling a little bit later in the video. 5:41Okay. 5:42Now, we've covered the software development lifecycle. 5:45Next, we're going to take a look at secure coding practices and things like that. 5:48What do we need in order to write secure code? 5:51If we're going to shift security left all the way to the coding, 5:55maybe even design phase, what we're going to focus on the coding part right here. 5:58What are my needs? 6:00Well one thing I need is a list of secure coding practices. 6:04This is a prescriptive way of saying this is how we should go about writing certain code. 6:09There are certain things that we need to do. 6:12For instance, validate inputs. 6:14We need to make sure that if a buffer has been allocated for this size, for input, 6:20that when someone sends me something, it's not this big because then in that case, it could be overwriting memory. 6:26We call this a buffer overflow. 6:27So that's a type of condition that's been around for a long time. 6:30If we don't do all the input checking, we could have problems. 6:33We need to specify how we would do authentication. 6:37What are some of the other ways that we would use cryptography? 6:40What kinds of error handling routines? 6:42So it's basically a way of saying, have we checked off all of these things? 6:46Have we done them all correctly? 6:47Well, there's a great resource here. 6:50It's called owasp.org. 6:54And at this 6:55website, what you'll find is they have a list of secure coding practices. 6:58They have a very good document that is kind of an industry standard that a lot of people use in this. 7:03So I would reference that you take a look there. 7:06Trusted libraries. 7:08Everyone doesn't write all their code from scratch anymore because there's just too much that needs to be done. 7:13So as a result, we end up relying on code that's been written by other people. 7:17It might be open source, it might be proprietary, but we're going to use this 7:21in our code as well, or make calls to it and leverage it. 7:25There's a lot of sources that are out there, but not all of them are trustworthy. 7:29And even the trustworthy ones need to be 7:32looked at with a certain amount of skepticism and a certain amount of inspection. 7:37So trusted libraries are an important thing here as well. 7:40And if you want to see what can happen, even with a trusted library, 7:44go look up something called Log4J. 7:48This is a very well known vulnerability that infected tons and tons of systems 7:53because everyone was using this routine, 7:56which was a common trusted routine from trusted sources, 7:59and yet it had a vulnerability in it that an attacker could exploit. 8:03And those vulnerabilities were discovered. Guess what? 8:06Over here in this phase, right when it was the most expensive, after it had been released. 8:11So, again, we want to try to eliminate that 8:14or at least find it much earlier in the process, if we can. 8:17And using trusted sources, at least, helps. 8:20It doesn't eliminate the risk, but it helps. 8:23Standard architectures. 8:24I want to have spelled out that when we're going 8:27to do a certain approach, this is how the system should look. 8:31So we want to spell out in advance what those would look like. 8:35There's a lot of different sources for that. 8:37IBM has an Application Security Architecture Reference website that you can take a look at. 8:42We'll reference here. 8:45Also there are other sources, 8:46but you want to be able to spell this out for your whole organization so that they can see that. 8:51Mistakes to avoid. 8:52Again, we're going to go back to our friends at OWASP. 8:54They have a thing called the OWASP Top Ten list. 8:57And what's really interesting in this is they're showing what are the top ten vulnerabilities that we keep seeing. 9:03And it's very interesting to look at this over time. 9:05Look, back in 2017, what were the top ten? 9:08And look now and the more recent one, 2021? 9:12And what you'll find is there have been a little bit of shifting here, but unfortunately, 9:16it's sort of the same list, which means we're not getting better. 9:20We're not making these defects extinct. 9:23We're just kind of shuffling the order a little bit. 9:26But things like buffer overflows and other types of 9:30input validation errors have been around for a long time. 9:33But this is a great learning resource. 9:36So again, I refer you to OWASP. 9:38And then finally, this notion is really starting to build some momentum. 9:42The idea of a software bill of materials. 9:44That is, I want to know where everything came from, kind of a supply chain, if you think of it this way. 9:49I want to know all the components that I'm using. 9:52I want to know where they came from, their origins, the libraries that they came from, 9:57and where those are sourced. 9:59I want to know what dependencies exist amongst these different components and have those really spelled out. 10:05I don't want any surprises in that. 10:07I want to know the versions of all of these that I've used across all of my different systems. 10:11And if I'm building applications, I need to know which versions are used because those will change over 10:17time, need to be updated, and I need to be able to know what vulnerabilities might exist in those. 10:22Again, refer to Log4J. 10:25Go and do a web search on that if you want to find out more about that example. 10:29That's a good example where if we have a software 10:32bill of materials and we get hit by one of those vulnerabilities, 10:35then we have a much better idea of all the different places that we need to make changes 10:39and we can recover much more quickly and hopefully eliminate a certain amount of this cost. 10:45Okay. 10:46Now, we've covered the software development lifecycle, secure coding, 10:50and we're now going to take a look at vulnerability testing. 10:53We'd like to test for security throughout the process. 10:56Remember, one of the things I mentioned in the DevSecOps process is to use more automation, 11:02that is, use more tooling. 11:03And two major classes of those tools are static application security testing, SAST. 11:09And DAST: dynamic application security testing. 11:12You figured if a one was going to be static, the other was going to be dynamic, right? 11:16Okay, what's the difference in those two? 11:18Well, the static is often referred to as “white box” testing. 11:22It's called that because we can look inside and feed it the source code. 11:27So it's like it's looking inside our code. 11:30So the box is open in that sense. 11:33The black box dynamic, instead of giving it 11:36source code, we're actually obscuring what the source code is. 11:40It's going to look at an executable system. 11:43Think about it differently. 11:44In this case, we're going to do maybe after the coding phase, I can run one of these tools, 11:49I can feed my source code into it, and it will look for vulnerabilities 11:53and tell me about those, the ones that it can identify. 11:56And the great thing about that is we're moving this much earlier. 12:01We're doing a shift left in the dev process and finding those bugs 12:05at the earliest stage that they were introduced, therefore, reducing cost. 12:10Even if I can't do it in that phase, I’d 12:12at least like to catch it during one of these test phases. 12:15So it's a little bit later in the development cycle, but it's still before 12:19we hit release when everything gets super expensive. 12:23So what I'd like to do is run both of these. 12:25In other words, it's not an either/or. 12:28It's really both/and. 12:31Because there's advantages to both of these, 12:35the source code scanner will find certain types of vulnerabilities. 12:40The dynamic scanner will find other types. 12:43So you really need to use them both together and you use them throughout this process. 12:47And again, think about that cyclical devSecOps process and you can see how this would fit in 12:52and how the tools now become the enabler to do better security. 12:57One other sort of tool that's being used in this space a lot for application development. 13:01It wasn't initially thought of in that context by a lot of people, 13:05but it's really becoming popular and that is chatbots. 13:08These large language models with generative capabilities can also generate code. 13:14So a chatbot is good at generating code very quickly. 13:19You could say “write me a routine” in, say, Python 13:23that will find all the ways to make change for a dollar and it'll spit it right out just like that. 13:27So that's a nice feature that you can have the chatbot write code for you. 13:32It can also debug code. 13:34So if I've got stuck at some point 13:37during the development of some routine, I could send it into a chatbot 13:42and maybe it will find what my vulnerability is or what the bug is that I'm trying to deal with. 13:47So that's all good stuff. 13:49However, there's a downside. 13:51The downside is it could also potentially inject vulnerabilities. 13:57So that is, when we get source code back, we could inspect that. 14:01But probably you went to the chatbot because you had a lot of code 14:05you wanted it to write for you, not just 12 lines of code, because that you could have done on your own. 14:09So are you going to inspect all of that and make sure that the chatbot either 14:13didn't make a mistake that introduces a vulnerability, or 14:16maybe it's been engineered in a way or someone has hacked it 14:21and it's intentionally putting a backdoor in so that all of your data 14:25is shared out with someone else, or that malware is introduced without your knowledge. 14:29So that's a big risk. 14:30It's not necessarily a trusted source, like an open source library 14:34where we've had potentially thousands of eyes looking at it and inspecting it. 14:37In this case, it just came right straight from the source, and now you're putting it right into your code. 14:41So there's a big risk there. 14:43And another thing is, if I'm using it to do debugging, 14:46then that means I'm feeding my source code into this system. 14:50And this system might expose intellectual property. 14:53If this code I have is considered 14:56confidential, if it's a trade secret, if it's something that we might copyright. 15:01Now I've just taken that and I've given it directly to 15:04what is essentially to the Internet, potentially, because it can now take that information and learn on it. 15:09It might use it might re-use your code in some other case. 15:12There was one major company that, in fact, had that happen to them 15:16where their developers were using a chatbot to do debugging. 15:19And it turned out they were releasing their proprietary source code into the system. 15:24And the company decided that's not really what we want to be doing. 15:28So we need to stop that. 15:30OK, so that's a quick look at application security. 15:34What we've tried to cover are ways to introduce process, 15:38do a more continuous process, 15:41and use tooling in order to improve the security of our systems and leverage the best of the learning 15:47from sources like OWASP so that we don't keep making the same mistakes over and over again. 15:52It feels a lot if you've been doing security like the movie Groundhog Day, 15:56we just keep reliving the same problems over and over and over again. 16:00So let's learn from those and use those good resources to not keep doing that. 16:04So now we've covered application security. 16:07In our next video, we're going to move over to cover data security, which is the crown jewels. 16:12That's the thing that we ultimately need to protect in most of these cases. 16:16And so that you don't miss that, make sure that you hit it like, subscribe, and notify. 16:21And that way you'll catch the next video when it comes out.