I'd like to introduce you to our next speaker. She's a teacher of... she teaches developers about application security. She has learned over 20 programming languages. I told her, like, she's like a developer polyglot, right? She is a founder of Gold Hat Security and now teaches AppSec full time. And she's going to talk about vulnerabilities that hide from your tools. Give a round of applause to Jillian Ratliff. Hi, can you guys hear me okay? Is this one on? Okay, good. I can't... I don't see a volume button, but you can hear me okay in the back. All right. Well, thanks for coming. I'm really excited that you're here. And I'm also feeling a little vulnerable along the lines of the talk. So this is my first time speaking in DEF CON, and I'm a little nervous, but I'm here to help you and hopefully make your jobs easier. So thanks for coming. I'm going to start out with... oh, I'll introduce myself first. I'm going to start out with me. This is a friend of mine that I made in Bali and me, a baby elephant. I started my own company this year because I wanted to teach full time. So I teach application security to developers. And I have over a decade of AppSec experience now. Just by a little bit. And I love to travel and tell jokes. They are not always good jokes, but I will tell them anyway. So nobody brought tomatoes, I'm sure. So I'll give it a try. So first... sorry. All right. Just a quick history lesson. So we know kind of the history of where the tools that we use today came from. So back before I was born, there was the very first static analysis tool called Lint. Now, Lint was basically a syntax checker, right? So it didn't check for any security vulnerabilities like SQL injection or cross-site scripting because they didn't exist yet. So they came into existence in the late 90s. And then we started to have some dynamic testing tools. So Nessus came into existence. And I don't know if any of you remember back in the day when you had to use a modem to get connected to the Internet. Back then, websites were just pretty much static HTML. And then along came this little site called MySpace. Now, for those of you who are kids in this room, MySpace was like Facebook, only before Facebook. And it had all these fun features where you could customize your background and put custom JavaScript code. If you were the loneliest person in the world to ride a worm, make everybody your friend. So this... I'm just... I'm not blaming MySpace for the state of web application security today. But I did notice there is a proliferation of security tools that came up after this point in time. So we got Coverity, Fortify, Metasploit, one of my favorites, Burpsuite, another favorite. And then we have open source tools coming into existence to check to make sure that your dependencies are not vulnerable. So things like Black Duck. One note about this, most of the open source tools that you're going to use to scan your open source code are only going to find known vulnerabilities. They don't necessarily find the zero days. So just word of warning there. And then we've got some more tools, Acunetix, Checkmarks and Veracode, our sponsors. Made sure I got them on the slide. OWASP Zap came into existence. Whitesource, another sponsor. Thank you. And Snyk. I may be saying that wrong. That's one of those things I've never heard said out loud. Also of note, and I'm not going to talk a lot about this because I haven't actually used these tools, but there is in recent years something called IAST. The I stands for interactive. So it's interactive application security testing. It's another option. Since I have not actually used them myself, I can't speak to it much. And when I Googled IAST tools, Google was like, did you mean SAST? No, I did not. But thank you for the condescending suggestion. So anyway, so a brief history. Now, moving right along, I have a Venn diagram for you because I love Venn diagrams. So there's what they're good at finding. And I have some SAST and DAST vulnerabilities. So they're both pretty good at finding the OWASP top ten. And I like to remind people that it is the top ten. It's not all of the vulnerabilities. Just the top ones. So things like PCI compliance. Anybody deals with PCI at work? Yeah. So there's more than ten vulnerabilities is what I'm saying. So SAST tools are somewhat good at finding weak crypto. And I have an asterisk there because it's sort of. Like they look for the really obvious things. So are you using DES in your code? It's going to kick out an error message that you're using DES. But it's not going to find implementation flaws. And there was a pretty good talk earlier which talked a lot about that. So watch the recording. Or some of you were here. They're pretty good at finding hard-coded passwords. Or keys or things like that. Because you're scanning the source code. Things like memory leaks that might cause a denial of service. And then dynamic application security testing tools. Find things like poor session management. Missing security headers. Default passwords. And insecure server configurations. So there's a little bit of overlap. But obviously it's good to use both. Right? Now you're all here to hear about what they're not good at finding. Right? And I have a whole list. Not a complete list. But some highlights for you. The first one is business logic flaws. And this can be all sorts of different things. Uh, my favorite example, though, is just a poor password reset logic. So I, personally, I have a grudge against cognitive questions. You know, the, what street did you grow up on? That sort of thing. So weak password reset functionality is something that your tools just aren't going to find. Right? And, and many other things. You can have, uh, if your process for the call center to identify a customer is weak, then they might be vulnerable to social engineering. Things like that you want to keep in mind. So weak or reused passwords. Now, fun fact, 75% of internet users admit to reusing passwords across multiple accounts. Now, the other 25% don't admit to it. Right? So password reuse is a huge problem and that's not something that any one of your tools is going to find. But with all of the data breaches lately, credential stuffing is a thing. And something that you need to be concerned about. So just keep that in mind. Next up, uh, configuration whoopsies. There was a very recent data breach in the news in the last week or so that was caused by a web application firewall having too high of permissions. Now, I don't know of any tool that's going to find that. It might be out there. Um, but that's one of those things that it was just, it, not using the principle of least privilege led, led to a huge data breach. So are you paranoid yet? I have more. Okay. Alright. Next up, denial of service vulnerabilities. Now, with an asterisk. So there, there are some denial of service type of vulnerabilities that your static analysis and dynamic analysis tools will find. Dynamic analysis tools tend to find them accidentally. Has anybody experienced that? You run a scan and denial of service. Yeah. So, but that, that's not maybe the best methodology for finding these things. Uh, so there, there's all sorts of things that can go wrong. For example, if you have a developer that wrote a very poor SQL query that takes like 17 seconds to run, that's going to bring down your SQL server eventually. And then with repeated requests. So anytime you have a server response that takes too long and you can send repeated requests, you can bring down the SQL server and then anything tied to that SQL server will also come down. So that's not something that any tool is going to find, but if you have a good DBA to review all the SQL queries, that will help tremendously. So, uh, rogue developers is another one that keeps me awake at night. So, um, let's see. Oh, uh, so something that you want to consider is that insider threats may actually be coming from nation state actors. So I, a lot of times we think about rogue developers and oh, well, they're just mad at the company, right? Um, but in fact, if you have a big enough company with, uh, valuable enough data, there might be somebody with a Russian accent that applies for a job, say. Not going to pick on the Russians, right? Because I don't want to get hacked. Um, so if there's any Russians in here, I, you're, you're great. I promise. Okay. Anyway, um, so next up cryptography disasters. So a very good talk about that earlier. There's so many things that can go wrong with cryptography. So if, if you're not comfortable with cryptography, you definitely want to have somebody help you out with that. Uh, but basically never write your own crypto. That is rule number one of Crypto Club is never write your own crypto. And rule number two of Crypto Club is never write your own crypto. So, and even if you're using a standard encryption algorithm like AES, if you use ECB mode, for example, then your crypto is insecure. So lots of things can go wrong there. Tools may or may not necessarily find them. Right? And then good old layer eight vulnerabilities. Um, things like phishing, social engineering, or your standard ID10T error. Uh, these are all things that are very much, um, they, they, they can affect the application security of, they can affect the security of your application. That's what I was trying to say. Um, so, uh, just lots of things can go wrong there. And then secrets stored in weird places. So my favorite and most, most trendy example of this lately is a JWT payload. So you have a JWT, a JSON web token, and perhaps you have a developer that sees it in the developer tools, oh, oh look, it's obfuscated, it must be encrypted. It's not. It's base64 encoded and anything you put in there should not be a secret. So that is something that, uh, just have to do some manual testing to find, I guess. Uh, things like text files. So I have seen a text file with usernames and passwords in it that was publicly available on the internet. Not great. Uh, config files, sticky notes, still happens, et cetera. So, uh, false negatives, uh, when your code is written in other spoken languages. So this is something that may not seem obvious to most, but for static code analysis tools, some of the rules will look for variable names. So if you were looking for, say, a variable called password, but your coder is speaking Spanish, then it's, it's not going to find that. So that's something that I've actually had happen a lot. So you get the scan results back in and it says, uh, all these, it's highlighting all of these password variables. What do I need to do? Should I change the variable name? It's like, no, you should remove the password from your code. So, all right. Sensitive information and error messages, that's, uh, fairly self-explanatory. I don't have an example for that. You know what that means. So insecure APIs, there's still a lot that can go wrong with, uh, writing a new API. So, uh, it's most of the dynamic application security testing tools have a harder time testing APIs without, uh, complete documentation. So you can't just spider an API and figure out everything that's there. Um, and even though we've taught developers to tell people, oh, username and password, right? So when you have an invalid password, you give them an error message back, invalid username or password. So that's pretty standard practice nowadays. But let's say you write an API that checks if a username is taken. So now all of a sudden the attackers are able to enumerate usernames. So it's a way around that. Uh, it was just a very simple example I had. But, uh, next up third party integration flaws. So let's say, for example, you are integrating with an identity provider and the identif- the identity provider is configured to allow for open redirects. So what can happen in that case is an attacker can use phishing to have a, a user enter the username and password on the valid identity provider site. And then it redirects to the malicious site with a token, a valid token. So open redirects are dangerous there. There's many other things that can go wrong. Um, grab a drink of water. Hold on. So, you with me so far? Everybody still awake? Okay. Alright. So how to find them? There's the hard way, which I'm sure most of you are very familiar with by now. So, uh, AppSec pin testing. Uh, or just eyeballs on code, code review. And I had a very hard time finding a GIF that would appropriately represent code review. Uh, I hope you like this one. I spent a long time just reviewing code and that was my face most of the time. So, but I have some suggestions to make your life easier. So, the easier way, I call this the Lord Varus approach. Now, for those of you who have not seen Game of Thrones, it's okay, I will explain. So, Lord Varus was the master of information in, in Westeros. And his technique for gathering information was he had all of these spies around the city and around the country, really, that were children. Now, I'm not advocating for child labor. Please don't do that. But, uh, what you should do is just use the same approach to gather information within your own organization. So you can have an internal bug bounty and even if you're not ready for an external bug bounty, you can reward your employees to come to you with vulnerabilities. So, the idea here is just to, to make it as painless as possible to report security vulnerabilities to the security team. Now, a lot of us maybe, uh, have a reputation for being difficult to work with, highly opinionated, it's okay, it comes with knowing what you're talking about. But, uh, just the point here is that you want to reward people for coming to you and, and give them props. So, yeah. It's my, my favorite method for gathering information. No child labor, though. Right? Okay. Uh, next up is threat modeling and I'm not going to break down threat modeling because there is another talk tomorrow that you can come and see, uh, at, uh, 1330. So, highly recommend coming to see the introduction to threat modeling, but for those of you that are in here, I'm gonna assume that you're already familiar with the process, right? So, um, I have a tip for you as you're doing threat modeling that if you can really master this principle, it'll, it'll change your life. I hope. Um, so when you're doing threat modeling and you gather everybody in a room, say, and you're, you're asking questions about the architecture diagram and it's like this and that, um, this will change your life. The art of asking an open-ended question. Okay? So, it's very simple tweak, but it'll make a huge difference. So, instead of, is this connection encrypted? Every developer you talk to is gonna say yes to that question. Of course it is. Everything's encrypted. So, instead, ask, uh, how is this encrypted? And where do you store the encryption key? And if they don't immediately know the answer to that, then that's something that you wanna dig deeper into, right? So, that, that's, that's my big tip for, for threat modeling. So, there's stride and dread and all the other things that spell six letter words. Um, but, this, this is what you really wanna master. I have another example for you. So, instead of, do you have any sensitive data in this database? You ask, well, what kind of data is in this database? So, and then they have to answer this question and sometimes developers may not know what's sensitive and what is, what's not. So, instead of asking them to decide, just give, give them, just get the schema and review it yourself. That's probably the best method. So, I have another tip. Uh, just the, uh, what I call the full circle development lifecycle. So, using feedback from all of these methods. So, you have your tools and you've got pen testing and threat modeling and code review and maybe an internal bug bounty. Uh, so, what you wanna do is you wanna find the bugs and I know, how many of you have experienced a situation where you stop there? And that's, that's the only step. Is just finding the bugs. One person admits to it. You're brave, sir. Thank you. So, the next step is to fix the bug, right? Seems obvious, doesn't always happen. And then what you wanna do from there is just integrate that back into your automated test, right? So, write a new test case that has to do with that particular vulnerability. And then you write some new code, or the developers do. You deploy the new code and you find new bugs. Rinse and repeat. So, and then preventative care, of course. Just preventing vulnerabilities from getting there in the first place. Now, there's a few things that you can do. Uh, the number one is education. And so, that's why I love that you asked that question. How many of you are training your developers? So, it's, it's a really important thing to do. That's, that's why I do it. I'm very passionate. I might be a little bit biased. But I really think that if you train your developers in security, then they're going to have the knowledge to just keep from, you know, writing the vulnerabilities in the code in the first place. And, uh, let's see. So, the next recommendation is, uh, using secure default configurations. So, for those of you using containers and AWS, uh, just don't, don't let your developers shoot themselves in the foot. Right? So, just have secure defaults and a template so that, that is set up and it makes it easy for them. Right? Um, configuration management. So, with all of the tools that you can use to, to run scans, uh, and then I would really highly recommend setting up some automation to automatically fix what you can using microservice, micro-services. And, uh, this, this one's really pretty important with, uh, the nation state actors nowadays. Uh, but just a comprehensive background check for your employees. So, a lot of times it just, the background check makes sure that they don't have a criminal record, but there might be a little bit more to it. So, I don't know if you have a good rapport with your HR department, but I highly recommend that. And I have clearly been talking way too fast, cause I, I'm, I'm out of slides. Um, but I will take questions. So, does anybody have any questions or certainly there's probably things that I've missed, but yes. That is a fantastic question. So, for those that didn't hear the question was, how do you do a bug bounty without encouraging developers to write bugs? That, that's a great question. Um, you, I mean, you do have access to the check-in history to see who wrote what code. Um, but no, that's a fantastic question. Uh, well, peer review helps a lot too. So, it perhaps just changing the process so that when, when you are doing a peer review, the developer does a peer review and they find a bug, that's the only time that you can report a bug, but then there's a potential for hiding bugs. So, uh, it's a really excellent question. I will think about that. I'll get back to you. So... I have done that too. Yes. I've definitely looked at old code and I'm like, oh, oh, that's embarrassing. Yeah. So, uh, knowledge is just a, knowledge is power. So, I, but that's why you're here. And I'm glad that you're here. Yes. Okay. Oh, an internal education program for the developers. First step, uh, it, well, I, I, I've done that myself. So, the first step was creating about 350 slides. And then, uh, the next step is talking to the executives in charge of the developers and getting their buy-in. So, that's really the most important part there. Because if, if they don't think they have to go, they won't go. Right? It's not, it's not optional. You have to go to training. So, getting executive buy-in. Actually, no, that should be the first step before you waste your time on the 350 slides. Um, yeah. That, a great question. How do you evaluate competency, comp, competency. See, I'm still talking too fast because I'm nervous. Um, after training. Uh, so, what I've done in the past is have a quiz before and after to see the effectiveness of your training program. So, uh, yeah, just compare results. It'll, it'll go up. And then, uh, another thing that I would recommend for an internal training program is, is keep it in the developer's face all the time. So, it's not like an annual training. But to have something at least once a month so that it's in their face, they're always thinking about it. And they're always, uh, learning more about security. So, yeah. Yes? Uh, some of my favorite metrics to track for what? Uh, the number of vulnerabilities is probably the most important one. So, take all the data from all the tools and put them in the same place. And hopefully that number slowly goes down. So, that, that's probably the most effective way of tracking how effective your AppSec program is, I think. Yeah? Does that number always go down? No. Because the developers are writing more code. It does not. So, even if you did stop, there's more code. So, if 10% of the code has bugs, you're gonna get more and more bugs in the list. Yep. Absolutely. So, you could track vulnerability density as well. So, and, uh, at, at my last job, I actually had a competition between the development groups. So, the, it was just a scorecard that everybody knew where it was. And you'd take the vulnerability density and, uh, whoever was at the top of the list got a prize for the month. And they got really competitive about it. So, that's combining social engineering with AppSec to manipulate people into fixing the bugs. So, yeah. I like this Q&A session. I'm, I'm really, I talked so fast. Oh, my gosh. I'm gonna have to watch the recording and, and laugh at myself. But, um, yeah. Anything else? Definitely. It, well, yeah, you do have to kind of start with the basics. Um, so, OWASP top 10, as I say, are just the top 10. That's kind of the bare minimum for web developers. But I definitely would advocate for, for training in more in-depth and especially just whatever somebody needs to know to do their job. So, um, AWS is, is one that's being very widely used. And there's so many features. And there's so much to learn that, um, yeah, it's, it's still pretty easy to screw up even if you know what you're doing. So, I definitely advocate for, like, role-based training. And, yeah. That's a good question. I see two hands. Yeah, I saw you first. Oh, that's how to scale finding business logic flaws? Is that your question? Mm-hmm. Well, it, it's probably a slow process. But once you find one, then just, you know, write new automated test cases to test the new and existing code. Um, but I'm, I'm sorry, I'm not sure if I understood all of your question. Oh, to find them? Uh, learn the business. Like, learn the ins and outs of it. So, as a security person, you should know more about the business than, than your boss does. It is. It's very difficult to find, but the more you learn about the business and how it works, uh, the more likely it is that you'll, you'll find things. So, yeah. Oh, that's a great question. Um, I have seen, so, in design and story development, have, like, a review process where there's, there's, like, a questionnaire. So, when you write a story, there's also a security questionnaire. So, it, it's a fairly basic way of doing things, but you can scale things and, um, just by having them ask a few questions. Like, are you dealing with social security numbers in this story? No. Are you dealing with passwords? No. Are you dealing with cryptography? Yes. And so, the things that are kind of the low-hanging fruit will automatically get kicked up to the security team for a review. So, that way, you don't have to review thousands upon thousands of tickets. So, does that help? Okay. That is a great question. And if you're in an organization where you're working against reputation, uh, I think the best thing you can do is just, uh, have you read, uh, How to Win Friends and Influence People? Read it again. I read it every year. You know, uh, it's, it's a good review, but it's, it's hard when you're already working at a deficit, but to just try to change the, the perception of the security team. So, um, you know, do nice things for them. I see, and I, one recommendation is every time you have a meeting with a developer, just start it out with, I'm here to help. Let me know how I can help you. And then, um, just kind of live with that attitude, I guess. And it'll, it'll get there eventually. So, but I, I've dealt with that a lot of, especially when a brand new developer comes in. It's, oh no, you're the security team. You're going to tell me I'm doing things wrong. Um, but you'll win them over eventually. Patience. I know it's hard, but, yeah. Um, yeah. Sorry. Uh, both. Yeah. I think you have to understand the principles before you can really exploit them or fix them. But, yeah, for sure. Uh, so I love hands-on training, though. So, because that's the best way to learn by doing. That's how I've learned all of this. I didn't go to school for this. So, good question. That's a big bug. Okay. Well, I, I wanted to say thank you to Owen and Adarsh and Vivi for helping me with the writing process of this. And I'm so distracted by the bug. I'm sorry. Do we have any bug hunters in here? Five dollars. Yeah. And then, um, let's give a big round of applause for all the volunteers and the people who organized this. And I also want to thank you for being here. And, uh, asking such good questions. And, uh, for all of your hard work in what you do. So, AppSec is really important. I'm very passionate about this subject. And I'll be hanging out outside if you want to come talk to me later. Um, but, yeah. Thank you. Thank you for being here.