Morning guys. Uh, can everyone hear me in the back? Okay. Uh, so my name is Magno Logan. I'm gonna be your host for the rest of the day. Just introducing the speakers here. Uh, it's an honor to be here and be volunteering and helping this village. Um, so yeah, without further ado, uh, I'd like to introduce Yangyang Wang. Uh, she's a cloud security architect, uh, leading implementation of security tasks at HITRUST. Uh, she has led integration security into various CICD pipelines, uh, and created successful security programs and culture. And she's going to be talking about automate pain testing in dockerized CICD environments. Give her a round of applause. Thank you. Good morning. Thanks for coming. And I hope you're happy by end of the presentation. So today's topic is about, um, automation, uh, in, uh, automating dynamic application security testing in CICD pipelines. So before I start, how many people are actually very familiar with the CICD pipelines? Okay. How many people here are security professionals? Okay. I see some overlapping here. All right. That's good. So before I start, um, I wanted to, um, to say that I'm here on my personal capacity. And what I say, what I express in this presentation does not represent my organization. So the outline of the presentation is that, well, you know, in the me and I age, I have to introduce myself, obviously. And then, uh, I'm going to briefly talk about the CICD pipelines because I know some people probably are not, um, I mean, probably know something or not a lot, or some people don't know. So I'm just going to cover it quickly. And then I'm going to talk about some characteristics of the CICD that's relevant to pen testing. And then, um, I'm going to talk about the reasons of this project, which is the challenges that I encountered trying to automate a dynamic testing task in CICD environment. And then I'm going to introduce the approach that we, we did, and then how we integrated with Selenium test to make it even more awesome. So who I am? I'm a cloud application security architect. And so it's a mouthful, I know. And it means a lot of different things to different organization. But I live in San Francisco, in Bay Area. I think generally, um, architect, particularly in startups, it means you do everything, really. So I want to talk about the CICD. Um, so CICD stands for continuous integration, which means that you commit your code multiple times a day into a centralized repo that you share with your team. And then continuous delivery, that's what CICD stands for. That just means every code should be releasable and that you can, you can deploy a code on a push of a button. And the pipeline means from the, uh, the automation of the entire process, starting from when developers, uh, commit their code and then build tests and deployment. All of this is, uh, automated, meaning everything is powered by code. There is no physical environment that you have to deal with anymore. So why does it matter? Um, so I wanted to just compare what, what, uh, um, software integration is before the CI and what, uh, software delivery is before continuous delivery. And so that way it will be clear why the existing tool, the pentesting tools are not suitable for the environment. So before continuous integration, when people, people, they, engineers, they write their code on their own and they test it in their own local environment. And then they integrate. Sometimes it's a week, sometimes it's a month. And then that big gap, big bang happens and things will fail in, inavoidably. And so you might, you know, really, if you're all software engineers, you know how mid to the deadline for delivery is hard, especially in the past. And I don't know how many of you are actually in CICD environment, but if you're not in this environment, it's pretty hard. And if you are, it's still hard, but slightly easier. So when continuous integration comes and engineers have controls of almost everything. You, they write code, they write the tests and, and all the tests are automated and happening as they're writing the code, merging the code, and then the build happens right there after they merge the code automatically. And so it's, it's all together. By the time the code gets to integration stage, the test will happen automatically too. And if there is any issue, it gets the commit fails and they have to fix the issues, whatever that is. And then for software delivery before the continuous delivery, and you have to have someone to do the test after integration, and you have to have a team to do the deployment. And obviously there are human interactions there to get it, to make it happen. And with continuous delivery, and it's same thing when engineers commit their code, all the tests, all the release tests, deployment tests, all happen there. And so, theoretically, when you have, when your code is done, it's committed and it's merged into the master branch. And sometimes it's even in local branch and your code is, everything is okay. It's ready to be deployed, supposedly. However, when it comes to implementation, there are shades of gray, obviously. And most of the time, there is still some kind of human interaction for deployment. It really depends on the company. So, this is something I found online from Instagram website. I don't work for Instagram. And that's just to illustrate how fast things are moving today. And they deploy their backend code 30 to 50 times a day. And oftentimes, most of the time, there is no human interaction at all. And what they're saying is that their engineering moves fast. So, that's one of the key words for CICD, fast. And then, make it easier to find your bad commits and fix them. So, that's another key word too. And particularly, in the sense of finding your security bugs. I will come to it later. So, I just touched the characteristics of CICD pipelines in terms of DAST testing. I haven't explained what DAST is. And I assume most people here know. And if you don't know, can you raise your hand? Okay. So, dynamic application security testing basically means you have to have a running app. And then, you either manually or use a tool or both to point to your running app and look for security vulnerabilities. So, anyway, the characteristics that's relevant to automate your DAST is the build are repeatable and deterministic. And then also, that everything is automated. All the release, all the testing, testing, different testing. And also, they're really fast. So, the reason that's relevant is because when the build is, when the entire process is repeatable and deterministic, obviously, if you think about it, if you can automate your security testing here, then you have a repeatable and deterministic way to do that as well. So, that's why it's relevant here. And then that's automate. That means, you know how often times security teams would chase after the engineering team and often times would say, that's deployed, I don't know. Oh, that's what happens? No one told me. I mean, every one of you said that, I guarantee you. If you didn't say that, you're not a security person. I've been in this field long enough, I know. So, when, so if you think about the automation, then, and it's deterministic, then that means you can automate your security steps and do the same thing, which is a plus sign. And that, to me, it's a good thing. And then, also, testing environment. In the past, you have to set up a environment specifically for testing and you have to wait for people to tell you which one is going to be released and you're going to deploy into the testing environment and you're going to test. None of them is necessary anymore for CICD pipeline. And so, challenges. If you look at the existing DAST tools, oftentimes, it needs some kind of human interactions. They want you to put a URL in there. They want you to put the credential in there. They want you to put parameters there, what to exclude, what to include, this and that. It seems like, is it even worse to automate that? Because some tools does offer API tools to let you automate that. But it's like, this still involves a lot of human steps. And then, also, this is relevant if you are running in a containerized environment. You have to have a running app. And I will touch that later a little bit more. And also, oftentimes, with the existing DAST tools, you have to have a separate reporting system where someone else, where whoever's doing the test have to log into the UI, find the vulnerabilities. And generally, you create a Jira ticket or some other system, whatever. You know, if you wanted to make an engineer do that, you know what they're saying? Because I've been told that I have too many tools to run. I don't want to log into another tool. Yeah. So, if you think about all the CI, CD, and the state of the DAST tool, you would be thinking about panicking. What do I do? Because it's a black box. Code gets into the pipeline, and production website comes out of that pipeline. So, fear not. So, what we can do is unpack one of the CI, CD pipeline, one of the process from beginning to end. So, oftentimes, you would always have an SCM, let it be GitHub, GitLab, whatever you're using. And then you always have to have some kind of build testing. And in CI, CD environment, it's automated. But most of the time, build testing are automated to some degree today anyway. And then you generally have some kind of integration test. And in a very automated environment, the build test and integration tests are usually combined. And then you have production. So, build server. What is the build server? It's nothing but a server that you can do anything in it, run anything in it. So, awesome. You can run any kind of security testing there, too. And then, so, that means you have two places. It depends on your environment. You may have one or two places that you can do security testing. And that's during build tests or integration tests. So, with that knowledge and the knowledge of... well, with that knowledge, so, I know my requirements for a DASTA tool is that this tool needs to be completely automated. And no matter which environment I'm testing, I have to be able to integrate it easily. And then it should produce a report within the CI, CD pipeline. So, whichever tool that you're using. And then it should be relatively fast, because fast is one of the characteristics of CI, CD pipelines. And it needs to be scalable. So, before I get into the details of how we implemented it, I want to talk about a little bit of container images or containers, just in case that any one of you are not familiar with it. Container, basically, think about the OS in the old time. Basically, you have everything in code of that OS. So, it's lightweight, stand-alone, executable package of software that includes your code library and configurations, everything you need. So, no matter where you have this container, you just start it and run it. So, that's the idea. And then with container, oftentimes, companies will do orchestration, meaning managing the life cycle of the container. So, you can think about that as an abstraction of network layer. So, you know how you have to set up, you used to have to work with the DevOps engineers to set up the environment and the network interface, how the servers talk to each other, how the servers can be accessed internally. All of those can be taken care of by orchestration layer. And that's code as well. So, that's what I was trying to say. There's no physical servers anymore. Everything's code. I know those of you who were here for the last presentation and Jim talked about how he thinks serverless is the future and then dockerization and orchestration, it's gonna die. Well, I don't know if it's gonna die in the future. I know that's what's happening right now where I am. I live in San Francisco and in my area, containerization is huge. So, this is just some statistics I found on Datadog. So, this was, this data was like March last year and it was saying docker runs on 20% of all the servers they monitor. And then there was a 75% increase of using docker. It's like March, the year prior to that. So, you can imagine it's a lot more now. Actually, where I am, it feels like it's 100%. I mean, my unbiased stats, obviously. And also, another thing to be noticed is when companies use orchestration, servers goes up and down all the time. That's another challenge for DAST testing, obviously. So, um, so now I know what we want from a DAST tool in DAST environment. I know where we can integrate it and I start looking for tools. And, um, I know I want a dockerized solution because that's what works best for us. And then I know there's a plus thing. I mean, it's a nice to have thing, which is integrated with the Selenium test automation. And because when you integrate with the Selenium test, then you test exactly what's released, no more, no less. And that's, to me, that's somewhat important in CICD pipelines because with DAST tool, oftentimes you have to crawl the entire website and you have to test more than what you need to. And obviously that slows down the tests. So, um, and then you want the result to be available in the engineering CICD pipeline. To me, it's Jenkins UI. Um, and then, uh, the tool should find meaningful vulnerabilities out of the box. So that leaves me with two choices, ZAP and BURP. And so there is the existing docker image and it's well-maintained with a ZAP image and it's well-maintained by OWASP. And, but the findings are kind of limited. And so I looked into BURP and there is some kind of open source docker images, but usually it's only suitable for, uh, interactive use. It's not for automation. And so what that makes me think that I can automate it with the headless, uh, headless extension anyway. And the important thing is, uh, BURP out of the box produces a lot of meaningful findings. And to me, that was important. If I'm going to do something, if I'm going to spend my time, I wanted it to, to count, right? I don't want to just check another box and that's not what I'm here for. Um, so BURP, I know you can integrate with the Selenium tests. In ZAP, I looked for information. I didn't find any, so I'm not sure. And adding that, I think the findings wasn't sufficient. So I decided to go with the BURP. So, um, here's, uh, I guess, uh, it's unfortunate for now. Um, I got this, uh, acceptance for the talk like two, three weeks ago. I didn't have enough time to work with my organization to open source it, but we're working on it. I work in a, uh, highly regulated environment. We have, um, we have HIPAA data. It's, uh, very restrictive. So I have to go through a lot of hoops to get it open source, but I'm getting there. So with that being said, I can talk to you on what I did, but I won't be able to show you the source code. Not today. So, um, headless BURP extension, um, if you haven't used it, it's a command line interface, uh, that you can use with, uh, BURP suite. And then it's usually used for automation. And one of the, another, uh, some of the good things that when you actually, uh, integrate with the Selenium tests is, uh, um, beyond you test exactly what you release, no more, no less, and you can pass the URL and you can pass the TLS search, well, and credentials, um, pass. I mean, you don't have to do anything. Basically Selenium is a headless browser and it just calls your website and the QAs have to do that anyway. So they have that part set up and you set up BURP to listen to the Selenium traffic and it's a passive listen. It captures all the credentials, the URLs, and, and then the search is set up from QSID. You don't have to worry about anything. And imagine if you were gonna, um, actually deal with any other, that's the two, those are the things you have to do manually. So integration with the Selenium helps tremendously when it comes to automation. And then, uh, with the headless BURP, it also produces the JUnit and HTML reports and also might integrate that with Jenkins UI. And also the headless BURP has a feature that you can tune the false positive off and that will just produce actionable findings. So the steps of, uh, Dockerized headless BURP is this, that's what I did. And there are about like four, five different open source, the BURP, um, BURP doc images on GitHub. You can find them. But this particular one I found it most useful. If you follow this guy's instruction, you will get to the UI phase. And then after you have the doc image, uh, created locally, then you have to build the proxy and the scanner, the BURP, the headless BURP proxy and scanner, and then copy that into the doc image you have. Sounds straightforward enough, right? Um, there are a lot of bumps, sweet bumps that I had to go through and I'm sharing it with you guys. Hopefully you don't have to do it. Actually, if you knew exactly what I'm talking about here, your speed of Dockerizing headless BURP is going to be a lot shorter than mine. And so basically the only way to active BURP license is through the UI. There is no other way. And then use Docker volume option to persist your data, whatever you need to persist. And then, uh, this reference is actually, um, from BURP suite. It's, uh, it's on their support page and they will tell you, they will help you to Dockerize, uh, their BURP. And so if you have questions, I suggest you to go there, check it out there, and you'll find some valuable information. And then, um, you have to build the headless proxy and scanner because, uh, the app in the BURP B app does not work. It didn't work with me. I don't know why. And so I built it myself and it worked. So another thing is if you want your BURP to work with Selenium, you have to set the listening mode to all interface because you have to listen externally versus internal. And, um, yeah, I can't stress enough. And so I followed this guy's instruction and then I forgot to restart my computer and it didn't work. And I stuck and I was like, what's going on? And I had to post the issue on his, uh, GitHub repo. And it turns out I just need to restart my computer. I just read the instructions more carefully. Problem solved. So any questions about this? I think I'm using 1.7.17 or 17.7, something like that. Yeah, the newer is the way I tested. It didn't work with, uh, the headless proxy and scanner, unfortunately. This is kind of a boring question. Yeah, I think that's a question you should talk to Port Swigger. Yeah, I, I practiced like 100 times. So yeah, so the Docker license is different than the BURP suite for a license. You need a separate license for Docker version or no? I checked the online. I don't think they have that model right now. Yeah. So yeah, license question, you should all talk to the company because I have no idea how they do it. The reason I don't know either yet, I, I'm going to talk about it in a bit. So once you have a Docker and if you work in a company, you're doing this project for your company, this is the time you hand the Docker repo to your DevOps guy and then tell them what you want and the magic will happen. So basically that's what happened to me. So what happened is I checked in the Docker image and it immediately tricked a build in our build server and then the image got pushed to our, to the image, our image registry and, and then, and then the rest I POC'd it out and worked with a QA team and we tested it out with Selenium and everything worked out like much better than I thought. I can't complain really. I thought it was better than I ever asked. So unfortunately, like I said, I'm here on my personal capacity. I couldn't show you a live demo. There's no way I'm going to show a live demo in DevCon anyway. So, but I recorded a, I recorded my screens to go through the entire process in this image to just give you an idea of what happened and what the end result is. So before I move on to that demo, I just want to talk about it. So we actually integrated with the integration tests and so we haven't done for like all the engineers when they run their tests that we haven't done there yet because right now we have other issues to solve before we can move there. So that's another reason I didn't know. So, okay, I'm going to do the demo. I guess it's going to go through very fast. I can't pause it, it looks like. So this is, I'm showing you, I'm just trying to show that I made changes to the Git repo. And it's going to show up and will trigger a test, a CICD, will trigger a build in the CI server. So I made changes in the readme file and then I had to commit it. So now the code is committed. Git push made it happen. So I'm going to refresh the page. And this wasn't there, the DevCon demo online wasn't there, now it's there. So commit was successful, now I go to our CI server. So those are the steps that happened. I wish I could pause it. Maybe I could, yeah. So those are the steps that happened after the build was triggered. So I think this is okay to talk about it. We actually used CircleCI. And in CircleCI, they spin up a Docker image, they set up the environment, they do whatever task you ask it to do. So in this case, build a Docker image, in their Docker image. And then it pushed the image to our image registry. So this is where the integration happens in our environment. We're still trying to move it into one environment. But suffice it to say, once it gets into integration environment, it triggered a burp proxy, it started it up. All of this is automated, no humans are doing anything behind. Usually you're committed to your own branch. I mean, it depends on how your organization is set up. But unless you're doing it yourself, I would imagine you have to have your own branch. So I had my own branch, and it got pushed to the master because of that. Everything's done and I'm finished working on this project. I'm sure there will be maintenance, but right now it's pretty much done. So that's why it was committed to master. So this test took 23 minutes. It's relatively long, but I also had a test that took about 5 minutes. So this is another thing to consider when you want to do integration. How long it takes to actually do the test for your environment. If it's too long, you probably won't be able to integrate with the development pipeline. So that's what happened in Jenkins. All the reports were generated and they were actually posted into Jenkins. And then there's a stack message sent to me, so I know that a report is done. Because it's still kind of early for me, I'm still manually tuning the tool. So that way I can feel comfortable to hand it to everyone and just say, Hey, go ahead and take it. Everything's okay. There's very few false positives. Because with all the security testing tools, I'm sure you all know, it always has a false positive. And then a lot of things are environmental, you have to tune them off. That's in the plan, we haven't done it yet. Because like I said, I don't feel 100% comfortable that I can just fail build yet, because I haven't finished tuning the reports yet, like the false positives. And then the second thing is, your website that you're going through, do you happen to be using REST API, or what are you using to test it? Good question. So right now, it's an integration test into the UI. It's actually powered by the Selenium tests. So I have thought about the UI. I thought that I can probably integrate it with a REST API tool. So that's my next step. Maybe it's a basic question, but how did you do it? So you see that the step here, publish HTML report. Once this gets done, it produces a report. So when the report is produced in Jenkins, you can actually post it using code to post it into the UI. Using a webhook or something? Actually, it's not webhook. We use a... I don't know if I can talk about our environment. We use a specific kind of way to post things in Jenkins, but it's code. It's not webhook. It's custom code. It's not that custom. You can find sample code. So I think that part, I should be able to open source it once I go through all the hook. And I will post the sample code online. You should be able to see it and you can just use it. So theoretically, you can go all the way back to GitHub and then into the IDE of the development. Yeah, that's the idea. Yeah. So with Selenium, you know, it's a curator. It does all the function tests for the particular feature you're going to release. And Burp is just out of the box. I didn't do anything special. I haven't started tuning it yet. But I'm curious to see what I can find once I start tuning it. Yeah, so theoretically, you could replace Burp with a commercial, really available, endless, dynamic schema. That's what I'm thinking. Yeah, that's what I'm thinking. I hope the commercial tools, if there are any representatives here, they're listening. I listen. Yeah, because I don't have to do this. I can spend my time doing other things. I was wondering, are you getting pushbacks from the developers? Because I'm getting pushbacks from the developers saying anything over a few minutes. And they're concerned about, because they want to do this integration multiple times. And if you start putting this in sequential, eventually we're going to have multiple security tools running this. We've got to parallelize all of this and potentially run this on multiple build services. Yeah, so I can see that. So I did the integration phase, so it's a little bit later already. Usually QA, that's QA's group, and usually their tests take an hour or two anyway. So they don't mind. But I know what you're saying. So what I was thinking is, to make it happen within a dev environment, I might try out Zap. That's what I was thinking for what I'm going to do next. Remember that engineers develop their code and the tricks they build. And it goes through all kinds of tests, sometimes coverage and quality tests, all of those. You can add Zap there. That's my next step. Finding persistence between runs? Can you check the same findings between runs? Yeah, if the code is the same, the findings are the same. No difference at all. It works pretty well. Yeah, so that's the part where I said it works pretty amazingly when you use Selenium. Initially I thought I had to set up a burp, but it turns out none of this is necessary, because Selenium has to handle the credential itself. And once it logs in, the tokens get carried out in the subsequent requests. So there you have it. You don't have to deal with the credentials. So that's the report out of the box. That's the findings I have. I would say it's pretty good. For how cheap Burp Suite is, I really can't complain. Yeah, and that's the end of the presentation. Thank you. Any other questions? Addressing false positives per system? Yeah, so with Headless Burp, that's the part where I was hoping that their DAS representatives here, that they can come up with a commercial tool. There's a configuration file. You can add specific findings there as a filter, but you have to do it manually. You can do it, but it's kind of... there's a lot of work. Is that based on the finding type, or is it based on... That's finding type. Yeah, unfortunately. So in this example, even though you've only made like maybe five changes to the code in this particular reason, with Burp you're still testing the entire build, correct? Right, yeah, yeah. Have you given any consideration to figuring out a way just to test what's changed to make it even faster? You mean, when you say test, do you mean in the CI server? Well, when you run the Burp DAS, kind of. Can you configure Burp so, say, it knows from a manifest or something? You know, those five changes ended up in the code. So, I... okay, so I know where the confusion comes from. So the committing part, and then trigger test in CI and commit the... and then push the image to image registry, that's for Burp. The test is not for Burp. I used... I put the image down. So if I show you this diagram... So, what I did is I commit the code that triggered this entire process, and then the image got pushed here. And this part doesn't have anything to do with how I created the Burp image anymore. It just looks at the image, correct? Yeah, I just put the image... It doesn't know how the image was built, it just knows the image. What do you mean when you say it doesn't know how... So, like, if you have like a... You can have all kinds of rules, you know, manifest, YAML, all that stuff. But when you're testing on the dev side, does it know anything about that? Yeah, it... well, so... In this step, update deployment. If you're using some kind of orchestration... Yeah, the orchestration actually sends a request to your environment. So, if you're in a Kubernetes environment, Kubernetes receives the request, and it updates your environment by pulling the newest image to here. So, if you make changes, and there's another environment that's using the image, it will get updated. But we don't have to worry about it, because all those are set up via the orchestration. Right, so you'll have the previous image and the new image, so... Yeah, yeah, yeah, the infrastructure code takes care of it. Yeah. Yeah. I'm sorry, what did you say? When you change, you get the newest image? Yeah. So, the image, only if there are changes to the burp suite image that I made, the information will get updated via the update deployment part. The orchestration part takes care of that, to pull the new image, and know when to pull the new image. It only pulls the new image if there are changes. If there are no changes, obviously it doesn't pull new images. Yes, but... so, well, my username is pinkgladiator on GitHub. So, actually, none of us, once it's set up, none of us does anything. So, Selenium sends all the requests to the website you are testing. And burp proxy passively listens and records all the traffic, and then takes the information, the data, that it recorded from burp proxy. And then, when that's done, when Selenium test is done, I kill burp proxy, set up a burp scanner to scan the information I just collected from Selenium. So there are three types of tests you can do with this. You can test the app inside the container, you can test whether you can break out of the container, or whether you can achieve root ownership of the container. Which of those three did you test? This is a test application outside of the container. So, basically, it's nothing fancy. I didn't try to... you're saying if I tried to escalate the privilege to get the root privilege? None of those, yeah. We have hack one for that. We have. Yeah, that would be good. Okay, sure. Yeah, those things, you can't find them via this kind of automated testing. Yeah, it's a lot more complicated. Yeah. That needs human involvement, that's why we always have jobs. Yeah, I think that's it. My time's up. Thank you.