Latest / CyberSecurity Summary / Secure Programming with Static Analysis
Transcript
- 0:00Speaker 1: All right, let's dive right in. Today we're going to
- 0:02Speaker 1: be getting into secure programming, specifically how to write code
- 0:06Speaker 1: that can withstand even the most persistent attacker. We're looking
- 0:11Speaker 1: at secure programming with static analysis. It's a book by
- 0:14Speaker 1: Brian Chess and Jacob West.
- 0:16Speaker 2: Yeah, it's a really interesting read. It really gets into
- 0:19Speaker 2: how to build security and right from the beginning instead
- 0:22Speaker 2: of just you know, trying to patch things up later.
- 0:24Speaker 1: Yeah. They really make a good point about secure code
- 0:26Speaker 1: not being something you just like tack on at the end.
- 0:29Speaker 1: It's it's really a whole different way of thinking.
- 0:31Speaker 2: Absolutely. Yeah. And one of the uh, I think one
- 0:33Speaker 2: of the key takeaways from the book is is this
- 0:36Speaker 2: idea of static analysis.
- 0:38Speaker 1: So for folks listening, you can think of static analysis
- 0:41Speaker 1: like having a super smart code reviewer, like always looking
- 0:45Speaker 1: over your shoulder. You know. It's it's really good at
- 0:47Speaker 1: catching those little errors that sometimes even you know, really
- 0:50Speaker 1: experienced programmers miss. But what makes these tools so effective,
- 0:55Speaker 1: Like especially when we're talking about languages like C and Java,
- 0:58Speaker 1: well both SEE and Java.
- 1:00Speaker 2: They give developers a lot of power and flexibility, which
- 1:03Speaker 2: is great, but you know, it's kind of like the
- 1:05Speaker 2: old spider man quote. With great power comes great responsibility,
- 1:10Speaker 2: especially when it comes to how memory is managed. If
- 1:13Speaker 2: you make mistakes in these areas, you can end up
- 1:15Speaker 2: with some pretty bad vulnerabilities, like the dreaded buffer overflow.
- 1:20Speaker 1: Ooh, buffer overflows that sounds that sounds scary.
- 1:23Speaker 2: They can be. Yeah. Imagine you have a container and
- 1:26Speaker 2: it's designed to only hold a certain amount of data. Well,
- 1:29Speaker 2: a buffer overflow happens when you try to put more
- 1:32Speaker 2: data in than it.
- 1:33Speaker 1: Can handle, like trying to fit ten pounds of potatoes
- 1:35Speaker 1: into a five pound sack.
- 1:37Speaker 2: Exactly. Yeah, But instead of potatoes spilling out everywhere, you
- 1:41Speaker 2: have data that's spilling over into other parts of the memory.
- 1:44Speaker 2: And this is where it gets really interesting. Especially you know,
- 1:46Speaker 2: if you're thinking like an attacker, they can actually use
- 1:49Speaker 2: this overflow to overwrite important parts of a program's memory.
- 1:53Speaker 1: Oh okay, I see how this could be bad.
- 1:55Speaker 2: It can lead to all sorts of things, crashing a program,
- 1:58Speaker 2: corrupting data. You can even potentially hijack the whole application
- 2:01Speaker 2: to run some malicious code.
- 2:03Speaker 1: Oh yikes, that sounds like a real problem.
- 2:06Speaker 2: It can be, and Chessman Wes used this really good
- 2:09Speaker 2: example in the book from open ssh. Open Ssh is
- 2:12Speaker 2: used for you know, secure remote access to servers, so
- 2:17Speaker 2: you can imagine what would happen if someone were to
- 2:19Speaker 2: find and exploit a buffer overflow in that software.
- 2:22Speaker 1: Yeah, definitely not good, not good at all.
- 2:24Speaker 2: And this's just one example. They also talk about some
- 2:26Speaker 2: cases with send mail, which is another really widely used
- 2:30Speaker 2: piece of software, and these examples show how even you know,
- 2:33Speaker 2: what might seem like a simple error can have some
- 2:35Speaker 2: pretty serious consequences.
- 2:37Speaker 1: So it's really not just about writing code that works,
- 2:40Speaker 1: but about writing code that works securely.
- 2:42Speaker 2: Right exactly, And that's where static analysis really comes in.
- 2:46Speaker 2: Static analysis tools can actually analyze your code and find
- 2:49Speaker 2: these potential buffer overflows and other vulnerabilities before they become
- 2:54Speaker 2: a real problem in the wild.
- 2:55Speaker 1: It's almost like having a security guard, you know, watching
- 3:00Speaker 1: your code and making sure no one can sneak in
- 3:01Speaker 1: through the back door. But Chess and West don't just
- 3:04Speaker 1: focus on buffer overflows in the book, right.
- 3:07Speaker 2: Right, Yeah, They actually spend a lot of time talking
- 3:10Speaker 2: about web applications, which, you know, that's an environment where
- 3:15Speaker 2: you're constantly having to deal with user input and user
- 3:19Speaker 2: input well, let's be honest, it can often be you know,
- 3:22Speaker 2: a bit of a security headache.
- 3:23Speaker 1: Oh yeah, you're right. User input that's unpredictable exactly.
- 3:27Speaker 2: You never know what you're going to get, and that's
- 3:29Speaker 2: why it's super important to validate and sanitize that input
- 3:33Speaker 2: before you do anything with it. If you don't, you
- 3:35Speaker 2: could be opening yourself up to well a whole host
- 3:38Speaker 2: of vulnerabilities like cross site scripting or EXSS.
- 3:41Speaker 1: Okay EXSS. So I've heard of this before, but I've
- 3:44Speaker 1: never really understood exactly how it works. Is this something
- 3:47Speaker 1: that you know, the average person listening should be worried about?
- 3:50Speaker 2: Oh yeah, definitely. So imagine this scenario. An attacker. Let's
- 3:56Speaker 2: say they inject some you know, bad JavaScript code into
- 3:59Speaker 2: a comment field on a website. Now, if that website
- 4:03Speaker 2: isn't properly handling the user input, you know, making sure
- 4:06Speaker 2: things are encoded properly, that malicious code could actually be
- 4:10Speaker 2: executed in the browser of you know, anyone who visits
- 4:13Speaker 2: that page.
- 4:13Speaker 1: Oh so, it's like like planting a little bomb that
- 4:15Speaker 1: goes off when someone comes across it.
- 4:17Speaker 2: It's a good analogy. Yeah, and the consequences can be
- 4:19Speaker 2: pretty bad. You can steal cookies, you can hijack accounts.
- 4:22Speaker 2: You can even redirect users to other malicious websites.
- 4:27Speaker 1: Oh, okay, EXSS is definitely something to watch out for.
- 4:30Speaker 2: For sure, Jess and West. They actually use a really
- 4:33Speaker 2: fascinating case study in the book about MySpace. So my
- 4:36Speaker 2: Space tried to block these EXSS vulnerabilities, but you know what,
- 4:39Speaker 2: clever attackers kept finding ways around their defenses.
- 4:42Speaker 1: That's kind of scary, this cat and mouse game between
- 4:45Speaker 1: developers and attackers.
- 4:46Speaker 2: Yeah, it really shows why you need to have this
- 4:48Speaker 2: proactive approach to security. You always have to be thinking
- 4:51Speaker 2: like an attacker, asking yourself, you know, how could this
- 4:54Speaker 2: be misused? And that's where static analysis tools, you know,
- 4:57Speaker 2: they can be a real life saver. They can help
- 4:59Speaker 2: you find those potential excess as vulnerabilities before they become
- 5:03Speaker 2: a real problem.
- 5:04Speaker 1: So it's really about catching these problems early on, before
- 5:07Speaker 1: they can do any damage.
- 5:09Speaker 2: Exactly. Yeah. But let's shift gears for a minute and
- 5:13Speaker 2: talk about something that might seem a little less exciting.
- 5:16Speaker 2: Let's talk about passwords and secrets.
- 5:18Speaker 1: Ah, passwords, those little strings of characters that cause so
- 5:22Speaker 1: many problems.
- 5:23Speaker 2: They really can. Yeah. Yeah, And one of the biggest
- 5:26Speaker 2: mistakes developers make is hard coding passwords right into their code.
- 5:31Speaker 1: Okay, yeah, I can see how that wouldn't be good.
- 5:33Speaker 2: Yeah, it's like leaving your house key under the doormat.
- 5:35Speaker 2: If someone can access your code, well they've got your passwords.
- 5:38Speaker 2: It's that easy. And actually, Chess and West highlight this
- 5:40Speaker 2: real world example in the book, a system that was
- 5:43Speaker 2: written in Java that got this wrong. Their passwords were
- 5:46Speaker 2: exposed for anyone to see.
- 5:48Speaker 1: Okay, yeah, that's definitely something to avoid. So what's the
- 5:52Speaker 1: right way to handle passwords?
- 5:54Speaker 2: Well, there's some best practices, but that the key is
- 5:57Speaker 2: to never store passwords directly in your code. Instead, you
- 6:00Speaker 2: should use secure hashing algorithms, so, you know, store passwords
- 6:04Speaker 2: in a way that makes them almost impossible to reverse engineer.
- 6:08Speaker 1: Hm hmm okay, so no ah, head and keys under
- 6:11Speaker 1: the doormat, got it? What about what about systems that
- 6:15Speaker 1: already have a lot of you know, power and access.
- 6:18Speaker 2: That's a really good point. And Chess and West they
- 6:20Speaker 2: dedicate a whole chapter to privileged programs. These are programs
- 6:24Speaker 2: that you know, have special access, like the root user
- 6:27Speaker 2: on Linux. If these programs get compromised, well, the damage
- 6:31Speaker 2: can be pretty significant.
- 6:33Speaker 1: It's like giving someone, you know, the master key to
- 6:35Speaker 1: your whole house.
- 6:36Speaker 2: Exactly. Yeah, that's why the principle of these privilege is
- 6:38Speaker 2: so important. You only want to give programs the access
- 6:42Speaker 2: that they absolutely need, nothing more. They have some great
- 6:45Speaker 2: examples in the book about about how dropping privileges, like
- 6:50Speaker 2: you know, running program as a less privileged user can
- 6:54Speaker 2: help to limit the damage if an attack does happen.
- 6:56Speaker 1: Oh, that's that's interesting. It's kind of like like having
- 6:59Speaker 1: different keys for different rooms in your house. Like I
- 7:02Speaker 1: wouldn't give you a guest the key to your safe,
- 7:05Speaker 1: would you, right?
- 7:06Speaker 2: Exactly. It's all about limiting, you know, the potential damage.
- 7:09Speaker 2: And this applies to software too. When you limit the
- 7:11Speaker 2: privileges of your programs, you make it a lot harder
- 7:14Speaker 2: for an attacker to get access to your whole system.
- 7:16Speaker 1: So we've talked about buffer overflows, We've talked about EXSS,
- 7:20Speaker 1: we've talked about passwords, the importance of limiting privileges. Seems
- 7:23Speaker 1: like there's a lot to think about when it comes
- 7:25Speaker 1: to writing secure code.
- 7:27Speaker 2: There is. Yeah, But the good news is static analysis
- 7:31Speaker 2: tools can help with all of this. They can, you know,
- 7:34Speaker 2: analyze your code for these vulnerabilities and even give you
- 7:37Speaker 2: some advice on how to fix them.
- 7:39Speaker 1: So these tools aren't just about finding the problems. They
- 7:41Speaker 1: actually help you solve.
- 7:42Speaker 2: Them too, exactly. They're like a security consultant built right
- 7:46Speaker 2: into your development process.
- 7:47Speaker 1: Okay, that makes sense.
- 7:48Speaker 2: And then the next part of our deep dive, we're
- 7:50Speaker 2: going to actually see some of these tools in action.
- 7:52Speaker 1: That's good.
- 7:53Speaker 2: Well, we'll walk through how these tools actually work. You know,
- 7:56Speaker 2: how they build models of your code, trace data flow,
- 8:01Speaker 2: and use rules to find those those tricky problems.
- 8:05Speaker 1: Okay, yeah, I'm excited for that.
- 8:06Speaker 2: And you know it's it's not magic, but it's it's
- 8:10Speaker 2: pretty close.
- 8:11Speaker 1: It's pretty cool, it really is.
- 8:13Speaker 2: Okay. So we've talked a lot about, you know, why
- 8:15Speaker 2: secure programming is so important, but now let's get into
- 8:19Speaker 2: the how. How can we actually use these static analysis
- 8:22Speaker 2: tools to find those vulnerabilities that might be hiding in
- 8:26Speaker 2: our code.
- 8:26Speaker 1: Yeah, let's let's get into it. I'm ready to put
- 8:29Speaker 1: on my detective hat and start hunting for bugs.
- 8:31Speaker 2: All right. Well, the first thing to remember is static
- 8:34Speaker 2: analysis tools they're not magic. You know, they need a
- 8:37Speaker 2: little bit of help to know what to look for,
- 8:39Speaker 2: and that's where rules come in.
- 8:41Speaker 1: Rules like a set of instructions that tell the tool
- 8:44Speaker 1: you know, hey, this is a potential problem exactly.
- 8:47Speaker 2: And the cool thing about these rules is you can
- 8:49Speaker 2: customize them so you know, they fit your your specific
- 8:52Speaker 2: needs how you code. You can define rules to make
- 8:54Speaker 2: sure everyone's following coding standards. You can identify common security problems,
- 8:58Speaker 2: and you can even model how how you know external
- 9:01Speaker 2: libraries behave Oh.
- 9:02Speaker 1: Okay, so it's not just like one size fits all.
- 9:05Speaker 1: You can actually make the analysis specific to your project
- 9:08Speaker 1: and environment exactly.
- 9:10Speaker 2: And one of the one of the most powerful and
- 9:13Speaker 2: common types of rules is what we call taint propagation rules.
- 9:17Speaker 1: Taint propagation Okay, now that that sounds interesting. What's that
- 9:21Speaker 1: all about?
- 9:22Speaker 2: So imagine you're you're tracking a drop of ink as
- 9:24Speaker 2: it spreads through water. Yeah, taint propagation rules. They work
- 9:27Speaker 2: in a similar way. They let you track how potentially
- 9:32Speaker 2: dangerous data or like tainted data moves through your program.
- 9:36Speaker 1: Okay, So so if you have you know, user input
- 9:40Speaker 1: coming into your program, which we know can be a
- 9:41Speaker 1: bit unpredictable, you can like tag it as tainted and
- 9:45Speaker 1: then see where it goes exactly.
- 9:47Speaker 2: And if that if that tainted data ends up reaching
- 9:50Speaker 2: you know, some sensitive operation like writing to a file
- 9:53Speaker 2: or executing a system command. Then the tool can be like, hey,
- 9:57Speaker 2: wait a minute, this this might be a problem.
- 9:59Speaker 1: So, like, if you have tainted data that ends up
- 10:02Speaker 1: in a SQL query without being checked properly, that would
- 10:07Speaker 1: be a red flag for SQL injection.
- 10:08Speaker 2: Right, you got it, And that's just one example. Tained
- 10:11Speaker 2: propagation rules can be used to find a ton of
- 10:14Speaker 2: different vulnerabilities cross sight scripting, command injection, path traversal attacks,
- 10:20Speaker 2: you name it.
- 10:20Speaker 1: Wow, So it's almost like you have a security camera
- 10:23Speaker 1: that's following that data around making sure it doesn't end
- 10:26Speaker 1: up somewhere it's not supposed to be.
- 10:27Speaker 2: Yeah, that's a great way to put it. But tained
- 10:29Speaker 2: propagation rules there's just one piece of the puzzle. You
- 10:31Speaker 2: also have structural rules. These rules they look at the
- 10:35Speaker 2: overall structure of your code, so they're looking.
- 10:37Speaker 1: For patterns that could indicate a vulnerability even if there's
- 10:40Speaker 1: no tainted data involved exactly.
- 10:44Speaker 2: So, for example, a structural rule might flag the use
- 10:48Speaker 2: of like a dangerous function like strecb in C that
- 10:54Speaker 2: function is notorious for buffer overflows, or you know, it
- 10:57Speaker 2: might check to see if you have empty catch blocks
- 11:00Speaker 2: in Java, which can actually hide errors and lead to vulnerabilities.
- 11:04Speaker 1: So it's like having a building inspector come in and
- 11:06Speaker 1: make sure the foundation of your code is solid.
- 11:08Speaker 2: Oh like that analogy, And then you have configuration rules.
- 11:12Speaker 2: Those are used to model, you know, how your environment
- 11:14Speaker 2: behaves and how external systems work.
- 11:16Speaker 1: Okay, so if you're using a specific framework or library,
- 11:20Speaker 1: you can actually create rules that define how it interacts
- 11:23Speaker 1: with your code and what kind of security risks there
- 11:25Speaker 1: might be precisely.
- 11:26Speaker 2: And that helps to make sure that the results you
- 11:28Speaker 2: get from your static analysis are tailored to your specific
- 11:32Speaker 2: environment and how you code things.
- 11:33Speaker 1: So we've got all these different kinds of rules working
- 11:35Speaker 1: together to give us this comprehensive security analysis. What happens next, Like,
- 11:42Speaker 1: once the tool has analyzed all the code, what do
- 11:45Speaker 1: we see?
- 11:46Speaker 2: Well, the tool will generate a report, and that report
- 11:50Speaker 2: highlights any potential vulnerabilities. It's dound. But let's be honest,
- 11:54Speaker 2: sometimes these reports can be a bit overwhelming, especially for
- 11:58Speaker 2: you know, for larger projects.
- 12:00Speaker 1: Yeah, I can imagine. It's like trying to drink from
- 12:02Speaker 1: a fire hose. How do you even start to make
- 12:05Speaker 1: sense of it all and figure out what to focus
- 12:07Speaker 1: on first.
- 12:08Speaker 2: That's where a really good static analysis tool, that's where
- 12:11Speaker 2: it really shines. A good tool, it'll give you clear,
- 12:13Speaker 2: concise reports, it'll highlight the most critical vulnerabilities, and it
- 12:16Speaker 2: will help you understand you know, how bad each finding
- 12:20Speaker 2: is and what kind of impact it could have.
- 12:22Speaker 1: So it's not just about giving you a list of problems.
- 12:25Speaker 1: It's about giving you some context and some actionable insights exactly.
- 12:29Speaker 2: The tool should help you understand why a particular piece
- 12:33Speaker 2: of code is being flagged. You know, how could it
- 12:35Speaker 2: be exploited, what steps can you take to fix it.
- 12:38Speaker 2: It might even suggest like specific code changes or best
- 12:42Speaker 2: practices to follow.
- 12:43Speaker 1: So it's almost like having a security expert sitting next
- 12:47Speaker 1: to you, walking you through the results and helping you
- 12:50Speaker 1: understand what to do next.
- 12:52Speaker 2: Yeah, that's a great way to think about it. And
- 12:54Speaker 2: the more you use these static analysis tools, the better
- 12:57Speaker 2: you get at, you know, spotting and fixing potential problems
- 13:01Speaker 2: early on in the development process, which can save you
- 13:03Speaker 2: a lot of time and headaches later down the road.
- 13:05Speaker 1: Okay, so let's say we've run our analysis, we've got
- 13:08Speaker 1: our report, and we're ready to start, you know, digging
- 13:10Speaker 1: in and looking at the findings. What what are some
- 13:13Speaker 1: things we should be looking for? What are the key things?
- 13:15Speaker 2: Okay, well, one of the most important things is to
- 13:17Speaker 2: understand how serious each vulnerability is, because you know, not
- 13:22Speaker 2: all vulnerabilities are created equal. Some are a lot riskier
- 13:25Speaker 2: than others.
- 13:26Speaker 1: Yeah, that makes sense. Like a buffer overflow that could
- 13:29Speaker 1: you know, let someone execute code remotely. That's a much
- 13:31Speaker 1: bigger dale than you know, some minor coding style issue.
- 13:36Speaker 1: So how do how do we prioritize these findings?
- 13:39Speaker 2: Most tools use a bunch of factors to assess the severity,
- 13:44Speaker 2: you know, like what kind of vulnerability is it, what
- 13:46Speaker 2: could the impact be, and how likely is it that
- 13:49Speaker 2: someone could actually exploit it. They usually assign each finding
- 13:52Speaker 2: a level like critical, high, medium, or low.
- 13:55Speaker 1: Okay, so you should probably focus on those critical and
- 13:58Speaker 1: high ones first, right.
- 13:59Speaker 2: Absolutely, But you also need to understand the context of
- 14:03Speaker 2: each vulnerability. Like a low severity vulnerability in a really
- 14:07Speaker 2: critical system I might still need attention, while a high
- 14:11Speaker 2: severity vulnerability to the system that's not that important might
- 14:14Speaker 2: not be as much of a priority.
- 14:16Speaker 1: Okay, so severity is important, but we also need to
- 14:19Speaker 1: think about the bigger picture. What else should we be
- 14:21Speaker 1: looking at.
- 14:22Speaker 2: You should also pay attention to the confidence level that's
- 14:24Speaker 2: assigned to each finding.
- 14:26Speaker 1: Confidence level, what exactly does that mean?
- 14:29Speaker 2: It's basically how certain the tool is that the finding
- 14:33Speaker 2: is actually a real vulnerability. Static analysis tools are they're
- 14:37Speaker 2: really smart, but they're they're not perfect. Okay. Yeah, Sometimes
- 14:42Speaker 2: they can flag something as a vulnerability when it's actually
- 14:45Speaker 2: not a problem. Those are called false positives.
- 14:47Speaker 1: So a high confidence finding means it's more likely to
- 14:51Speaker 1: be a real vulnerability than a low confidence finding.
- 14:54Speaker 2: Exactly. And a good tool will give you information to
- 14:58Speaker 2: help you decide how much you can trust each finding.
- 15:00Speaker 1: Okay, so we're looking at severity, context, confidence level, anything else.
- 15:05Speaker 1: To keep in mind, you should.
- 15:07Speaker 2: Also take a look at the recommendations the tool gives
- 15:09Speaker 2: you for fixing each vulnerability.
- 15:11Speaker 1: Oh so, so the tool doesn't just tell you what's wrong,
- 15:14Speaker 1: it actually gives you some guidance on how to fix
- 15:16Speaker 1: it exactly.
- 15:17Speaker 2: Yeah, and those recommendations could be anything from like simple
- 15:20Speaker 2: code changes to more more complicated architectural modifications.
- 15:25Speaker 1: Okay, so it's not just leaving you hanging, it's it's
- 15:27Speaker 1: giving your roadmap for how to fix things.
- 15:29Speaker 2: Right. But before you go and start changing your code,
- 15:33Speaker 2: it's really important to validate each finding and make sure
- 15:36Speaker 2: it's a real vulnerability.
- 15:38Speaker 1: Ah, So we need to do some manual checking before
- 15:41Speaker 1: we start hacking away at our code.
- 15:43Speaker 2: You got it. Static analysis tools are they're powerful, but
- 15:47Speaker 2: they're not perfect. You know. They can have those false
- 15:50Speaker 2: positives and sometimes they might even miss real vulnerabilities.
- 15:54Speaker 1: So even with these really sophisticated tools, we still need
- 15:57Speaker 1: to use our own judgment and expertise.
- 16:00Speaker 2: Absolutely, and that's exactly what we're going to do in
- 16:02Speaker 2: the next part of our deep dives. We're going to
- 16:04Speaker 2: take all of this knowledge. We're going to analyze some
- 16:06Speaker 2: sample code with a real static analysis. Cool.
- 16:09Speaker 1: Okay, I'm really looking forward to seeing these tools and action.
- 16:12Speaker 1: So stay tuned, folks, we'll be right back to explore
- 16:15Speaker 1: the world of real world code analysis. Okay, So we've
- 16:20Speaker 1: we've talked about all the theory, we've looked at the tools,
- 16:23Speaker 1: but now it's time to actually see static analysis in action.
- 16:26Speaker 1: You know, roll our sleeves and get our hands a
- 16:29Speaker 1: little dirty.
- 16:30Speaker 2: Absolutely. Yeah, let's dive into some real coat and see
- 16:33Speaker 2: what we can find.
- 16:33Speaker 1: All right, So for this, for this little demonstration, We've
- 16:37Speaker 1: got a simple Java web application. It's a it's basically
- 16:40Speaker 1: a log in system. But you know, as we all know,
- 16:43Speaker 1: even even simple systems can have can have hidden vulnerabilities.
- 16:48Speaker 2: Oh yeah, definitely. You don't need complexity to have security flaws,
- 16:51Speaker 2: that's for sure. So for this deep dive, we're going
- 16:53Speaker 2: to be using a pretty popular commercial static analysis tool.
- 16:57Speaker 2: It's called Fortify Source Code Analyzer or Fortify s c A.
- 17:02Speaker 1: For sure SCA. All right, so how does this How
- 17:06Speaker 1: does this all work? Do we just like point Fortify
- 17:08Speaker 1: at our code and let it do its thing?
- 17:10Speaker 2: Pretty much? Yeah, We feed the source code into Fortify
- 17:12Speaker 2: s c A and then it goes to work. It
- 17:15Speaker 2: analyzes the code based on a set of you know,
- 17:17Speaker 2: predefined rules and configurations.
- 17:19Speaker 1: So it's kind of like setting a bloodhound on the
- 17:22Speaker 1: trail of a cent, except in this case, the scent
- 17:25Speaker 1: is vulnerabilities.
- 17:26Speaker 2: Huh Yeah, I like that analogy. Fortify SCA sniffs out
- 17:29Speaker 2: those weaknesses in the code, and and once the analysis
- 17:33Speaker 2: is completed, it gives us a report that highlights any
- 17:36Speaker 2: potential issues that is found.
- 17:37Speaker 1: Okay, all right, so let's see what this security bloodhound
- 17:42Speaker 1: can dig up. What kind of vulnerabilities are we are
- 17:44Speaker 1: we hoping to find here?
- 17:46Speaker 2: Well, I mean, based on what we've talked about, SQL
- 17:49Speaker 2: injection is always a big concern with with web applications,
- 17:53Speaker 2: especially those dealing with you know, user logins.
- 17:55Speaker 1: Right, sql injection the villain that always seems to come back.
- 18:00Speaker 2: So let's let's see a fortify s c A can
- 18:02Speaker 2: spot any any potential SQL injection vulnerabilities in our login
- 18:08Speaker 2: system here? All right, okay, so it looks like fortifyica
- 18:11Speaker 2: is found something. It's flagged dis section of code where
- 18:14Speaker 2: the where the log in system is building a SQL
- 18:17Speaker 2: query using string concatenation.
- 18:19Speaker 1: Oh okay, that's a that's a classic red flag for
- 18:22Speaker 1: SQL injection, right, Like, if you're you're directly putting user
- 18:25Speaker 1: input into the query without shading it properly. It's it's
- 18:28Speaker 1: basically like leaving the door wide open for an attacker.
- 18:31Speaker 2: Exactly. Yeah, an attacker could could manipulate that user input,
- 18:34Speaker 2: change the SQL query and and potentially gain access to
- 18:37Speaker 2: the database.
- 18:38Speaker 1: Oh that's not.
- 18:38Speaker 2: Good, not good at all. And uh and that's exactly
- 18:41Speaker 2: what fortify s c A is designed to catch. It's
- 18:44Speaker 2: it's following that user input or that tainted data as
- 18:47Speaker 2: we call it, and it flags any instances where that
- 18:50Speaker 2: data reaches you know, sensitive operation, like like a database query.
- 18:54Speaker 1: So it's like, uh, fortify s c A is playing
- 18:57Speaker 1: a game of connect the dots, you know, between the
- 18:59Speaker 1: user input put and the and the potential point of attack.
- 19:03Speaker 2: Yeah, that's a that's a great way to put it.
- 19:05Speaker 2: And in this case, it's it's definitely found a potential
- 19:07Speaker 2: SQL injection vulnerability.
- 19:09Speaker 1: Okay, sql injection check. What what else has fortify s
- 19:13Speaker 1: c A found.
- 19:14Speaker 2: It looks like it's also uh flagged a potential cross
- 19:17Speaker 2: site scripting.
- 19:18Speaker 1: Vulnerability right xss. That's where attackers inject malicious code into
- 19:23Speaker 1: a website, right, hoping to compromise other users exactly.
- 19:26Speaker 2: And it looks like in this case, Fortify s c
- 19:29Speaker 2: A has found that the log in system is displaying
- 19:31Speaker 2: user input without without properly encoding the output.
- 19:35Speaker 1: So if an attacker were to inject say some some
- 19:38Speaker 1: malicious JavaScript code into I don't know, like a username
- 19:42Speaker 1: field it, it could potentially be executed in the browser
- 19:46Speaker 1: of anyone who who've used that data.
- 19:48Speaker 2: Exactly, And and fortify s c A is able to
- 19:50Speaker 2: find this by by analyzing how that how that data
- 19:53Speaker 2: is being handled before it's before it's shown to the user.
- 19:56Speaker 2: It's looking for any instances where that that data might
- 19:59Speaker 2: be into interpreted as code rather than just plain text.
- 20:03Speaker 1: So it's not just looking for you know, bad code.
- 20:05Speaker 1: It's it's looking for code that that could be misused
- 20:07Speaker 1: or misinterpreted in a way that could cause harm exactly.
- 20:11Speaker 2: It's it's about understanding, you know, what could happen based
- 20:14Speaker 2: on how data is handled and displayed within an application.
- 20:17Speaker 1: Okay, so sql injection, XSS, anything else.
- 20:21Speaker 2: See, it looks like fortify Sea has has one more
- 20:24Speaker 2: trick up its sleeve. It's it's flagged a potential hard
- 20:27Speaker 2: coded password vulnerability.
- 20:28Speaker 1: Oh ouch, Yeah, that's that's definitely a rooky mistake. But
- 20:31Speaker 1: you'd be surprised how often it happens.
- 20:33Speaker 2: You're absolutely right, it happens more often than you'd think.
- 20:37Speaker 2: You know, sometimes developers take shortcuts, especially when they're you know,
- 20:40Speaker 2: just developing and testing things. They hardcode credentials because it's
- 20:44Speaker 2: it's convenient. But you know, as we've talked about, convenience
- 20:47Speaker 2: can often come at the cost of security.
- 20:50Speaker 1: Yeah, for sure, hard coding passwords right into your source
- 20:53Speaker 1: code is like it's like taping a spare key to
- 20:55Speaker 1: your front door. Anyone who can who can get to
- 20:57Speaker 1: that code, Well, they've got your passwords.
- 21:00Speaker 2: That's that's a great analogy. And fortify s c A
- 21:03Speaker 2: can find this kind of vulnerability by by looking for
- 21:07Speaker 2: specific patterns in the code, you know, like like strings
- 21:10Speaker 2: that that look like passwords or or encryption keys.
- 21:13Speaker 1: So it's like a it's like fortify c A is
- 21:15Speaker 1: a code detective examining every line looking for clues that
- 21:20Speaker 1: might might point to a security risk.
- 21:23Speaker 2: I like that, And and the best part is this
- 21:25Speaker 2: is all happening automatically. It's a it's saving us hours
- 21:28Speaker 2: and hours of manual code review.
- 21:30Speaker 1: That's amazing. Okay, so we've got our list of potential
- 21:33Speaker 1: vulnerabilities thanks to fortify s c A. What happens next, Well,
- 21:38Speaker 1: now it's.
- 21:38Speaker 2: Time to roll up our sleeves and start fixing these vulnerabilities.
- 21:43Speaker 2: Fortify s c A will usually give you some recommendations
- 21:47Speaker 2: for for how to fix things. It might suggest some
- 21:49Speaker 2: specific code changes or or some security best practices to follow.
- 21:54Speaker 1: So it's not it's not just pointing fingers, it's actually
- 21:57Speaker 1: offering solutions as well.
- 21:59Speaker 2: Exactly, It's like that that helpful friend who you know,
- 22:03Speaker 2: not only points out that you got a stain on
- 22:04Speaker 2: your shirt, but also offers to help you clean it up.
- 22:07Speaker 1: I like that. It's all about, uh, you know, being
- 22:09Speaker 1: proactive and addressing these vulnerabilities before before someone else.
- 22:13Speaker 2: Can exploit them exactly. And and that's that's the power
- 22:17Speaker 2: of static analysis. It lets us shift security left. We
- 22:20Speaker 2: can catch these problems early on in development when they're
- 22:23Speaker 2: when they're easier and cheaper to fix.
- 22:25Speaker 1: Okay, that makes sense. So as as we wrap up this, uh,
- 22:29Speaker 1: this deep dive into secure programming with static analysis, what
- 22:32Speaker 1: are some key takeaways for our listener?
- 22:35Speaker 2: I think the biggest takeaway is that security it's it's
- 22:38Speaker 2: not something you add on at the end. It's it's
- 22:40Speaker 2: got to be part of the development process from from
- 22:43Speaker 2: the very beginning. And static analysis tools like like fortify,
- 22:47Speaker 2: s c A, they're they're invaluable in helping us, you know,
- 22:50Speaker 2: build more secure and resilient software.
- 22:52Speaker 1: Absolutely, we've we've seen how these tools can you find
- 22:56Speaker 1: hidden vulnerabilities, give us some really actionable insights and even
- 22:59Speaker 1: even help us come up with solutions.
- 23:02Speaker 2: And uh, and remember, you know, the best defense is
- 23:05Speaker 2: a good offense. By by being proactive about security and
- 23:09Speaker 2: using these these powerful tools, we can stay ahead of,
- 23:12Speaker 2: you know, the people who are trying to exploit our systems.
- 23:14Speaker 1: That's that's great advice. Well, I think that brings our
- 23:17Speaker 1: deep dive to a close. Thanks for joining us on
- 23:20Speaker 1: this journey. And remember keep learning, keep coding and UH
- 23:24Speaker 1: and keep those security flags flying high.