Good morning. Everyone showed up bright and early. It's a little early for a conference, but thank you guys for coming this early and joining us. My name is Ben Sadegopour, and I have Adam here. We every year come to DEF CON and we try to do a workshop that's different, and we'll talk about the workshop today. But this is, I think, a fundamentally interesting and useful skill that I want you to take away. There is a lot of slides to go through today, so we're going to go through them as fast as we can. I think he has 190 slides or something like that. 198 slides. So it's going to be very fast. It's going to be a lot of regex stuff, and then we're going to apply it to bug bounties. So tons of stuff for our schedule today. I will talk about some of the OSINT and how I apply this to bug bounties. Adam's going to cover, pretty much teaching you how to do regex. Again, if anyone here is really good at regex... Okay, I'm not either. I'm with you. Yeah, chat GPT. So yeah, we want to make sure you learn something and you can apply it. I think regex is a root cause of a lot of client-side vulnerabilities, some server-side vulnerabilities, and you can do a lot of good stuff with it on GitHub. So I'll let Adam... Actually, I'm going to introduce myself and then hand it over to Adam and I'm going to sit down. So I'm Ben. I've been doing bug bounties since 2013 or 14. I've done over 1.8 million in bounties. Majority of it since I've gone full-time since 2022 or 2023. Previously, I was the head of hacker education at HackerOne and currently Adam and I have co-founded a company called Hacking Hub, where we want to do more of these things and these workshops and courses and talks where we train the next generation of hackers. Most people have probably seen me on social media for my bug bounty stuff or content, but I also do some pen tests and content creation on the side. And you can just follow me at NahumSick on most social media platforms. Hey, I'm Adam Langley. Apologize if I have my head in the laptop, because like you heard earlier, I've got 198 slides, so there's a lot to look at and a lot to explain. So I started hacking in the late 90s. Got some interesting stories that I won't share quite on stage, but may exchange them for some drinks. Worked in web development for 20 years, then finally put both of those things together by creating CTFs and learning labs for people. You'll find some of my CTFs and educational content on Hacking Hub, HackerOne, TryHackMe, and other CTF events as well. As Ben mentioned, we run a company called Hacking Hub, where I'm the CTO there, and I build core applications, courses, labs, and learn CTFs. You can find me online at buildhacksecure. Okay, so just a brief purpose of this. Regits can always look very overwhelming, but we're here to help. We want to teach you the basics. It's not going to go through completely everything that's involved in Regits. There's different Regits packages as well, which some have some features and the other ones don't, but we're hoping to kind of give you enough information to make you dangerous. Using this will help you discover vulnerabilities and understand why they might occur. It'll help you search for things better. It'll help you discover secrets, and also I'll mention at the end some cool tools as well that you can build with it as well. So in summary, we're going to take you from this, hopefully, to Anoregits. Okay, so the first part is basic string matching. So in most programming languages, you have some functions in there which will help you work out if a string starts with, ends with, or maybe contains. So we've got Python, which it starts with, ends with, substring. JavaScript starts with, ends with, includes. You'll see a very common pattern throughout all the different languages. They all contain these things, apart from Go, which gets a bit crazy. It's got its own things with half-prefix and half-suffix, which is just a bit posh. Okay, so the first part of... so the problem with this is that it actually has limitations, so you can't always match the exact data that you want to. So let's just discuss the starts with limitations. So say if you've got a range of IP addresses and you want to see whether your client is visiting from one of those. In code, you might just have to have some horrendous if block or a switch statement to do that. With Regex, you can have this very easy to read thing to match all those patterns. Don't worry if you don't understand it, we'll break it down. There's just a few little things you need until you can have that moment where you go, I know what that means. Ends with limitations. Say if you want to check an email address to make sure it ends with a specific domain on there, or like a top-level domain, so you might have three different ones. Again, you can have an if statement or a switch statement to check for those things, or you can have a nice Regex which covers it in one go. And then it contains limitations. So imagine if you're running some kind of chat service and you want to check for any kind of dodgy input, making sure nobody's getting scammed and putting like credit card numbers in there. So obviously you can't search for every credit card in existence, you need to search for a particular pattern in there. And also that pattern can change as well, it might just not be like a straightforward bunch of numbers, there might be hyphens in there, or there might be spaces in there, which makes it very difficult to find that information. But then again, this simple Regex can actually match all those patterns, it can match for those digits, it can match for spaces, it can match for hyphens in between, just with that simple statement. So what is Regex? So Regex is a search pattern language, and it will help you find, match and extract specific parts of text from strings. Think of it like a state machine, so each of your Regex instructions, so you start at one place, if that rule matches, it moves to the next, and then it moves to the next, and then if that rule fails, it goes back to the beginning again, and it tries to match it somewhere else, until you've got all the way through, and you've finally got a match. So think of it like a flow diagram, where it asks questions, yes, no, and then kind of goes all the way down until you've found a complete match. So at first, you've got like literal matches, which is basically the same as like finding something on a page, and like hitting control F. So if you're certain, if you do a Regex, which is just hello, it'll find the string hello in there. So nice and easy. Then you've got, again, with like words, if you're searching for the word computer, we've just found, you'll notice that you'll find the word computer, but you'll also find the word supercomputer as well, which, so you've got kind of some false positives in here. This is where you can start using word boundaries as well. So you can wrap your words with this slash B, and then you can make sure that there's no characters either side of that. It does have exceptions for like punctuation marks as well. So like question marks, full stops, that works absolutely fine. But as soon as you introduce another letter in there, then that Regex will fail. It won't catch that word. Okay, and then we have anchors for starts with. So if you're receiving some strings, so say if you want to like get a website address, from an input field, but somebody randomly types in a whole string where there is a website address in there, but it's not where you think it's going to be. So in this case, you can see it's in the middle of the string. So that's no good to us. What we want is this symbol here, which is just a caret at the start, which says the string must start with HTTPS. You'll also notice as well that there's some special characters in there, like the forward slashes, which you have to put back first. So now you can see that this matches perfectly. And then on the opposite side of that, you've got anchors with the end width. And that's just a dollar sign on here. So if again, you have some simple Regex, which is example.co, you'll see again, the middle of it matches, which will pass the Regex rule. But of course, that's not correct, because you've got UK at the end. But if you pop the dollar sign at the end, you're basically saying you want example.co, and nothing else after that, not anything whatsoever. So now it's gone to blank, so it's not matching that rule. Again, you change the code back, and it's correct. One thing to note as well is the period symbol in here, which you'll see come up in the vulnerabilities. This catches so many developers out, and it leads to very interesting results. So this is actually treated like a wildcard. You'd think they'd use something like a star or something, or a percent symbol to cover this. But it's the full stop, which can basically mean any character you want, apart from a carriage return. So if you put the backslash in there to signify it must only be a period sign, you'll see the example.xco doesn't match anymore. Next is character sets. This is where you can start making some really interesting rules. So character sets, you have it per character. It checks the string, and it's each character. So the first one on this character set says it can only be the characters A, B, or C. So just in some example, if there's any bricks in here, you'll notice that these are postcodes. So what this is saying is we've got the character sign, which is saying the string must start with, and then anything that starts with M, L, or B. So you can see it's matched the two first ones, and the fourth one as well, absolutely fine. Obviously, OX and EX doesn't start with MLB, so that one doesn't get matched. You can also add a character symbol within character sets. So instead of this meaning that the string must start with, it actually inverts the rule instead. So it'll find anything that doesn't match the characters that you've put in there. So now you can see the OX and EX match absolutely fine. And then it gets even more interesting. You can have character ranges in here. So in this example, we've got any characters between A to L that will match. So of course, we've got those three postcodes that do match there within that range, but the M and the OX don't. So with ranges, you can have uppercase letters, lowercase letters, numbers, but then you can also add them together as well. So this is saying the character can match A to L, or 0 to 5. So then we can start using the information that we've learned so far to build like a basic regex, which would match postcodes. So we're saying that these postcodes, postcodes must start with a letter between A to Z, which is the capital, two digits, a space, another digit, and then two letters at the end, A to Z, and then nothing else after that. And you can see that those rules match exactly on there. Next we have quantifiers. So with this, you can have like your character sets and your rules, and then you can have kind of a rule after that. So we'll go through each one kind of so it makes sense. So the first one, again, we've got the character set of A to Z with the plus after this, and that says it must match one or more instances of characters. So we can see that the I is highlighted because we found one of those, then the comma, that's not in that character set, so that doesn't get matched. And then the rest of it, my name is, of course, those are all characters, and there's one or more instances of them in the string, so that's like matching the whole my name is. The capital A isn't matched on there because we've only done lowercase letters, and then the D-A-M, that matches absolutely fine and not the exclamation mark. Of course, then, like I mentioned before, with the character sets, you can add your capital letters in there as well, so now it's matching the A. With the starts with as well, so again, we want to match the... so now we're trying to match like URLs on there, so this first regex example is only going to match HTTP and then slash slash. You can see HTTPS or HTTPSS isn't matched in there. So if we move into HTTPS, now HTTP isn't recognized, but we want to cover both of those. So what we can have is a question mark after it, so that matches the S, and you can have either zero instances of that or just one instance of that. So of course that's matched HTTP, and HTTPS has been correct, but of course HTTPS, which I don't know, maybe super secure HTTP, doesn't match because it doesn't exist. And then the next thing we can have is the number of instances. So in this simple match, we've gone back to our credit card example, which is going to be a recurring theme throughout this, and we've got like the digits zero to nine, and we've got exactly 16 of those. So as long as there's just 16 within those, we've reintroduced the word boundaries as well. So 16 digits, it'll be fine, it'll match. But of course not all credit cards are exactly 16 numbers, you can have some which are a little bit more. So then we've got this quantifier, which is a number and then a comma, so that means at least 16, and then you can have anything over that. But then you've got a problem, because now you've got a false positive, where somebody's just sent somebody a message saying, hey, check out this binary string, and of course it's flagged it up thinking, hey, that's a credit card, because it's, you know, it's numbers, and it's at least 16 characters long. So then it introduces another quantifier for the range, so now you can say, okay, I want numbers, but only 16 to 19 digits in length, and that's it. So you can see that's matched it absolutely fine in this instance. Okay, so it gets a little bit more complicated now, because we've got to cover patterns which contain spaces as well. So we can see we've got the word boundary again, and then we've got, like, it's going to match four characters on there, and then it's going to match where we've got, like, the space after those four character sets of zero to nine, we've got a space and a star. Now, the star means zero instances or more. So just in case somebody types something in, like the first four digits, and they might hit, like, space, space, space, or they might put tabs, some kind of, like, extra spacing, extra padding in there, that'll actually cover it. As you can see, it's covered the first credit card number, which is just, you know, 16 digits, and then it's covered the next one as well, which has got the spaces in there. Okay, shortcuts. So this is where we can actually start compressing the regex to make it a little bit easier to read. So instead of doing the character sets of zero to nine, we can use the slash d instead, which just basically says any digits. So instead of us doing those four separate character sets for the first part of the credit card number, instead of doing the zero to nine, zero to nine, zero to nine, zero to nine, we could simply do that as a slash d. And as we saw in the quantifiers as well, if we put four in there, that's duplicating that pattern four times. And then again, we've got this space, which is optional. As well, like I mentioned before, in case somebody puts more than one space in there, we've got the slash s, which basically says any kind of space in there, any tabs, and we have the star after it as well, so we can have multiple ones of that. And then we've got the word character as well. So when that's matching, it matches characters a to z in upper and lower case, zero to nine, and then the underscore as well. I really wish they'd introduced the hyphen as well, just so it makes it easier matching things like domain names, things like that. But not so. So you can see it's matched like a username up there, absolutely fine. So if you wanted to, if somebody's signing up to a website, and you want to make sure that there's no strange characters in there, because you only want to have those ones, then that'll work fine. If somebody maybe put an email address in by accident instead of a username, you'll see that the at symbol hasn't been matched. And again, you can go the opposite way by doing a capital letter as well. So this searches for any non-digits in a string. So this might be some kind of validation on like a telephone number to make sure there's no like any other like strange characters in there, that shouldn't be. And again, the capital S as well, that signifies anything that isn't a white space. So in case for some stranger, I don't know if anyone's done it, but if you sign up for something and it says your password must be eight characters long, and you do eight spaces, which I don't know, maybe is a good password idea. I don't think I've seen a bunch of spaces in a word list before. And so that would match as false. So just to signify that there's no like normal characters in there. And again, the uppercase W is any non-word characters. So again , you can check on the string to see if your string contains any non-word characters, you might want to check that out. Okay. And then you've got wildcards. So these are where Regex can get dangerous. So on here, it's just basically matching any characters whatsoever between the href in the link and then anything between the two double quotes. So we'll go in a bit deeper why this is so dangerous. So what if we just want to extract the link from that, because that's matching the whole href pattern. So this introduced groups. And with groups, you can use that to repeat patterns that you've done multiple times, or you can actually use it to extract the text that you want that you're searching for. So in this example, again, it's just matching the whole href equals. So when you do this in a programming language, whichever you're using, you'll probably like be returned an array or some kind of object which matches all your results. So we can see you get this kind of result in here. It contains a href, but we don't want that information. Instead, if we wrap it in a group, for the wildcard and the star, you'll see that we've got an extra result in the array. So the first one is what actually matched it, and the second one is the groups that are in your Regex for the information that you want to actually extract out of it. So you can see with groups as well, you can make your Regexes even prettier. So again, back down to the credit card example, instead of specifying like four groups of digits over and over again, you can wrap that matching the four digits or in a space inside a group. And then you can put a quantifier after it, say you want to repeat that pattern three times. So it's like four digits and any optional space with the slash S and the star, you repeat that three times, and then any like four digits on its own, and you can see that matches it, and it's a nice, much easier to read Regex. So yeah, sorry, that's just the breakdown of it. And like I explained, so you've got the group at the start and then the iterator of the three. You can also inside groups introduce an or operator as well. So you can say, so if the credit card has spaces, and then all the pipe symbol, you can have a hyphen as well. So again, that will match the credit card numbers that are being entered with a hyphen in there. So this is where it starts getting interesting, where Regex goes wrong, and where developers start implementing it. So we're going to go through some vulnerabilities. So the kind of real world examples, this could be like a black box exercise in kind of two ways, one where you're not given any source code, or this is Regex that's going on in the background. Or white box might be where you do have source code, so you can go through and you can see the exact Regexes that are being used. Or it might be a Regex that's being used on the front end of like a website, say in JavaScript. So the first vulnerability we're going to go through is post message. So if some people aren't familiar with post message, it's a way of two browser windows or tabs communicating with each other. So say for things like, sometimes you'll open like a login prompt, so you do like log in with Google, it'll jump up with a little separate page. Once you log into there, it can actually send a message back to your original page to say, this user's logged in, here's their information. So we can see that with passing the data back. So to make that secure, when you listen, so this is a little JavaScript example, so you use event listeners to listen for any messages coming back to your browser window. And ideally, I mean, two things can happen, they don't check whatsoever where that information has been coming from, which is really dangerous, or they can implement a Regex on there to test for the browser for where that information's come from, and that comes in the origin, in the event of the message. So just in this simple example, we're checking to make sure that the window that was opened and passing the message back to the original website is supposed to be HTTPS www.trusted.com. And then just for our example, so you kind of understand it as a vulnerability, it looks for inside the JSON object that's being passed. If the event.datatype equals error, all it's going to do is fill in a div with the error message that's on there. So this is kind of an example payload, which might be passed back to the original site. So if you're familiar with cross-site scripting, all that's going to do is put an image tag on the website, it's going to try and load the source of X, which is going to fail, and then it's just going to pop an alert on there, because we've got the JavaScript in the onError event handler. I mean, don't worry about that too much, but just take it as if somebody's got postMessage, and they're putting that information on the page, it can get dangerous. So as we saw, this is the regex that's been used on here, which is just www.trusted.com. So the first thing that we're missing is an anchor at the end. So the problem with this is, if you've got the domain name attacker.com, you can just create these chains of subdomains, so you could have a website of www.trusted.com.attacker.com. If you force your victim to go there, that'll pop open the original window of the main website you're trying to hack, and then you can actually communicate between those two. So all you need to do is send a link to a user that opened up this attacker.com subdomain, and then instantly you'd be able to launch JavaScript on that original site, which of course you can then start stealing cookies, taking over accounts, things like that. So that's the first thing that we need, a dollar sign on the end. And again, going back to what we learned, that dollar sign says nothing can be after this. It's just got to be that domain name, and that's it. No other characters. And then the next one is the wildcard. This is probably the most common one that we see out there. Developers always forget to put that backslash on there to mark it as being a period. You could register the domain name www.xtrusted.com, and then that will pass the regex rules, and then you can move on from there. This is the fix for it, so we can see that we've got the dollar sign at the end, and we've also done the backslashes on the periods as well to make this one now secure. So open redirects is the next one. So again, we've just got some simple code which is basically testing the URL. So you might have a website, and there's a variable on there which you can pass in a URL, but you want to make sure that it's only domains that belong to trusted... sorry, you want to make sure it's only subdomains that belong to the trusted.com. If it does, and that passes, it will redirect to that website. Otherwise, it will fail. So again, we've got the wildcard, which is going to be quite familiar on there, and because that requires a backslash on there, then again, we can have the www.xtrusted.com, and then you can redirect people to that website. Again, that could potentially be used in like phishing engagements, so people look at the link on their email and think, oh yeah, that's a valid URL at the start. I'll click on that, but then you could get redirected somewhere else. It might trick you into putting account credentials in or downloading something like malware. Also, the subdomain part of this as well. So this wildcard on here is because they want to accept any subdomain of trusted.com. Usually, you want to restrict this a little bit, because especially with very big scopes, and you've got like kind of like engineering side where they'll do a lot of testing. There could be something like QAProd.1 or something, and you definitely don't want that being matched. It might be just some really vulnerable old code that somebody's managed to find while they've been doing some reconnaissance. Again, we've got the dollar sign at the end, so then you can add to it. So you can have the www.trusted.com.evil.com. So then you can use that to take over. And of course, at the start symbol as well, the caret at the beginning, what you could do is actually pass in a domain name and then pass in the original one as a query string instead. So again, without that caret symbol at the start, say this must start with a subdomain of trusted.com. It'll still match that part at the end, and it'll get passed through. So here's our fixed one. So it's only accepting certain subdomains between A to Z, 0 to 9. So this is just going to be like top level domains. So you can have like www.oradmin, things like that. Even better, let's actually put the domains that you're allowed on there. So again, we've got the group with the or on there. So it'll just accept admin, www, and download, and nothing else. So this is one of Ben's examples where that actually happened. So on the URL, you could put in the site name, the application name, and the path. But because the path on there wasn't checking whether it began with a slash at the beginning, you could instead just change the path to .evil.com. So it'd actually redirect to some application .redacted.com.evil.com, which would be your domain name. And in this instance, Ben used this as an open redirect, which would actually grab somebody's auth token. So it just wasn't a kind of a simple open redirect. It was actually an account takeover where you could steal somebody's cookie after logging in. And that got $14,000, I believe, Ben. Okay, calls. So when you're on a website and you're making an AJAX request to a different domain name or a different subdomain to what you're on, or even a different scheme, you have what's called a pre-flight check, where it sends an options header to the server that you're going to communicate with and say, hey, I'm coming from this website. Am I actually okay to send this information? Especially with things like credentials as well. So you might have like a second website where, say, if it's like an API. So you have like, well, in this example, we have like a slash API slash me. So if you visited that normally, it would use your cookies, and then it would show you the information in API slash me. So that would be really dangerous if any website could make a call to that and then grab that information. So this is why we have calls and those pre-flight checks. It will pass the origin, which is the website that you're currently on. And if that matches the rule on there to whether it is an allowed website, you'll get a response in there saying the action control allow origin header will be returned, and that has to match your address. So the scheme and the domain in your address bar. Also, if you can send cookies along with that request, you'll get the access control allow credentials. Interestingly, most browsers have actually removed this, because a lot of the time, passing cookies back and forth towards third party domains, it's mainly used for analytics so that people can track you all over the web. Every browser has removed this, apart from Google, surprise, surprise, with Chrome. They keep on promising to do it. They also keep on extending that data as well. So where the issue is, so we've got the calls code on the server side. Again, it's using a regex to check whether this domain is actually allowed to communicate with it. If it passes that check, it will then set those headers. So again, we've got the wildcard character, which we explained, so we can just, you know, purchase a completely different domain with an X in there, and we can bypass that regex check, and then we can start stealing information. Again, the subdomain, so we can add in a completely random domain that possibly we've taken over, something which is a little bit easier to hack into. Again, no dollar sign on the end as well. So we can add our evil.com domain on there, and we can steal the information. So this is the fixed one on there, so we only cover subdomains, like top level ones, A to Z, zero to nine, and an underscore, and then we've got the backslashes in there for the wildcards with the trusted.com, so this has made this now secure. SSRF, so I'm not going to go through every vulnerability, don't worry, because they're all pretty similar. Say if you had a website and it was going to make a PDF of your LinkedIn user page, so it's expecting for you to give a LinkedIn domain, it'll grab that, it'll convert it to a PDF, and it'll send it to you. You don't want this accepting any domain name, because you could potentially access things that are on local host or metadata if you're hosting on the cloud. So again, we've got the full stop on there, which is the wildcard, and we could create a domain, the www.xlinkedin.com, we could register that or any character, set the ADNS record to local host, and instead it'll communicate with the local host instead. And there's no slash at the end of the domain that's been put on there as well, so we could make that a subdomain of a domain that we already have control over, and again, we can control the DNS and where that goes to. And the no caret symbol at the start say the string must start with this. So if we pass in a whole URL, again, we could be hosting something which either redirects to somewhere completely different, or again, we can set that DNS record, and we can get it to create a PDF of any page we want. Also as well, don't just trust the start of it, maybe after the slash at the end, let's get the exact path in there, because what happens if we find an open redirect on LinkedIn? So it's passing all the regex, it hits the slash redirect, which is hosted on LinkedIn, goes back to your evil.com domain, which has a DNS record of 127.0.1, which will then start querying local services. Obviously, we could change that address to different things as well. So this is the fixed version. So with what we've learned is we've got the... it has to start with HTTPS, LinkedIn.com, and then slash in, slash then the word symbol, which will only accept characters A to Z, zero to nine, and underscores. So that should be safe after that with my example at the bottom. Okay. So I think now Ben's up. So he's going to go through some vulnerabilities that he's found where regex has been involved. He's going to chat about that and some refund stuff. All right. So I did a similar talk to this one somewhere else, and I talked about some vulnerabilities I got in trouble for. So I couldn't put the screenshots of the vulnerabilities on this slides. So instead, I'm going to just show you similar findings on GitHub that scored me the same bounties. I just couldn't put the specific bugs up here. But when it comes down to SSRF, the majority of the goal is internals, right? Get into the internal network or get some AWS keys or something fun, right? So we'll come back to this, but there is something beautiful about using regex on GitHub. And I use this a lot. I've gone away from using the traditional sub finder, amass, domain finder, whatever you want to name it. I've kind of stepped away from those because one, everybody else is using them on public programs and B, I wanted something new and I really wanted to drive this home for this DEF CON talk. So you can do a couple of things with regex on GitHub. You can actually use regex to look for subdomains. So let's say you have a environment on cert.sh that comes back and it says, yeah, I have a wildcard certificate here. It's something.corp.site.com. And you can't see what's behind corp because it's a wildcard. You have to brute force for it. This is a really good way to find it. Again, the regex that you see on this screen is one of many things you can try. It's something that we've came up with, so it simplifies what we're doing. And you can take that even a step further and just look for subdomains that contain specific keywords. So if you want to find APIs, you can put an API in there. If you want to look for dev sites, you can put dev in there. And the cool thing about doing that is it also gives you context. It gives you context of what people are doing on these APIs. Are these internal APIs that they have leaked data on? Have they given you their paths and things like that? So one of the really cool bugs that I found using this method was on one of the bug bounty platforms, we were hacking on a redacted program and this guy came to me on Discord. He's like, hey, I have a SSRF, but I know it's hitting something internal, but I just can't prove it. And it's not on AWS, it's not on GCP, so we don't have any access to anything that we can prove. And I just think there's something on the internal that we can find. So we went through this example and instead of putting API, we were looking for a specific keyword.site.com. And we ended up making a quick list of everything that was on GitHub. And one of those was their source code. There's a frog or whatever it's called, JFrog, that was on auth and you can just pull source code from it. And none of the databases that we went through for asset discovery, your sub finder, your cert.sh, your c99.nl, all of those didn't have data on this specific thing. But some developer unfortunately had leaked their automation on GitHub and had the instance for us that we could pull for. So we had access to all their source code. We reported it. And I think that one was a $5,000 or $6,000 bounty on a public bug bounty program. So this is a really, really good way to find assets that you can narrow your focus on what you want to hack on. I'm just going to make sure I have my notes. I don't miss anything since I don't have... I couldn't put slides. There we go. So that's one of the things that I want to do. This is the starting point for me when it comes down to looking for assets that I want to hack on. So with bug bounties, one of the number one questions I get is like, where do I pick the targets out of these thousand subdomains that I found? This could be a really good way. So you also have the content discovery part of this. You can find a lot of cool content that you probably can't brute force for if you were to find a random API that doesn't have any swagger or open API JSON on there. So again, very random, but also high level regex for it. We're using Netflix for this. We're saying anything that has Netflix, it could be netflix.com, netflix.io, netflix.net, because those are also tier two assets on Netflix's bug bounty program. And then we're hitting it with, I want it to have slash API in there. This alone on a, this is not on Netflix's bug bounty program on a private , no public program on HackerOne that's been around maybe for, I want to say over six years , have a massive scope to have massive presence online. And two cool things came out of this two types of vulnerabilities. The first one was, I just wanted to find APIs to hack on because everything for these websites that I would go to, you needed an account. So they have a domain in, let's say Netherlands. It's a .nl domain. You need to be a Dutch citizen to be able to get an account. You need to have an ID to get logged in. And then you can see their API routes to interact with it. Obviously not Dutch, don't have an ID. This was a great way to do it. So actually I found an asset on there that not only did it give me the API routes, it also gave me how the usernames were being created. So it was like a first name, initial, last name, and the year of their birth. And it's, you know, it's in, if it's a Dutch that you go to chat GPT and say, Hey, give me a top 10, most common Dutch last names, add an A through Z in the beginning. And then numbers that you think are birth years where, you know, people that I can use. So that's one, it was a $5,000 bounty. And then you can also do things like, Hey, maybe it doesn't have API in it. It could be something like app dash API, but then, you know, app name, the app name could be anything arbitrary, right? It could be a printer API dash whatever. And then there's a V1 in there and you do that and it gives you a lot of good results. And all this, honestly, all these APIs are also cool to look at, but for that one specifically, it wasn't anything with the API itself that was vulnerable. It turns out that had some very obscure path for all of their applications. It was about five dashes. And so five different words, it was like a region, app name, environment, and then a country at the end. So it was really hard to brute force. But once I found every single one of those on GitHub, every single one of those endpoints had an actuator with a heap dump. So if you're not familiar with actuator heap dumps, it's just for Java backend, you can use something like a spring boot. It gives you access to the environment variables. You can pull credentials. The heap dump is just a snapshot of the memory that has all the HTTP requests. And I will show some of those in here. And I want to say I found four of those at $3,000 a pop within just a couple of hours of just realizing like, hey, I can just go on GitHub and somebody else had leaked these paths for me to be able to look for it. So keep this in mind when you're looking at a random asset you found, you're banging your head against the wall going, what is on this API? What are the routes on this API? Somebody, I promise you has leaked it on GitHub, but you just got to be able to find it with a good regex. So those are a couple of bugs that I can talk about throughout all this. You can also use it for things like GraphQL. I just want to give you examples of things that you can look. It's not just always API. It's not always GraphQL. You could also just literally be knowing that this company has this stack that they use, technology stack or this component that they use across their environments and you want to find it. So you can just purely do for this one, we're doing every domain obviously that's on GitHub, but you can just narrow it down to something like a netflix.com or fort.com and then looking for every GraphQL instance in there. We can also use this for parsing data dumps. Do you want to take this one or maybe you could keep going? I'll take this one just because of the fact that it's, I talked about actuators and I kind of want to show what it looks like. So this is obviously a fake version of actuator that we have as a lab, but most of the time if you do, if you find actuator, this will be something that it would look like. If you're lucky, this is what it looks like. If you're unlucky, then it just shows you health, info and metrics. If you don't see those three, I'll give you a hug. It sucks. It's not fun to see those, but when you do come across an actuator, you can download the actuator heap dump. It looks a little ugly like this if you open it because it's not human readable. You can pass it to strings, for example, and you can grip for some data, but keep in mind when you're gripping for, I don't know, password, you're going to get a ton of other variables that have the word password in it or username in it or whatever it is. But we can use something like this to just pull everything that has, that ends with an equal sign, which is a parameter or even better, it could be a base 64 of a password that ends into two equal signs. And it could be a password for something or it could be something that we can use and leverage it. You can look for things like, I think Adam's going to cover these, but you can look for JWT tokens. They start in a very specific way. You can look for AWS keys. They look a very specific way that we'll cover. But this has been something that I have had to shift to because I realized after creating this course with Adam, I went through all the heap dumps that I've had on my laptop and I realized how much data I had missed by just doing a strings file and then piping into GRIP without regex because there's so much data that I couldn't go through. So I'll let Adam cover some of the other safe secrets and then we'll wrap it up with some code review and maybe take some questions at the end. Okay, so very quickly, again, using GitHub, we can look for things. So all JWT tokens quite nicely start with EYJ, which is the opening bracket on there, followed by characters A to Z, zero to nine, underscores and hyphens, and then with a dot in the middle. So if you search for this on GitHub, don't know who these poor people are, sorry, you'll find a bunch of JWT tokens which have been put on there. Again, things like AWS keys as well, that can be put on there as well. You can also combine that with like Netflix domains as well. I've found this random thing, I don't know what it is, there's some research.netflix and there's a JWT token in there as well. All right, sorry, yeah, if you put when you're searching on GitHub, where the and is, you have to put that as capital, sorry. Regex as well can be really useful for code review. So whatever your stack is that you're used to, I'm used to PHP, so I'm just going to use this as an example. So if you're searching for anything that might reflect XSS in your code, so it'll be echo and then you're just echoing out straight away any get or post requests with no validation on there whatsoever. That's a good indication that you're going to get an XSS on your website. So it's just looking for any instances where it's echoing out and then using Regex, we've managed to put the group and the author operator on there and to look for anything that's get post and then starts with the open bracket. So here's some code example that might come up on there. Anything that's potentially using the system command as well, that could be receiving some information. So any websites that are using system to actually process some code on there, you're going to want to make sure that you have a look at that, make sure it's not taking any variables that you could potentially then get RCA on the website. And you can also use a Regex to look for Regexes as well. So this checks for Regex code for PHP, JavaScript and Python. You have different packages on there which you put regular expressions into. Again, this will flag them all up in your code and then you can review them manually. Again, you can search for things like basic auth, that's in your code as well. So that's going to match any of the base 64 strings and then ends in an equals. Again, finding JWT tokens. Sorry if this is really fast, but we're running out of time. You can also do these things on not your own code, but you could also do it on GitHub as well. Again, looking for any XSS which might be in PHP. And then you can use the and command as well with WordPress. So if you're targeting particularly like WordPress plugins through like a bounty program like WordFence, you can do that. And also look for things that system commands that like either get or post has been passed into as well. So there's like user input, which is going into a system call. So like on this one that I searched for, which you can get some interesting results. This was just basically somebody's web shell that they've hosted on there. So we've got some hackers posting some stuff on there as well. One of the cool things I've really found about it is now and again, I find like building tools for the community really interesting. So one of the first ones that created was creatures of habit, which wouldn't be possible without regexes on there. So all this does is it goes, I increment through every package on GitHub. It grabs certain web extensions on there. And then it goes through every different framework that's out there. Like we've got like Python, like Flask on there. So it looks for any routes. So we can start making loads of routes and then we can use those for word lists for finding other things on other domains. And PHP with Laravel has gone there. JavaScript, Python, ASP.NET, Ruby on Rails, and Go as well on there. Another one I wanted to create word lists as well for when I'm hacking into websites, where I want to create a unique list of parameters as well. So it's great to go to GitHub, find all the parameters that developers are actually using, either in query strings or the post body or HTTP headers and methods. And again, I could cycle through pretty much most of GitHub, look for PHP pages and look for any get or post things in the code and then I'd extract the actual string in the middle and then I'd put those into a word file and then I can use that later on for reconnaissance. With parameters I've done that, with HTTP headers and with get methods as well, because they tend to get reused in web paths. So that's been pretty interesting. I've managed to make some really interesting word lists and found some very interesting things from that. I think we are finally done. Sorry if we've melted your brain. It's been a lot of information. Don't worry if you didn't grab it all, but hopefully it's kind of prompted you enough to go, yes, I will learn Regex. One more note, because for the GitHub stuff, for the code review, the reason why we have it in there, a lot of companies open source a lot of their frameworks. So keep that in mind. You can go and find vulnerabilities in those. That's why we have them on there. We just can't show you exact examples of it. But a lot of the large organization, especially if they've been around for years, all of their frameworks that they use internally for their basic applications, that code is online. You can look at it. Enterprise tools, you can launch them on your own. Go through the EC2 instance, get the code and dump it and look for vulnerabilities. Keep that in mind. That's why we have it in there. It's not a teaser. It's just get creative. Look at these things and go, what else can I do with it? How can I chain all these and apply them in a real world? With that said, I think we have only two minutes before we get kicked out of the room. If there are any questions, we would love to answer them. If not, hang out here and answer any questions. Okay? You can use tools to unpack that actuator dump. Is that what you're talking about? You can use tools. I personally don't use them with bug bounty programs because they usually don't care. I literally just run them through GRIP with regex. Look for things that I think is valuable. Look for cookie values, for example. Look for JWT tokens. Look for bearer tokens and things like that. When you see that access, you'll see the whole HTTP request on there so you can see where they're actually using that token and where sending it to or receiving it from as well. They'll be on the website with the actual workshop soon. This is a part of a bigger workshop. It's just what we could... It will be an additional one. I'll send it to you.