We’re halfway through the OWASP Top 10, and this one is a favorite. Brad Causey is joined by Jordan Natter, SecurIT360’s resident web app pen tester, to cover A05: Injection. They explain how injection flaws work, why it slipped two spots on the list but is no less dangerous, and what developers can do to shut it down.
Along the way, they share real stories from the field. There’s a first-ever pen test that turned a blood drive gift card app into $25,000 in gift cards and a destroyed production database. There’s a harmless-looking hub status dropdown that became a reverse shell. And there’s a username field that handed over session cookies.
In this episode:
What injection is and why it can happen anywhere from the browser to the data layer
Reflected, stored, and DOM-based cross-site scripting, and how they differ
SQL, NoSQL, LDAP, and why no data layer is immune to injection
Why injection moving to #5 doesn’t make it a lower priority
How CSP, HttpOnly cookies, CSRF tokens, and SameSite attributes break attack chains
Why client-side validation is a usability feature, not a security control
Whitelisting vs. blacklisting, parameterized queries, and output encoding
The case for never testing in production, and backing up your staging data too
Resources mentioned: OWASP Input Validation Cheat Sheet and the OWASP Cheat Sheet Series
Need a web app pen test or have questions about application security? Reach out to the SecurIT360 team.
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
Brad CauseyHey, folks! Welcome to the Cyber Threat Perspective. Today, I have a cat with a keyboard, and welcome back, Jordan, who is our resident web app pen tester. And so, yeah, yeah, and as you guys might have guessed and probably can read, we're talking about the OWASP top 10. We have finally made it to number five on the list, so we are halfway there. Progress, probably progress. I know, right? Well, it's taken us like six months to get here. Just we've been super busy, and we have other podcasts to record, obviously, but we're we're gonna try to get the last five knocked out in 2026. We'll see if that actually works.
Jordan NatterHey, I have face. I have face. If we have to do it all in one evening, don't question why we're wearing the same clothes for the right. Yeah, we might record like six
Brad Causeyin a row. Wait, that would be too many. But but yeah, so so this one I think personally this is my favorite.
Jordan NatterI agree, 100%
Brad CauseyYeah, yeah. So we're talking about injection, folks. So what is injection? Well, fundamentally, we are pushing code to some layer of the application, and and it's not handled properly, and it is then executed by that layer of the application. Now that can be any number of different things. It could be the browser, right? It doesn't have to be a component that lives server side. So yeah, it can be. There are many many variations.
Brad CauseyProbably the ones you guys have heard of are things like cross site scripting, one of the most popular and common vulnerabilities that we see. SQL injection, which I'm going to put beneath SQL injection, like all of the other data layer manipulation ones, right? No SQL, LDAP. Although again, those are technically obviously not SQL, but when we start talking about like data layer injection, it there there's so many of them you just can't list them all, right?
Jordan NatterI feel like they're in the same family, so like we can just count it as a category in this case, just as long as we're explaining that to you guys, which we just did. So,
Brad Causey100% 100% and so so yeah, I mean, at the most fundamental level, you know, you can put a script tag in a form field, and the browser, if it's you know, again, if the application is not handling it properly, may execute that script on the user's browser. And so, even beyond just the category of cross-site scripting. There are like I think three subcategories of cross-site scripting, and we're not going to go like super deep into any one thing. But with cross-site scripting, there's reflected cross-site scripting, right? So this would be more like a GET request, right? And and so, all right, I guess we are going to go deep into this.
Brad CauseySo we're not going
Jordan Natterdeep into it. Starts explaining it
Brad Causeyimmediately. Goes immediately goes to like you know HTTP methods. So usually when you're sending data between a browser and a web server, there are many different verbs, many different methods. But the two most common that we see on a web application are GET and POST. And a GET request and a post are very similar in that they transmit information between the client and the server, but they're different in the way that they do it. And so, GET uses parameters in the URL, and POST uses a body, which is basically just content that is like down inside the request.
Brad CauseyRight. The easiest way I know to kind of illustrate the difference is if you're using a GET request, you can actually see the data in the URL, right? If you copy the GET request, it's going to be this long string of val of key value pairs. When you do a post, you can't do that. You can't copy a post URL and paste it into a browser and get it to execute because it's actually like nestled down into the body of the request. Generally speaking, posts are more secure than than gets for that reason because they do not display the data in the URL. Anyway, I digress. So I say that say you know you can put these in cross-site scripting, right? Reflected cross-site scripting would be like grabbing that GET request, sending it to a user. The user clicks on the link, and the code that the bad guy wants the user's browser to run is contained within the link, and it fires and it executes.
Brad CauseyProbably the most common, I would say, the most common reason for doing it would be like either causing the getting the user to do something they wouldn't do, right? So, like for example, I can have if if maybe the account creation page. Is also vulnerable to cross-site request forgery. Then I can chain. I'm getting ahead of myself a little bit here. We're going to talk about this, but but the point is, cross-site scripting by itself is kind of novel, right? But in almost every case, you need another vulnerability in the application to make it useful. Do you agree with that? Is that fair?
Jordan NatterTypically, yes, and not in all cases because, like, we'll we'll mention more about that. Especially because, like Brad was talking about, there's different kinds of cross-site scripting. But in most cases, if you want to take a cross-site scripting vulnerability and get it to a critical, you do kind of want to chain other vulnerabilities together.
Brad CauseyYeah, yeah, and I agree. Like cross-site scripting by itself, it can be like a medium or high, right, on a CDSS scale. But in most cases, if you want to do something with it, right, steal a session, you know, cause something else happen. But I mean, the reality to your point, actually, and I didn't even think about this until just now. But like, I mean, you could do HTML injection and call and and and just social engineer the user into doing something they don't want to do, right? We do that sometimes as proof of concept, and it's like email your password to blah blah blah blah blah, you know, and and so and so you know now all the users are going to log in and be like, well, I guess I have to do that.
Brad CauseySo, so yeah, so so that's you know, reflected cross-site scripting is is is not stored anywhere, right? Has to be executed in in kind of real time. By contrast, stored cross-site scripting
Jordan Natteris
Brad Causeypersistent, right?
Jordan NatterYes.
Brad CauseyAnd so it has to it can live within the application. Those are, I would say, more dangerous.
Jordan NatterAbsolutely.
Brad CauseyWould you agree with that? Okay. Yeah. Completely
Jordan Natteragree. Now, if those of you who listen to Brad's like four minute spiel about those three, if you want a like very short bulleted version of those of those two, look at it like stored cross site scripting is a script that's saved on the server, so any visitor that like goes to that page is going to see it, right? Think of reflected, like the script comes immediately from a malicious URL, so that that's like in very layman terms what to expect from those two and how to categorize those based on. Could have
Brad Causeysaved me like five minutes of my life by saying. I
Jordan Nattermean, I I thought maybe you just like talking so no I'm
Brad CauseyI'm just trying to like in real time formulate a way to describe it and you're just like oh yeah two sentences obviously see this this is why this is why you do this is why you do stuff right well
Jordan Natteryou gave them the very in depth like you need to understand all the history of all of it and I gave them like hey if you want the cheat notes for a test. Here it is. Yeah,
Brad Causeyyeah. No, to to be fair, I'm I I frequently have to explain this to technical people, like in in report delivery meetings, and and and and so you know we're we're I'm already deep diving into that. So there is one more kind DOM based cross site scripting. I'm gonna be real with you, dude. I don't even think I care about the difference between reflected and DOM based.
Jordan NatterYeah, there's not much of a difference, really. Again, if you had to have like a one liner, it's pretty much very similar to it, but it just improperly handles the data, so you're not really seeing what it's doing because it's not reflecting back.
Brad CauseyWell, and I don't think it ever reaches the server. So, like, in I guess that's probably the core difference between DOM and reflected is that in in a DOMB. By the way, if you don't know what the Document Object Model is, here I go. Think about it like the it's kind of like the browser's space that that executes the code, right? So the server sends down HTML and JavaScript and all this fancy stuff, and then the browser kind of interprets it. And so that's how we get from this this garbage code into a pretty website, right? That's the DOM.
Brad CauseyThe DOM handles all that stuff, and so you can you can actually drop script code or whatever kind of code into the DOM, and if it's not properly handling it, it'll execute. The big difference is it never goes to the server. With reflected cross-site scripting, it actually reflects back from the server to the browser. All right, and so I would say reflected and DOM based are probably similar in their risk. Would you agree with that? Okay,
Jordan NatterI completely agree.
Brad CauseyOkay, so we haven't even gotten to the other 72 different types of injection. You know, I probably the the next biggest one on the list is SQL injection, right? And we we mentioned that a little bit earlier. We mentioned that there are 100 million different subcategories of that, which we absolutely do not have time to go into because we're already like 1/3 through the the podcast. But but suffice it to say this, right? Most applications have some sort of data layer behind them, right? An application without data is kind of useless, and so right, like what are we doing, right?
Brad CauseyLike maybe like a calculator or something. I don't know, but but I'm sure I'm sure there are plenty of wonderful applications that. Have data storage, but the point of this is, is if there's a SQL database structured query language, we can we can actually manipulate the requests that end up at the database to do the thing that we want it to do, right? Which would be like dump the database to me, for example, and even as subcategories of SQL injection, there are many different types of them, like blind SQL injection. You know, but but but the the moral of the story is this, right? We're not properly sanitizing the information before it reaches the data layer, and that's the theme of injection.
Jordan NatterYes,
Brad Causeywe we as application developers are not properly sanitizing the data before it reaches the place where it can be executed, and that can be anywhere, right? LDAP, for example, is is is a authentication protocol, lightweight directory access protocol. I believe is what that state. I did that off top of my head, so I could be completely wrong. But you know, most most commonly known to be used for things like Active Directory and stuff like that. So it's an authentication component. Well, it's still a structured language, which means we can manipulate it.
Jordan NatterYes.
Brad CauseyNow I do want to mention this, and and this is probably going a little deeper than we need to go. Big surprise to literally No one, you know, SQL is is not the only type of of data layer that can exist out there. There are literally hundreds, right? There are flat, like no no SQL. There are object relational mapping frameworks, Hibernate query land, like literally, I can't even list them all. Right, we've run out
of time. But here's the thingI want you guys to take away from
thisthere is no data layer that is immune to injection. Meaning that even if you choose a widely considered to be secure data layer within your, you know, to support your application, then it is still possible to manipulate that, and and therefore you should still be doing input validation.
Jordan NatterYes,
Brad Causeyright, and that can take many forms. You know, the most common form, obviously, is is just you know a value. Actually, you know what? We're going to talk about fixing this at the end of the episode, so I'm not going to deep dive into that.
Jordan NatterAre you sure you don't want to do it now? I
Brad Causeyreally do. Can you tell? Like, I really want to. Okay, so let's talk about like real world examples. Before
Jordan Natterwe get into that, I do want to say something. So, those of you guys who have been following like the OAS Top 10, right? You've probably noticed in recent years, that this wasn't actually number five; it was higher up in the list of of top 10. Oh yeah, I guess so.
Brad CauseyYeah, you're right. I think it was like top three, wouldn't it?
Jordan NatterIt was, yeah. So it's moved back to slots from like last year to this year, or whenever that they change it from year to year. That's not saying that it's any less of a problem, guys. Like it. What we're pointing out is the fact that what is more important right now. It does not mean that the things that are lower in the list are less important or less. What's the word I'm looking for? Prolific,
Brad Causeymaybe common.
Jordan NatterYeah, like they're not less common just because it moved. It's not less important. It's still like all bunch a big category of vulnerabilities, guys. Like, don't lower this on your yeah. Like, don't lower your prioritization of it just because it moved down in the list. It's not any less important.
Brad CauseyYeah, no, I completely agree with that, and it's still common. We still see this all the time.
Jordan NatterOh no, I've got February pen test. Yeah, I've got
Brad Causeya report delivery meeting next week where where where you know I did a web app pen test on an app and you know it was dumping SQL code on you know error based SQL detection SQL injection detection and it was like wow guys you know I shouldn't be able to manipulate structure your query so yeah 100% so I agree with that anything else to add before we get into the war stories because this is my favorite part of these episodes. This is when we talk about like, hey, we actually saw one of these, and I know you've got probably some some good ones. So I'll let you go first.
Jordan NatterCool. So if it's okay with you, I'm gonna cover the blood drive one. By all means, add your tidbits of information because you were there. I was there for that one. I was
Brad CauseyI was a witness to this catastrophe.
Jordan NatterA witness, right? So for some context, guys, right? I started pin testing back in like 2018, but this was my first ever actual pen test, which is great because before this, I was just working on like reports and like kind of like having my training wheels and riding shotgun on things. But in this case, my first ever web application pen test. So, for context, there is this very big organization that's kind of in the medical space, right? Well, what happens is what they do is they reward their employees for every time they give blood with a $25 gift card. Now, the thing is, though, how. They apply for that gift card. Is that they go to this web application? They then say that they're an employee, and it's self-registry. So what's supposed to happen is that the employees are supposed to be like, "Hey, I'm an employee. I gave blood. Please give me my gift card. Okay. Well, the problem there is anyone can register as an employee. They're not cross cross referencing to their employee database, so that's one thing that's already interesting to me. Then there's also no limit on the amount of times you can apply for a gift card. So those of you who know a little bit about like giving blood, there's normally a limit of how much blood you can give within a certain amount of time.
Jordan NatterDon't you run
Brad Causeyout at some point.
Jordan NatterYeah, I mean, I would expect so. I don't feel like I have an indefinite amount. Not a doctor, just just a theory.
Brad CauseyOkay, just just
Jordan Natteran assumption. This is
Brad Causeythis is not medical advice, people.
Jordan NatterYeah, no, please don't go give all your blood. I don't think they would allow you to anyway. Probably, but they're
Brad Causeyobviously not using this app. No.
Jordan NatterWell, so that's another thing that's interesting is that I notice that there's not a limit to how many times you can apply that, like you gave blood and want a gift card, right? So there's supposed to be some kind of a limit because I'm obviously not giving blood every moment of every day. So already one note that I'm like looking at, I'm like, oh, this is interesting. So two things right there that we're already pointed out, right? So anyone can register for it, pretending they're an employee because there's no validation that you are an employee. Second, being you can apply for that gift card as many times as you want because there's no limit to the amount of times you can apply for that gift card within a period of time, even though it's asking for when how much blood that you gave, it's not actually validating that that makes logistical sense.
Brad CauseyBusiness logic flaw.
Jordan NatterYes. Have we
Brad Causeydone business logic yet? I'm not sure.
Jordan NatterI don't remember. This is all kind of. We'll have
Brad Causeyto we'll have to figure it out. All right. Go ahead. Go ahead. This
Jordan Natteris all kind of going together. Okay. So with all of that in mind, what would you guys want to do? Probably see how many gift cards you can get just for the like hell of it, right? I mean, I that's what I want to do. So looking at it, you're like, okay, cool. What what possibly could I do? Well, they have a SQL database. What if we just use SQL injection to then just absolutely ruin everything and get as many gift cards as humanly possible, that is exactly what I did. Lo and behold, this was also my first pen test where I didn't know that you should probably make sure that they have a backup of the database and not also test in production, which as you guys have heard on every episode, we specifically mention to make sure it's a staging or development environment and make sure that there's a backup of the database. This is why, because the database was absolutely destroyed.
Brad CauseyYeah. So so this was, and I think I think we may have mentioned this part of the story before, but yeah, this app was the one that we were like because up until that point it was kind of optional for the client, where it was like, hey, we prefer to not test in prod, and so unfortunately this app was the only copy of the app. There was no alt. There was no backup of the source. There was no backup of the database, and Jordan corrupted the database, and there was no way to get it back. Right. So like it was gone, gone, and so we reached out, and and we didn't know that at the time, right? We reached out and we're like, hey, I think the app is down, and then all of a sudden it was like, hey, we need you.
Brad CauseyWe need you on the phone right now. And we get on the phone, and and the app owner, like the executive over that department, did not know that the pen test was happening.
Jordan NatterOh, so
Brad Causeywe were, yeah, we were being sponsored by the cyber security department of this particular organization, and and they did it without letting the app owner know, and and so basically we got chewed out for like 20 minutes, and I mean again not our fault, dude. Like literally, you you hired us to do a job. We're doing a job, and anyway, so long story short, at after that it was no longer optional. Like we do not test in production.
UnknownYes.
Brad CauseyAnd by the way, back up even your staging data. Like back it up. Have a have a back up
Jordan Nattereverything.
Brad CauseyYeah, because we don't intentionally break stuff, but it does happen.
UnknownYes,
Brad Causeyyou know, and web apps are are even more fragile. Maybe that's the right word for it than than other things that we do pen testing on. You know, like when we're hammering an SSL VPN with like you know credential stuffing attacks, like there's no chance we're gonna break the VPN.
Jordan NatterNo,
Brad Causeybut web app. If your code's bad enough, man, anything becomes a data recovery exercise.
Jordan NatterWell, I was gonna say, look at it in this in this case, right? So what we were inherently doing on this web application wasn't necessarily out of the norm. It was the. Amount of data we were pushing to the the SQL database, right? So we ended up getting, I think, like $25,000 worth of gift cards. Which, by the way, they're $25 gift cards. You guys can do the math on how many like queries that is. So what we're doing isn't necessarily inherently bad. Like we weren't purposely trying to knock off the the database or anything, or sorry, the servers. So what? But we just made so many requests that it was like barf and fell over.
Brad CauseyYeah, yeah, and it can happen. It absolutely can. Again, if any code's bad enough, we can we can turn this into a data recovery exercise. Good. No, I love that story. I love that story. I really only have one, and it's it's kind of lame, but I think it's it's still important to to to communicate. So I'll I'll be quick. This was actually an external pen test, by the way, not a not a dedicated web app pen test, but this was a like a regional logistics company, like they did like regional shipping or something like that. I don't remember the details, but they had multiple hubs, obviously, all over the region. And and one of the tools on their like what on their website was to check to see if the if if all the hubs were up, and so you could you could select like a southeastern hub one, and it would ping the the the server at that location to see if it was working. And so anyway, long story short, I could manipulate the dropdown box and actually inject a value in there other than like hub one. And so what that what that ended up doing though is the way they had written the code is PHP code. The way they had written it is it would actually go down and do a ping at the OS level.
Brad CauseyThey would use the command line of the operating system to do the ping. Those of you who understand what OS command injection is, you guys know where I'm going with this, right? And so I was able to put any value in there. And if you if you if you actually look at like the way a ping command is structured, you can put a semicolon at the end of it, and then run more commands. Right, or you can do ampers a double ampersand on Linux and run additional commands, and so that's exactly what I did. Is I had it ping, and then I appended my own request at the end. In this particular case, I was able to get it to actually do a curl command to pull down and execute a Bash script that was a reverse shell. And so, literally, like 10 minutes after finding this little drop down, you know, check, and it's totally. It looks, it looks so innocent on the site, you know. It's like you want to drop down check, and and so that one little form with with a single field and one button turned into me running as the www data you www data user.
Brad Causeyon that web server, and so yeah, it could be that simple and that dangerous. And and we didn't we didn't talk about OS commanding as an injection flaw at the beginning of the episode, but this this was my opportunity to kind of bring that back up. So so yeah, literally from like one button to hey, now I have access to your server directly via a shell. All right, back to you.
Jordan NatterWhich is great. I know I'm. Isn't it? It's great
Brad Causeyfor me. It's awful for them. You know. Now, hey, at least they weren't running Apache's root. I've seen that before. So yeah. So that that one's fun.
Jordan NatterIt just gets worse, guys. The more you know. Anyway, all right. So this next one's a little short, and then I say Brad and I tag team if we have time for the session hijack chain one because that one was something that he started talking about earlier. Plus that way he doesn't only have one story. So I'll pass him off one of mine. Less prepared. All right. So in this case, this is just basic cross-site scripting, right? So on this one application, I'm not going to list what kind of application it is because it doesn't necessarily matter. But in this one, a user has the ability to change their username to whatever you want. There's no input validation at all. So I decided to change my username, but for context, everyone can view usernames, especially because what you do when within the application is you see what people are applied to what projects. So people are going to see my username, whatever that may be, being reflected on everything else. So
Brad CauseyI see where you're going with this. If
Jordan Natteryou guys are seeing what kind of cross-site scripting this is stored, excuse me.
Brad CauseyNice. Yes.
Jordan NatterThat's where this is going. So in this case, I just changed my name to a very complicated query, words or hearts, that requests a document cookie. So anyone who's going to hover over mine and it's going to fetch their document, their their cookie that they are using at that time, whenever they whenever they interact with my username. So let me scroll down to some evidence. Not that you guys can see this, but it makes my brain happy to to look at it, but pretty much I changed the first name to like give or take JavaScript alert document cookie. I'm just simplifying. So
Brad Causeywe're we're throwing the session up.
Jordan NatterYes. Yeah,
Brad Causeyand a JavaScript dialog. Yeah.
Jordan NatterYes, and then what's going to happen is when someone interacts interacts with it, I am now getting a little box that tells me what their document cookie is. Cookie is it's fetching it and then retrieving it to me. So anyone who's reacting with that now I have authentic authenticated cookies, and I can now hijack your session and log in as you because I have those valid cookies as long as they are logged into their that application at the same time. Obviously, they are if they're interacting. View your username.
Brad CauseyYeah.
Jordan NatterYes, because they have to be logged in to view my username. Well, now I have everything to log in as you because you're interacting with me.
Brad CauseyYep. And this is a really good example. I'm glad you did this one, right? This is a really great example of where multiple flaws need to exist in an application in order for one of these to be dangerous, right? So, I know that the the subject of of this is is injection, but if you have a proper CSP in place,
Jordan Natteryes,
Brad Causeyyou kill it. If you are using HTTP only on your session cookie, you kill it, right? Because it will not allow the JavaScript to access access the cookie values, and so if you are using you know any number of other protections that can be in place, you still defeat this attack, and so you know there are so many options available to application developers, and you know it's just part of a layered security approach. You know what I mean?
Jordan NatterNo, absolutely. And
Brad Causeyso you know I just I just like pointing that out because in almost every case when we start talking about injection flaws, you know, like I'll give you another example, right? Air-based SQL injection detection, right? Which is the way that works is we, you know, we would put in SQL code, and if the thing we get back is your your SQL structure is incorrect, try this. You know, like that. Thanks, but but now now we're not, you know, we're not output filtering error error messages. So that in of itself is a flaw, right? Now the SQL injection would still be there, and it would just be blind SQL injection at that point. But what I'm getting at is, we have so many opportunities and so many tools at our disposal that any one of them, if done well, will typically defeat an attack chain,
Unknownwhich
Brad Causeyis actually what we're going to talk about next.
Jordan NatterYes.
Brad CauseySo yeah, no, I love it. Great story. Great story.
Jordan NatterImagine the name of the next one is Session Hijack Chain.
Brad CauseyRight, right. Which is the most common thing to do with cross-site scripting. Yeah.
Jordan NatterWell, and as Brad was mentioning, right. So if you have a SeaSurf token like already, that's already fixing things. So in oh, that would have
Brad Causeydefeated the one you just yeah yeah.
Jordan NatterSo that would have fixed. That was the one
Brad CauseyI was thinking of. That I and I was like, "If you just do the, and then I lost it. So no, thank you for bringing that one back. I
Jordan Nattersaved the day. Well, so in this case, right? So there were three things they weren't doing. They their CSRF token parameter accepted or is accepted without any server side validation, right? So it could be blank or any argument. So they had
Brad Causeyone. They just weren't using it.
Jordan NatterYeah. So it pretty much what what was happening is that they were like, I have sea surf, I'm doing nothing to actually make sure it's being used. So it just it's just there. It's a name, but it's it's not doing anything. It's not doing what it's supposed to do. So that's slightly worse because you took the time to put it there, but then didn't implement it. But
Brad Causeythen you're just not doing it. Yeah, that's cool.
Jordan NatterSo that was one of the things. Another thing was the fact that, like, of course, there's no like encoding or output sanitization or any input validation, right? So that was another thing that conjunct conjunctions with this. And then also the last one was the session cookie was issued with without the same site attribute, so neither lacks nor strict, so it would automatically be attached across origin requests. You guys can see where this is going. So in this case, let me scroll down. And by the way, feel free to chime in.
Brad CauseyI'm loving it so far. Nothing to add.
Jordan NatterSo of course, the SeaSurf token is set to empty. We go to the search field, which this great dandy part about this one is it's in the search field, and we just do cross-site scripting. Script alert document dot domain script, right? Of course, with all the extra tags, but I'm not sounding like a robot. Right. So when load. Into the same profile as an authenticated user, the form would submit automatically, resulting in a page rendered that the victim's authenticated navigation would execute an inject script, producing the same site and then getting. Or wait, hold up, my brain is rebooting.
Brad CauseyBut ultimately, though, right when when we're when we're leveraging this search field, because of the lack of additional protections in place, it sounds like we're able to control the user's browser.
Jordan NatterYes, pretty much. My brain started combining this one with the other one, and I was like, "Hold up! It's a lot. It's a lot. So,
Brad Causeybut yeah, no, I love that, and and this is another great example of of how these injection flaws can can can either you know again and we're about to talk about remediations in just a second, but you know some some really basic application hygiene can really go a long way,
Jordan Natterright?
Brad CauseyIt can really go a long
Jordan Natterway. Well, and there's not a like a vast number of things you have to do to like limit the ability to do cross-site scripting or injection attacks. I agree. Of like, like we're about to is we're about to go in solutions. But there's even just doing one or two of them will already like lower the amount of possibility that it's going to happen.
Brad CauseyYeah, and and even if you know exactly what you just said, right? If if the if the flaw exists from a cross-site scripting perspective, but you can't do anything with it. Well, suddenly it's like okay, it's annoying. Like you still need to fix it, but but you can't really do a lot.
Jordan NatterWell, yeah, it's like take for example, you have a reflected cross site scripting, right? But there's so many other controls in place that it doesn't affect any user other than yourself. Cool. So I'm just saying alert cross site scripting found. Like show up because I put like literally alert cross-site scripting. The only person that's affecting is me because that there's other like mitigation factors in place.
Brad CauseyYeah, it makes perfect sense. Yeah. All right, so let's talk about prevention. How do we prevent injection attacks? And and so I'm going to make this contrary to how I normally do things very simple. We first of all we never trust user input, right? User input, and and I would take it a step further. We don't trust anything that comes from the user's browser, even because ultimately the browser is under the control of the user, which means it could be malicious. Yes. All right. So, so you know, we can kind of combine like the input validation concept with we don't trust the browser, we don't trust the user. So when we start looking, we want to look at things like even headers, headers that come back, any value that can be tampered with, and and I'm not I don't mean tampered with like in a form field. I mean tampered with at all because that is probably the most common confusion that we see when we deliver these reports, and that is you know the the developers like yeah but I don't I won't I don't let you put anything but numbers in the zip code field, and I'm like yeah you're doing that with JavaScript bro right you're doing that in the browser the problem is I'm not even using the browser, right? Like I'm tampering with with this using Burp Suite, and so the browser never sees it. And I can just not. I can also, by the way, pro tip: you just turn JavaScript off. Like you can just disable it in the DOM. Like it's not a big. Yeah. So so you know it, and so we call that client side validation. Client side validation is not a security measure. Like, let me just be clear: client-side validation is a usability feature. It is nice for the user to have because it will tell you, "Hey, you didn't input this field, or if you've ever like filled out a form and you missed a checkbox, it's like, "Hey, you have to approve.
Brad CauseyYou know, you accept the fact that you're giving up your entire life to to submit this form, and so that that's not security in any stretch of the imagination, right? That that's a feature that's nice. Where that should be validated is on the server side, and you can do both. That's totally fine. We're going to turn off the user the user validation side, but but yeah, so so input validation, as it reaches the server, the server should be critiquing the values against what it knows to be valid, right? So and I love using zip code because it's the easiest thing in the world. It's a five, you know, for the for in the U.S. It's it's it's five numbers, right? Or at most, it's nine numbers if it's five dash four, and so in in some countries there are numerical values, but you know what?
Brad CauseyThere's not apostrophes, semicolons, probably. I don't know. You know what? There's probably a country. Somebody's going to correct me on that. But but the point is this, right? It's a known structure. There are also a a finite number of zip codes that exist. Period on planet Earth, and so if you wanted to, you could have a database full of them or an array within the application. So
I say all that to say thisyou know what values you're expecting, so you should block values that you're not expecting. Yes, and there are two ways to accomplish that. Number one is through a blacklist. Which is the wrong answer?
Jordan NatterI like how you stole exactly what I wanted to mention.
Brad CauseyNo, are you serious? Go, go, go! Talk, talk about it. So,
Jordan Natterlike what he was saying, right? That there's two ways to do it. You can either have a blacklist, as he mentioned. Don't suggest because, by the way, who wants to sit there and come up with every possible value you don't want, right? So, like, am I going to sit here going, okay, cool, this is a zip code. It should be only numerical values. Am I going to sit here and do sit through sit through the entire alphabet and every special character that there is to add to the blacklist? Probably not. And if you do do that, you're probably going to miss some things. So with that in mind, you could also do a whitelist, which is way better, because now I just say what I want you to do, and that's the only thing that I allow. That way, anything that I didn't put on that whitelist is automatically disallowed. So again, I'm only going to include numerical values. So now I'm just going to do one through or zero through nine. Right, those numbers are allowed. Now everything else is disallowed, so they can't put like apostrophe or a single quote or whatever it may be. Right?
Brad CauseyThat's exactly right, and and that that's the right answer. Now, I've I've seen some blacklists work relatively well, but to your point, the the problem that blacklists don't take into account are are concepts like encoding, double encoding, so like a space is what percent 20 or percent 22 in HTML entity encoding. Yeah, okay. So so now I drop that in and it gets interpreted on the server side as a different character. So there are ways to bypass blacklist filters, which is why we encourage people to use whitelists And and so we could do an entire episode just on this, but that that's one piece, right? So the data is inbound to the server. We need to filter that. We're going to filter that based on what we know to be valid and safe. Okay. And by the way, check out OWASP's input validation cheat sheet. Pro tip: absolutely amazing resource. It will tell you how to do it correctly. And I would even encourage you to go check out the libraries that exist. So rather than you inventing a way to solve the problem that has existed for 30 years, go grab an OWASP input validation library.
Brad CauseyThere are many of them available, and use that. All right. So moving along, the data goes to the server, and and there there's one other thing I want to mention before because what we've been talking about mainly for things like OS commanding and SQL cross-site scripting. We didn't talk about SQL injection. All right, for SQL injection, it's a little bit different. We still want to do input validation, but we also need to use parameterized queries, right? Because the the issue in in SQL injection is that we're putting reserved SQL characters in the request that gets interpreted then as code on the SQL data layer itself. So, parameterized queries and stored procedures are your two best defense mechanisms for that. And these are basically just strict structures that you can't break out of. Okay, and and and you can do them wrong, but that that's the answer, Right now, data reaches the server. Now, data has to come back from the server. This is where output encoding comes into play. There are always going to be scenarios where you can't restrict the characters that go into a request. What you can do is control how it comes out of the server, how the server pushes it either to the data layer or back to the browser, and that's where output encoding comes into play.
Brad CauseySo that is where you're going to encode the characters to make them inert, to make them safe for the browser to display. Right. So, so yeah. I mean, that's it in a nutshell. It's that. It sounds so simple because we just covered remediation in like four minutes. It's not. It's not always that easy. But what I would encourage you guys to do is go check out some of the OWASP resources. Maybe we'll grab some of them in the show notes for you guys. But yeah, yeah, absolutely. And and the cheat sheets are like a category of project that OWASP has. I've actually written a couple of them, and and I'm a huge fan of those because they cut straight to it, right? It's not like the OWASP Web Testing Guide, which is like 250 pages. You know, it's like, oh, cool, there goes my entire weekend. No, no, no.
Brad CauseyYour cheat sheet is like four pages, and it tells you exactly how to solve the problem that you have. So there are some really good resources out there. All right, anything to add before we close out?
Jordan NatterNo, that's all I got.
Brad CauseyAwesome. Well, thanks for being with us today. More to come. We have five more of the OWASP Top 10 to cover, so we're going to try to get to those as quickly as we can. If you enjoyed the show, like, subscribe, share this with your friends, and most importantly, if you need a web app pen test, I know a cat with a keyboard that will hook you up. So reach out to us if you need a web app pen test, or you just have general questions about web application security. We can definitely hook you up. So we'll see you guys next week.
Part 8 of our OWASP Top 10 series covers Software or Data Integrity Failures, the category Brad thinks would jump to number one if OWASP released a list today. Brad and Jordan explain why it covers much more than...
In Part 7 of our OWASP Top 10 2025 series, Brad Causey and Jordan Natter dig into A07: Authentication Failures. They explain what makes MFA real, why session management is where attackers are focusing now, and share...
What happens when your entire security investment means nothing? In this episode, Brad and Spencer break down how ShinyHunters and related groups like Scattered Spider and Lapsus$ keep getting in through social...
One dangerous permission in Active Directory can be all it takes for an attacker to turn a single compromised account into full control of your domain. On our internal pen tests, that one misconfiguration is often the...
200 episodes! Thank you to everyone who has listened, watched, and shared The Cyber Threat Perspective along the way. To mark the milestone, Brad Causey and Jordan Natter are back with Part 6 of our OWASP Top 10 series,...