Latest / CyberCode Academy / Course 7 - Secure SDLC (Software Development Life Cycle) | Episode 3: Defining, Implementing 20 Controls, and Mitigating OWASP Top 10 in SDL
Transcript
- 0:00Speaker 1: When you think about building a powerful digital system, an application,
- 0:04Speaker 1: a major service overhaul, your mind probably jumps straight to features.
- 0:08Speaker 1: How fast is it? What does it do? But before
- 0:11Speaker 1: you write the first line of code focused on functionality,
- 0:14Speaker 1: you have to think about the foundations that keep that
- 0:16Speaker 1: entire system safe and sound.
- 0:18Speaker 2: Precisely, if we look at software development like architecture, the
- 0:23Speaker 2: feature set is the beautiful skyscraper, but the security requirements
- 0:28Speaker 2: are the concrete foundations laid deep into the.
- 0:30Speaker 1: Earth, and if that foundation is weak, the whole thing
- 0:33Speaker 1: comes down.
- 0:33Speaker 2: Everything else fails. Today we are deep diving into that
- 0:37Speaker 2: critical planning phase of the secure software development life cycle,
- 0:42Speaker 2: focusing on the security blueprint itself, the secure requirements.
- 0:46Speaker 1: This is so critical. This isn't about bolting on security
- 0:49Speaker 1: features at the end, which is I guess, the architectural
- 0:52Speaker 1: equivalent of just painting over rust exactly.
- 0:54Speaker 2: We are looking at the blueprint that ensures a system
- 0:56Speaker 2: meets specific security attributes and maintain user trust right from
- 1:01Speaker 2: the very start.
- 1:02Speaker 1: So it's our mission today.
- 1:03Speaker 2: Our mission is pretty straightforward. We've identified twenty essential security
- 1:07Speaker 2: requirements that, when they're baked into the planning process, drastically
- 1:11Speaker 2: minimize future vulnerabilities. We're going to unpack these twenty steps
- 1:15Speaker 2: and show you exactly how they connect to the big
- 1:18Speaker 2: hitters of application weakness like the OASP top ten.
- 1:21Speaker 1: Okay, let's unpack this. Then, What exactly defines a secure
- 1:25Speaker 1: requirement and why is doing this step before any code
- 1:28Speaker 1: is written so fundamentally important?
- 1:30Speaker 2: Well, secure requirement is simply a mandated security feature. It
- 1:34Speaker 2: could be functional like having a login screen, or non
- 1:37Speaker 2: functional like performance standards that the system must satisfy to
- 1:40Speaker 2: achieve its overall security goals. And the timing, well, the
- 1:44Speaker 2: timing is everything.
- 1:45Speaker 1: And why is that timing so critical to you the builder?
- 1:48Speaker 2: Because integrating security at the requirements phase minimizes costly interruptions
- 1:53Speaker 2: later on. I mean, you're talking about avoiding massive design changes,
- 1:57Speaker 2: code overhauls, merging nightmares, and tesking delays on the road.
- 2:00Speaker 2: It's just it's so much more efficient.
- 2:03Speaker 1: It's that old saying an ounce of prevention is worth
- 2:05Speaker 1: a pound of cure.
- 2:06Speaker 2: Think about that skyscraper analogy again. Finding a structural weakness
- 2:10Speaker 2: on paper costs sense. Finding it after the concrete is
- 2:14Speaker 2: poured costs millions. Since the secure development life cycle is
- 2:18Speaker 2: a feed forward process, meaning errors you introduced early, just
- 2:22Speaker 2: spread exponentially. Getting this requirements phase right is paramount.
- 2:28Speaker 1: So these requirements don't just come from thin air. Right.
- 2:30Speaker 1: They're influenced by a whole bunch of factors.
- 2:33Speaker 2: Absolutely, They're driven by external forces like legal mandates think
- 2:37Speaker 2: GDPR or high pay, industry standards, internal coding practices, and crucially,
- 2:42Speaker 2: they have to reflect lessons learned from previous security incidents
- 2:46Speaker 2: and known threats.
- 2:47Speaker 1: So these are of a dual purpose, then that's a.
- 2:49Speaker 2: Great way to put it. They clearly reflect core security objectives.
- 2:52Speaker 2: For example, the system must maintain the confidentiality of all
- 2:56Speaker 2: sensitive PII. And they provide a clear roadmap for every
- 2:59Speaker 2: single day developer on the team.
- 3:01Speaker 1: And that's second part the roadmap. Yeah, it forces team alignment,
- 3:05Speaker 1: doesn't it. Yeah. You have to bring business stakeholders, developers,
- 3:07Speaker 1: and security experts together early to agree on what's sensitive
- 3:10Speaker 1: and what the business consequences of a flaw would be.
- 3:13Speaker 2: If you don't align there, you're just setting yourself up
- 3:15Speaker 2: for failure. Now let's jump into the first cluster of requirements,
- 3:20Speaker 2: the core protection mechanisms that address the most basic yet
- 3:23Speaker 2: most widespread attack vectors.
- 3:26Speaker 1: This feels like where the system meets the outside world,
- 3:29Speaker 1: so it's probably the most vulnerable spot.
- 3:31Speaker 2: It is. The very first foundational requirement is to implement
- 3:34Speaker 2: robust data input validation. Failure to properly server side validate
- 3:39Speaker 2: input from untrusted sources is arguably the single most common
- 3:43Speaker 2: application weakness. This is the direct entry point for injection flaws,
- 3:47Speaker 2: cross site scripting, and denial of service attacks.
- 3:50Speaker 1: So, practically speaking, how do we lock down that input field?
- 3:53Speaker 1: What does that look like?
- 3:54Speaker 2: You must validate based on the expected data type and
- 3:57Speaker 2: range like character length. But critically we recommend using a
- 4:00Speaker 2: whitelisting technique, defining precisely what characters are allowed over blacklifting,
- 4:05Speaker 2: which is trying to guess what bad input looks like.
- 4:08Speaker 1: Blacklisting feels like a game of Whack a mole. You're
- 4:10Speaker 1: always playing ketchup you are.
- 4:12Speaker 2: Whitelisting is more like having a velvet rope. Only the
- 4:15Speaker 2: known good things get in.
- 4:17Speaker 1: And of course, since client side validation can be trivially bypassed,
- 4:20Speaker 1: we always enforce that check on the server.
- 4:22Speaker 2: Side, always, every single time. Moving on, our next crucial
- 4:26Speaker 2: step addresses the back end. Implement strong database security controls
- 4:31Speaker 2: the key action here. Even if you're using modern persistence
- 4:34Speaker 2: layers like Hibernate is to use parameterized queries.
- 4:38Speaker 1: Why are dynamic sequel queries so dangerous? I feel like
- 4:41Speaker 1: we hear about this all the time.
- 4:42Speaker 2: Because dynamic queries mix the database command with the potentially
- 4:46Speaker 2: malicious user data. It creates a direct path for SQL injection.
- 4:50Speaker 2: Parameterized queries, on the other hand, enforce a clean separation
- 4:54Speaker 2: of the command from the data.
- 4:55Speaker 1: That makes sense, and.
- 4:56Speaker 2: The system also needs to ensure the application connects to
- 4:58Speaker 2: the database using the lower most possible level of privilege
- 5:01Speaker 2: required for its job. Least privilege is key.
- 5:04Speaker 1: And our third core requirement handles file uploads, which is
- 5:07Speaker 1: a massive headache for so many organizations. Implement strong file
- 5:11Speaker 1: upload validation. I imagine this goes far beyond just checking
- 5:15Speaker 1: the file extension.
- 5:15Speaker 2: Oh. Absolutely, authentication is non negotiable before any file upload.
- 5:20Speaker 2: You have to prevent anonymous, malicious uploads. You must limit
- 5:24Speaker 2: file types and validate them not just by extension, but
- 5:27Speaker 2: by checking the fileheader, the true marker of what the
- 5:30Speaker 2: file actually is.
- 5:31Speaker 1: Checking the fileheader. That sounds like a complex step that
- 5:34Speaker 1: a development team might skip if they're pressed for time.
- 5:38Speaker 1: Is that where people cut corners?
- 5:39Speaker 2: It can be, but the consequence of skipping it is huge.
- 5:42Speaker 2: And here's the crucial architectural step. You must never store
- 5:46Speaker 2: the uploaded file in the same web context as the
- 5:49Speaker 2: running application.
- 5:49Speaker 1: Sure you isolate it.
- 5:50Speaker 2: You isolate it, use index values map to pre defined
- 5:54Speaker 2: secure storage paths. That architectural isolation protects the application. If
- 5:59Speaker 2: a delicious file does manage to slip through.
- 6:02Speaker 1: That's fantastic advice. Yeah, okay, Now we're transitioning into a
- 6:05Speaker 1: cluster of requirements. Focus entirely on who the user is
- 6:07Speaker 1: and what they can do, identity access and session management.
- 6:11Speaker 2: Correct, this is all about mitigating what we call broken
- 6:14Speaker 2: authentication vulnerabilities. We have a heavy focus on protecting credentials here.
- 6:19Speaker 2: We demand strong password policies, mandate centralized authentication like active
- 6:24Speaker 2: directory or LDP, and.
- 6:26Speaker 1: Of course multi factor authentication MFA and single sign on
- 6:30Speaker 1: sso right, especially for the important.
- 6:33Speaker 2: Stuff for critical, high risk applications. Absolutely, these aren't just
- 6:36Speaker 2: nice to haves anymore. They are prerequisites for securing your
- 6:39Speaker 2: high value assets.
- 6:40Speaker 1: And what about when our application needs to communicate with
- 6:43Speaker 1: other systems like those databases or external services.
- 6:46Speaker 2: Those external credentials must be encrypted at rest, meaning when
- 6:50Speaker 2: they're stored and config files or key vaults, and they
- 6:52Speaker 2: must never ever be stored directly in source code. We
- 6:56Speaker 2: also require enabling crucial HTTP security headers to prevent typical
- 7:01Speaker 2: web based broken authentication methods, which.
- 7:03Speaker 1: Brings us to requirement number nine, which is session management.
- 7:06Speaker 1: The user is logged in, how do we protect that connection.
- 7:09Speaker 2: We need to ensure that the authenticated user has a robust,
- 7:13Speaker 2: cryptographically secure session identifier, and crucially, session invalidation must happen
- 7:19Speaker 2: immediately during events like logout, reauthorization, or if the user
- 7:22Speaker 2: switches from a secure HTTPS page to a non secure
- 7:26Speaker 2: HDTP page.
- 7:27Speaker 1: So for high risk actions, we don't just trust this
- 7:29Speaker 1: session is still valid exactly.
- 7:31Speaker 2: We should force user reverification, a quick password entry or
- 7:36Speaker 2: an MFA check instead of relying solely on the current
- 7:39Speaker 2: session state.
- 7:39Speaker 1: That makes a lot of sense. Yeah, okay, we've validated
- 7:42Speaker 1: the input and we've managed the identity. Let's move to
- 7:44Speaker 1: how data is presented and protected internally, starting with the
- 7:48Speaker 1: problem of data output becoming executable code.
- 7:51Speaker 2: Right. This is where requirements ten and eleven come in.
- 7:54Speaker 2: Focusing on output in courting or escaping, this is the
- 7:57Speaker 2: single most effective way to prevent cross site scripting, which.
- 8:00Speaker 1: Is basically an attacker tricking the browser into executing code
- 8:03Speaker 1: when it should just be displaying text.
- 8:05Speaker 2: Right, that's it exactly. Output escaping converts untrusted input into
- 8:10Speaker 2: a safe form. It literally turns characters like the less
- 8:13Speaker 2: then symbol into its non functional equivalent and ELP day,
- 8:18Speaker 2: so the browser just displays it as harmless data, not
- 8:21Speaker 2: as executable code.
- 8:22Speaker 1: So the rule is escape everything.
- 8:25Speaker 2: You must escape or encode all output data unless you
- 8:28Speaker 2: know it is absolutely safe for the intended destination.
- 8:31Speaker 1: And to enforce this we use special tools and policies.
- 8:34Speaker 2: Yes, tools like the OASPFPI provide fantastic encoding libraries, and
- 8:39Speaker 2: you must implement a content security policy header a CSP header.
- 8:43Speaker 2: Think of CSP as the instruction manual you give the
- 8:46Speaker 2: brow they're telling it exactly which sources, scripts, styles, images
- 8:50Speaker 2: it's allowed to trust.
- 8:51Speaker 1: Moving on, Requirement twelve addresses strong data protection, which is
- 8:54Speaker 1: about safeguarding sensitive information from abuse.
- 8:57Speaker 2: This often involves validating not just who the user is,
- 9:00Speaker 2: but what their role allows them to do with specific resources.
- 9:04Speaker 2: You have to validate that the user's role is sufficient
- 9:06Speaker 2: to perform actions like create, read, update, or delete.
- 9:09Speaker 1: So it's about checking permissions for every action.
- 9:11Speaker 2: Every single one. We often use object reference mapping here
- 9:15Speaker 2: to prevent improper data disclosure, which is a key way
- 9:18Speaker 2: to mitigate things like insecure desialization flaws.
- 9:22Speaker 1: Now for Requirement thirteen, which tackles a lower level but
- 9:26Speaker 1: still critical concern, secure memory management. This feels more for
- 9:31Speaker 1: the ccelus plus developers less for modern web apps.
- 9:35Speaker 2: That's right. This primarily addresses issues like buffer overflow, where
- 9:39Speaker 2: malicious data overwrites adjacent memory. Developers must use safer functions
- 9:44Speaker 2: and integrity checks like digital signatures should be implemented on
- 9:47Speaker 2: serialized objects to ensure they haven't been tampered with before
- 9:50Speaker 2: they are loaded into memory.
- 9:52Speaker 1: Requirement fourteen deals with something that's inevitable failure. We're talking
- 9:56Speaker 1: about secure error handling, auditing, and logging. What are the
- 9:59Speaker 1: un breakable rules when this system hits an error?
- 10:02Speaker 2: Rule one, The application must handle its own errors, never
- 10:05Speaker 2: rely on the underlying server to display them. Rule two,
- 10:09Speaker 2: and this is crucial. You must never display sensitive debug
- 10:12Speaker 2: information in production.
- 10:13Speaker 1: Because that's just a roadmap for an attacker.
- 10:15Speaker 2: It's a gold mine for them, and sensitive data like
- 10:18Speaker 2: credit card numbers or social security numbers must never be
- 10:21Speaker 2: logged period.
- 10:22Speaker 1: Okay, so what should we be logging that.
- 10:24Speaker 2: You need comprehensive audit logging using unique traceable identifiers, following
- 10:29Speaker 2: the principle of who, what, when where. This is your
- 10:32Speaker 2: best defense against security misconfiguration and insufficient logging and monitoring vulnerabilities.
- 10:38Speaker 1: Speaking of configuration, we have Requirement fifteen harden the system configuration.
- 10:43Speaker 2: This is just ongoing hygiene. Ensure all software from the
- 10:47Speaker 2: OS and application server down to libraries and frameworks are
- 10:51Speaker 2: running the latest patched versions. Lock down the server by
- 10:54Speaker 2: removing unnecessary files and functions, and always always isolate lower
- 10:59Speaker 2: environments like test and QA from your production environment.
- 11:02Speaker 1: And finally, for this section, Requirement sixteen handles strong transport security.
- 11:06Speaker 1: This is about making sure the communication itself is safe.
- 11:08Speaker 2: Right when transmitting sensitive information. You must use SSLTLS and
- 11:14Speaker 2: we strongly recommend only supporting TLS version one point two
- 11:17Speaker 2: or one point three. You need to ensure the server
- 11:20Speaker 2: only supports strong approved ciphers and hashing algorithms. We're talking
- 11:24Speaker 2: two hundred and fifty six or five hundred and twelve
- 11:27Speaker 2: bit and deprecate older standards like MT five or SAHA
- 11:31Speaker 2: one they're just broken at this point, completely broken.
- 11:33Speaker 1: Let's move to the final cluster of requirements, Authorization, redirects
- 11:37Speaker 1: and Cryptography. Requirements seventeen defines strong access control. We've authenticated
- 11:43Speaker 1: the user, but now we have to.
- 11:44Speaker 2: Authorize them, and that's a key distinction. Authorization is the
- 11:47Speaker 2: decision process granting or denying requests to create, read, update,
- 11:51Speaker 2: or delete resources. While role based access control or RBAC
- 11:55Speaker 2: is common, we're seeing increased adoption of policy based access control.
- 11:59Speaker 1: With the core principle still the same.
- 12:00Speaker 2: The core principle remains least privilege and you must enforce
- 12:03Speaker 2: timely authorization checks on every single request, both server and
- 12:07Speaker 2: client side.
- 12:07Speaker 1: Why kindly, what happens if there's a delay?
- 12:09Speaker 2: That delay creates a vulnerability known as a time of
- 12:12Speaker 2: check time of use attack. Imagine the system checks if
- 12:15Speaker 2: you have sufficient funds. That's the time of check, but
- 12:18Speaker 2: before the transfer actually happens, someone else changes your balance,
- 12:21Speaker 2: that's the time of use. You have to check the
- 12:23Speaker 2: authorization state immediately before the resource is accessed.
- 12:27Speaker 1: Got it okay? Requirements eighteen and nineteen address two specific
- 12:31Speaker 1: web risks, cross site request forgery CSRF and safe url
- 12:36Speaker 1: redirects CSRS.
- 12:37Speaker 2: Is nasty because it tricks an authenticated user into performing
- 12:41Speaker 2: an action unknowingly. The mitigation is to use synchronized tokens,
- 12:45Speaker 2: these random, unpredictable numbers that the system expects with every request,
- 12:49Speaker 2: and to use the modern same site.
- 12:50Speaker 1: Cookie attribute and for redirects.
- 12:52Speaker 2: Unvalidated redirects can lead to phishing and privilege escalation. You
- 12:56Speaker 2: have to enforce restricted URL paths and enable cores or
- 12:59Speaker 2: cross origin resource sharing, which is basically the system defining
- 13:03Speaker 2: which other domains are allowed to access its resources.
- 13:05Speaker 1: And finally, the twentieth Security Requirement wraps up our entire
- 13:09Speaker 1: protective layer. Implement strong cryptography.
- 13:12Speaker 2: This requires careful choice based on the data. Are you
- 13:15Speaker 2: using two way symmetric encryption for stored data, two way
- 13:18Speaker 2: asymmetric for public private key pairs, or one way salted
- 13:22Speaker 2: hash encryption for passwords?
- 13:24Speaker 1: And you have to use approved standards.
- 13:25Speaker 2: You must ensure your cryptographic models comply with strict standards
- 13:29Speaker 2: like FIPPS one for two that's the US government standard
- 13:32Speaker 2: for cryptographic module reliability, and use approved models for random
- 13:36Speaker 2: number generation.
- 13:37Speaker 1: In a final warning, regarding the components we bring in
- 13:40Speaker 1: all those libraries and frameworks.
- 13:42Speaker 2: Yes, always remember that vulnerable third party components run with
- 13:46Speaker 2: the same privilege as your application. Exploiting one of them
- 13:50Speaker 2: can lead to serious data loss or complete server takeover,
- 13:53Speaker 2: so vetting them and keeping them updated is an integral
- 13:56Speaker 2: part of this whole framework.
- 13:58Speaker 1: That was a really comprehensive analysis. We've defined secure requirements,
- 14:02Speaker 1: emphasized the cost savings of integrating them early, and detailed
- 14:06Speaker 1: twenty specific controls mapping that planning phase directly to mitigating
- 14:10Speaker 1: major vulnerabilities.
- 14:12Speaker 2: The key realization here, I think, is that security is
- 14:15Speaker 2: not a single feature that you purchase and install. It's
- 14:18Speaker 2: the continuous, layered implementation of these twenty requirements, from whitelisting
- 14:23Speaker 2: input all the way up to PHIPPS compliant encryption. It
- 14:27Speaker 2: is really the foundation of quality software.
- 14:30Speaker 1: So we covered twenty security requirements today. If you were
- 14:33Speaker 1: starting a brand new project tomorrow and resources were incredibly tight,
- 14:37Speaker 1: which three requirements from this list would you prioritize first
- 14:40Speaker 1: to achieve the largest immediate security gain and why? That's
- 14:43Speaker 1: the question will leave for you to consider as you
- 14:45Speaker 1: wrap up this deep dive.