Now this is going to be the last talk for today. And before I go ahead and start introducing the speaker, I'd like to give a small thanks to our sponsors. OSINT Industries, Pentester, Squarex, Synapt, Argilis Labs, Kado Networks, and Radon Labs. Right, up next is... up next is Osgun Klingin, who is a security researcher by day and a bug hunter by night. He's spoken at several conferences, such as DefCon, ResearchFrog, Hacktivity, and a lot more conferences as well. This time, his talk is going to be on Enumerate, quite a catchy name. It is an AI-assisted web attack surface enumeration tool. We'll get to see about AI being used in the right way. I completely agree with you, my friend. AI in everything is not fun. I completely agree. So having AI used in the right way is something we definitely want to look forward to. So, yeah, we'll get to see you come across some sharp, smart techniques to use AI in the right way and see where it counts. So please welcome our speaker on stage. Hello everyone. Thank you for introducing me. So I hope you can hear me well. So today I'll be talking about AI-assisted web attack surface enumeration, which is my latest research. So where am I? I'm currently working as an offensive security engineer at Trendule Group, which is like the biggest e-commerce company in Trendule, so that I can have a chance to review lots of products, starting from Active Directory to desktop applications. And after my daily work, I generally deal with web security and AI stuff lately. I got a bunch of useless certifications and I talked at DEF CON 32 Red Team Village last year, activity and a bunch of B-sides around Europe. So let's get it started. I would like to start with this talk, what this talk is not about, because there's very AI hype-driven things around there. So it's not about overusing the AI at all, and you'll see. And it's not like more AI better researching, because AI is a complete sales magnet, as you know. And there won't be any endless theoretical slides, because I'm not, of course, a professor and we are not in a master's degree class. And it's not like a tool sales pitch. It's more like redefining the way we do reconnaissance. What we're going to do today, we will be talking about web attack services a bit, then talk about our current problem, the moment of Eureka, talking about science and boring stuff a bit, and then a fun part is upcoming. Okay, so what's a web attack service? Web attack service is basically everything that an attacker has access to, right? Which includes all accessible paths, subdomains, JavaScript endpoints, APIs, CDNs, any third-party integrations. So it might include both obvious URLs you can just find on the main page, but it also includes deep and hard-to-find assets of the target. And this is where it gets hard. And why is mapping so hard? Because, I mean, if you are working in a company where more than thousands of software engineers are working, or system engineers, or DevOps engineers, there's a big problem called shadow IT. So you never know where your real assets are. You never know which assets are accessible from the public, right? And there's also third-party applications, forgotten assets, and lack of inventory. And of course, companies can protect what they don't know exists. And what's our problem here? Okay, so there's huge attack services. I mean, can anyone guess what this map represents? I'll give you some hints. Red Brain, Defcon fake Wi-Fi map, or Twitter infosec argument map, Zoomda. Does anyone have a guess? Twitter? It's actually Netflix architecture from like nine years ago. So, I mean, imagine how it looks like right now. So yeah, it's a big problem. And why? Because it's enumeration hell. It's not easy to discover all the functionalities that target web application have. And if you try to enumerate all the paths, there will be some problems about the cloud flair and rate limiting as well. And also there is complexity to confusion, like multiple frameworks, probably left over third-party libraries and hidden parameters as well. And you probably can't prioritize it as well. And when you start dealing with web security and when you open your web suite, it generally looks like this, right? I mean, you've got like 120 repeated tabs, about 90k requests, and like tons of audit items. Okay, here is another problem that I deal with most. It's called hidden attack services. I mean, we talked about there's thousands of subdomains and endpoints to check. I mean, yeah, it's a real problem. But the real problem here is there is thousands of subdomains and endpoints to discover on our targets. And this is what it generally goes like. I mean, they generally pause everything, but there are always some paths that are not accessed by any bug bounty hunter or any red teamer person. Okay, so as I said, there are tons of subdomains and it's not easy to manage that kind of exponential growth. For example, it's the Apple subdomains retreat from Turkish inventory. I think it's got like updated every certain period of time. So there's like very complex subdomains as well. And there are also target-specific naming conventions. What I mean by that is, let's say you don't see that ius-dr-oldapple.com. I mean, how would you possibly find this subdomain if it doesn't show up in a standard word list, right? And there are also like unusual patterns, nonsense things all over there. I mean, there's no way you can find out these subdomains if they didn't get exposed from certifications or Google Docs. And how to get more of them? We should first reverse engineering the naming logic and identify if there's like any environment region flags or numbers. For example, ius-diags. It's got to be ius-diagnostics, right? I mean, we can understand it. So we will find some abbreviations. For example, again, diagnostics to diags. And then we can work for smartly. And talk is cheap. It's easy. But let's try on an real example subdomain. So what you see is ius-diags-mdn-apple.com. Has anyone have any guess what this is about? I mean, let's start decoding it. I mean, the first part is, come on, it's easy. Ius-diagnostics, right? But I had no idea what mdn is. So I finished my research, so I'll just give you a spoiler here. The real answer. It's actually made in North Carolina. It's because there's an Apple data center as well. And there are also like other subdomains like mdn-reno-nevada and Newark-New Jersey. But how should I supposed to know that this mdn was standing for maiden and then after I can generate more subdomains to discover? Of course, there's something that everything can think of, right? I mean, we know a guy who knows a subdomain, who knows English, who knows Turkish, who knows Spanish, who knows like every published paper in the world, right? So let's ask to Cecikci. And he will ask for that mdn is likely stands for mobile device network or mobile diagnosis network. And it says it's possibly a centralized server or endpoint involved in routing diagnostics. And for Newark, it says it's not Newark, it's network, it says. And for network diagnostics. I mean, to be honest, in the first round, if I ask directly to Cecikci and if I get this answer, I will be convinced. I mean, I will not look further. But it turns out that it's not right. So what I want to emphasize here is we need to give more context to LLMs or Cecikci as well, because they are just trying to tell the person that comes to their mind. So instead of asking directly what mdn or nwk stands for, I gave the subdomains I discovered on Apple. So imagine I gave like two separate subdomain lists. And at the first one, it can observe that, hey, there is a Miami, there's a New York City, and there's an RNO. So from that point, he can understand that this RNO stands for Reno, Nevada. And after this, when looking at the second list, now it can make a connection between the Reno and the mdn and Newark. And with this way, Cecikci now can understand or any other LLMs can understand that this mdn is not mobile diagnostic network, this Newark is not network, it is name of the places. So this is why we need to give more context to LLMs or Cecikci. And after providing this information, Cecikci says Reno is Nevada, it's Maiden, and it's Newark, New Jersey. And the same thing applies to pathfuzzing as well, but it's kind of a bit harder because you also need to deal with HTTP methods, text tags of the target, I mean, which extension should be used, some naming conventions, for example, there's an underscore between two names, and of course, there might be some parameters. And of course, we have a bigger problem here called rate limit. And let's talk about limitations of traditional methods here. What traditional methods are we using currently as a security researcher? I mean, there could be some passive reconnaissance, right? I mean, you cannot see a subdomain if they are using wildcard certifications. Or let's say you are in an SSRF situation, you want to discover the internal subdomains, you cannot have previous information because it's a private DNS. Also, brute force is actually limited by the wordlist you use. I mean, if you're always using the same seclist wordlist, you won't be getting anywhere because you are using the same wordlist for all the targets. I mean, targets change, but you are not changing your wordlist. It's also resource and time-consuming, of course, and you need to have a manual context awareness. I mean, you need to understand, hey, this is a place, name of the place, or this is the name of the technology, so I need to do more smart fuzzing. So you need to think yourself. So, I mean, the most sad part is, actually some guy actually spent hours chaining LFI, log poisoning, RCE to Prevasc and got just $3,000, and I'm sure some of them are here. And on the other hand, a random guy found an unauthenticated admin panel on some random subdomain called cstabadm2 and got $5,000. I mean, it's the truth. And after this, I realized that one day I was doing a regular pen test, okay? It was a web target, I cannot disclose, of course, so I just signed up to them and I got redirected to that endpoint, api slash user underscore crt. You probably guessed that, right? It is abbreviation for user create, of course. It says HTTP method get doesn't work because it was working with post. Yeah, so after that legitimate API endpoint, I decided to fuzz that more. But how can I find a word list contains that kind of API endpoints? I mean, if you look for, for example, the closest ones to user creation is user underscore creates or user underscore created. I mean, there is no way you can actually fuzz this API without manual thinking. So then I thought, I mean, come on, actually we are the smartest ones in the planet and if I cannot do this, who can do? So we can start thinking, I mean, if there's a user underscore CRT, there might be user underscore DLT, user underscore LSD, user underscore permission, and maybe instead of user, there might be ADM for admin, right? So admin underscore CRT or list. But the real problem here is, I mean, none of them have worked, by the way, but the real problem is if I opt to a challenge, how many endpoints I can think of in like five minutes? And it turns out it's not that much. I mean, even for just the delayed operation, I can think about, hey, okay, user underscore Dell, user underscore delayed, but then I need to get some dictionary. And, I mean, you can also challenge yourself how many, how much, like, delayed-related endpoints you can come up with in five minutes, but I bet you won't find any more than any LLMs. So I just wrote a very basic chat chip, the API wrapper, so it's basically generate many possible endpoints specifically tailored to the same syntax structure that are related to the action, which is delayed, and based on the previous, the found URL, which is API slash user underscore CRT. And it's come up with, and please be careful that also this U letter is capital, and when I run that basic chat chip, the wrapper, it can come up with user underscore RMV, user underscore ELM, user underscore EXCL for probably exclude, and there's other bunch of options. I mean, to be honest, I can think like an hour, but I never think about user underscore ELM, for example, or I probably cannot even know what EXCL is. So I realized that actually LLMs can be useful for that manner, and it was the API user RMV endpoint, which is working with posts, of course, and it allowed me to delete any user account on the target web application, and resulted in a four-digit bounty. So why AI is the perfect fit for this scenario? So because they are working for, I mean, they are based on next word prediction, right? So their whole life purpose is predict the next most probable token based on the context and the statistical patterns. I mean, if you look at their context is given and the probability of next token is calculated, and the most probable ones will be given as the output. And if you give like target.com slash admin to an LLM, it can generate like dashboard settings, users, reports, and panel, and some of them will be found and some of them will not be found. And there's also another functionality of LLMs called distributional semantics, which is, it actually turns words or tokens into vectors. So the distributional hypothesis says that if two tokens sharing the similar neighborhoods, meaning like meanings, contacts, probably they share the same meaning. So admin and user words has smaller angle than admin and CSS when you turn those into vectors. And contextual embeddings helps us to produce the vector after looking at the entire sentence. So we are not just looking for token by token or word by word. It understands the whole word and then produces the output. So I have a quick question. So which two do you think is more similar? So let's say there's the API user underscore DLT, which stands for, of course, user deletion operation. And the second is user remove, related to user deletion again. And the second option is user deletion and API ADM CRT. Anyone want to take a guess? Which one do you think is more closest? Which one? AC? Anyone says AB? You think AB? So the result is, I mean, I run a quick transformer LLM here, like small, fast, and contextual one. And the result is A and B is 0.3 and A and C is 0.5, which means A and C is much more closer. And which actually blows my mind because when you think about this, I mean, let's say A is the real path of the target web application. So which one do you think is more probable to exist in the target application? I mean, they probably didn't use somewhere user DLT and somewhere user underscore remove, right? There's two different abbreviations. One has capital letter, one doesn't have any capital letters. But in the other hand, LLMs can understand this, this is a user and this is an admin, and this is a delayed function and this is a create function. So they have the same abbreviations, they have the same capitalization, so that it thinks that A and C is much more closer. And transformer architecture and self-attention of the LLMs, modern LLMs rely on transformer architecture, which means they are just like not looking for the adjacent tokens, also looking for longer range dependencies. For example, for this API endpoint, they will look for, I mean, when generating the next possible token, it just, it will look to the whole URL. I mean, it will look to version check, it will do some resource slot, like instead of version one, it can do version two, but instead of users, it can do accounts as well. And the fun part, using AI for smart enumerations. So, first thing that comes to everyone's mind, I guess, check GPT APIs, right? I mean, it's one of the best in the world, why we cannot use it? There's an obvious reason, before that obvious reason, let's dig in a bit. Yeah, what a great idea you have, asking check GPT to do it, no one has to think about it. But it's actually good. I mean, it's not trained specifically for subdomain enumeration or path enumeration, but it's actually good. Because when I give some of the subdomains and ask for ten more possible subdomains and if you look closely, there's Carrier, Bluff, SmallBlind, and Vegas underscore Envy. They're kind of poker-related, right? When I ask for ten more subdomains, it will produce this. BigBlind, Flop, AllIn, Fault, Monte underscore Carlo, and River, Cashout, like poker-related things. And also Resume.OzgunKurtekin.com, which is Carrier-focused because I gave Carrier.OzgunKurtekin.com as well. So it did pretty much good job. But the real problem here is this, of course. I mean, you cannot use the check GPT forever when generating subdomains or pets because it will be a hella money. So the second option is using LSTMs. LSTM is not LLMs, but it's more like long-short-term memory. I think it's invented much more before LLMs. So it's type of RNN, like Recurrent Neural Network, designed to process sequences token by token. And it has a basic memory mechanism so that it can keep the previous tokens as well. And what we did here is train the LSTM to predict the next subdomain level. And there's a beautiful research called Offensive AI, and I think it's very underrated job. I hope I pronounced them correctly, but Alberto Castagnaro, Mario Conti, and Luca Paola released a paper about this. They trained their LSTM with university, hospital, company, and government data, and it actually acted quite well in those types of subdomains. And it's their GitHub page and the link of the paper. As I said earlier, I think it's a very underrated paper. You should definitely visit. So I tried mine. So I just took the Apple subdomain, which is like a quite high number of subdomain they have, and I prepared a subdomain training list consisting of root domain, current partial subdomain, and the target label. So what I'm saying there is, if you see parse.apple.com, you can think of 0-career2. Or for this one, for example, if you see iso.apple.com, you can come up with stage-huxley. That's what I'm saying. And I didn't do any like data cleaning, data preparation. I just gave all the subdomains. And training was like up to 200 epochs, early stopping based on the validation loss, of course, because it's converged around like 35, and the valid loss was 1.15. And when I run it, and it has like so limited knowledge, right? I just gave the Apple subdomains here. And when I asked for new Apple subdomains, it come up with applebot.apple.com, which is new actually. seer.apple.com is probably already in the list. But when I asked for two subdomains at the same time, it's actually trying to come up with much more creative things. For example, this connectivity for, sorry, this iamstk-r1.corp.apple.com was not exist on the any word list, but it takes parts of multiple subdomains and combine it. So I think it was pretty good. But we got some problems, of course. For example, if you give like edu.apple.com, or stage.apple.com, or any random thing.apple.com, it will come up with the same subdomains. Why is that? Because LSTM didn't know there is a token like edu, or there is a token like stage. Because my configuration was, if there's like less than five occurrence, let's just don't take it as a token, and actually Apple doesn't have any like stage subdomain. They all look like environment dash stage, or x dash stage. So there's always like a dash. So I take dash as tokenizer as well, like hyphens, and then tried that again, and this time it can come up with new subdomains that never seen before. So it was a pretty good, but like not satisfied me at all, but it was a good one. And finally, using LLMs for that manner. LSTMs were good, but as I said earlier, they process input pretty much sequentially. So they can say that, hey, there might be student2.apple.com by seeing student1.apple.com, but they cannot guess edu.apple.com, because they don't know students and edu keywords are actually same context, because they are not intelligent. And why we are switching to LLMs? Because they are creative, they can make smarter guess, they are better at understanding, and they are transformers. LSTMs copies the sequences, but on the other hand, LLMs will understand it. LLMs will see the whole context at once. And also LLMs will understand the company naming patterns and invent realistic ones, if it doesn't see that any earlier. So I first start with choosing the model nano GPT framework, so you can just train from scratch, there's no pre-trained data in it. And it's very lightweight, and I also, if I'm not mistaken, I also used Apple subdomains for training, and there was 10.6 million parameter in my case. And in trial, it was able to generate this kind of subdomains, which is kind of okay to me. I mean, it's also not seen before, and they look pretty okay, if you think about other subdomains in Apple. And there's a tool called SubViz, created by Hadrian company. I think this is the first subdomain generator using LLMs that comes to public, because I've never seen it before. They are using nano GPT with over 17 million parameters, trained on 26 million tokens. And what they're saying is, they've seen, for their internal testing, they've seen up to 10% increase in discovered subdomains. That's from their blog. You can also check their tools as well. I also tried their tool too. For example, you can also use their Python wrapper. I gave my non-subdomains for Apple, every of them, like education-related, lab, uni, ed school, and its output was like research, some sports, id.apple.com. I mean, not perfect, but it still gives me pretty much good options. But not great. So, after that, I choose model GPT-2, because GPT-2 small has over 100 million parameters, large has over 700 million parameters, and it's already pre-trained on Webtech, so it already knows something, right? So it can invent realistic and unseen ones, and I can fine-tune it with subdomains I discover. And when I tried that, after the training part, it gave me something like this. I mean, I didn't like it too much, but there are also some logical ones, because Apple also has these IP things as well, but I think it should understand that it's IP and acts like that. So I was a big fan of it. And our file. So it was QN3 4 billion one. We choose that because it's way larger than GPT-2 and way smaller than GPT-3.5. And it has modern transfer architecture, it has good statistical things among other open source models, it can support long context lengths, and it's balanced. And how did we train it for subdomain enumeration? So I trained it with over 5,000 domains, which has over 22 million subdomains, and all the training data was looking like domain name is portsever and related subdomains of portsever is like this. And I think there's like 22 million of them. For the path enumeration, the same. There were over 600,000 domains and subdomains and corresponding 28 million paths. And paths were looking like the same. Domain is DE, for example, and the related paths are account myreviews and stuff. And our models, of course, will be all open source, and we will be sharing after this talk, actually. For subdomain enumeration and for path enumeration, I will leave the links after the talk as well. So let's talk about some fun parts, the example scenarios of it. So as SubVis did, you can just give a list of non-URL paths observed on the target domain and expect LLM to generate more. So system prompt will be something like, you're a path generation model trained to assist in web reconnaissance, and given a list of non-URL paths for a specific target, your job is to suggest other realistic and likely paths for the same target. It's basic, right? And my user prompt was, let's say I discovered these endpoints, these paths, like login card, checkout product. I mean, it's clearly e-commerce company, right? So based on this, suggest 10 more realistic paths that might exist on the same website, I asked. And the default preset of QM3 4 billion was products, clothes, accessories, bags, wish list, contact, account, orders. I mean, pretty much related to e-commerce, so I think it was good. And in our test, I also write a Python code for this. So firstly, it's like generating with temperature 0.6, and after this, I gave Defcon 32 as domain, and it will come up with collections, collection of accessories, collection bags, and stuff. And also, something like, some of them does not make any sense, because copy of 2028 and 600, and stuff like this. So it was not perfect, but it also can come up with new ones too. And same applies for subdomain generation as well. So we can send some already known subdomains to target and expect it to generate much more. Again, your subdomain generated model trained to assist in web reconnaissance, given a list of non-subdomains, come up with newer ones. And my prompt was shop.example2.com, dev.example2.com, and generate 10 more subdomains. And the default Quentry 4b come up with admin, blog, support, mail, contact, help docs. I mean, they look good, but I gave dev. There is clearly something with development, stage environment, and something like that, right? But we didn't see any development-related things in Quentry's result. And the one we fine-tuned with Preset and also trained with millions of subdomains, it can come up with accounts-dev, accounts-api, dev-api, staging.api, test-staging, api-dev, and more on. So it's much more related to what I actually gave as input. And the most fun part is actually we can use it in an agent structure. So let's say user just inputs a single real subdomain of the target. Like, not a list of subdomains, just a single real subdomain. What LLMs will do is deconstruct that subdomain into parts, identifies that parts and these corresponding patterns and symbolic slots, and as an output, a list of realistic pattern-consistent subdomain candidates will be given to us. So how will it look like? So let's start from the top left. So user will start like, hey, give me possible subdomains of apple.com, use this specific subdomain to enumerate. And our given subdomain is activate-iphone-use1-cx02.apple.com and it's a real subdomain of Apple, actually. So when user gives that, what our first LLM, the first part of the agent, will do is turn this activate-iphone into activate-product-use-region-id and cx-cluster-id. And then it will identify these variable slots and give some symbolic representations. For example, it will know that after the activate keyword, I need to put some Apple product. After that use, I need to use some digit. And after the cx, I need to put some digit but with leading zero. And after this, in this agentic structure, we are coming to the second part, second LLM, which trained with our data. It will use its internal knowledge and create an intelligent list of Apple product first. So it can use Mac, iPod, iPad, iPhone, or watch, and it will iterate over possible combinations. I mean, it's just not iterating over product, it's also generating region IDs and digits with leading zero. And then after that, it will iterate over combinations to generate realistic subdomain variants like this one. Instead of activate-iPhone, it will say activate-Mac-use-to-cx-01. And if you wish, of course, after all of this agentic structure, you can just validate this subdomain as well using DNSx, HTTPS, whatever you like. And let's see that in action actually. So when I run my program with the single subdomain inputs, so it will firstly identify the pattern, like the agent one, pattern inference one, action, product, region, cluster ID, environment, number. Then it will come up with some variable slots, like activate, action, enable action, register action, setup action. And for the products, iPhone, iPad, Mac, or watch. For the region, environments, and numbers, it generates something. And then it generates much more based on each of the identified patterns. And then in the end, it will come up with a list looking like this. So there's like enable iPad, ew1, prod01. I mean, I certainly cannot think about it when I think about this manually, but our agentic structure can do it. And semantic endpoint discovery. This is also fun one because user also giving a single observed path here. And what LLM will do is, again, we will be giving the API V to user underscore CRT. I'm using the same example here with my case. So we are asking for to generate much more. And it will first understand there's a versioning convention, user, like the shorthand for user, and abbreviation here for create, and starts with a capital letter, and also extract the potential variable slot. And after this, it is generating output for, it will be an input for the other LLM. We are just giving some hints, other LLM, to generate a new path based on this. And the other LLM retrieved the YAML file or the JSON file as an output from LLM1, and starts generating each section of the retrieved path. And after that, it can, of course, try this, as we said, as we seen earlier, there might be an API data agent as well. So in action, it's doing the same thing, like we have seen already. So there's like, it understands that there's an entity in action, and as a result, it will generate pretty much good results, like ADM and user and other stuff. And what are we releasing is new models and features, of course, because I originally trained it with 4 billion parameters. I will also train it with 1.3 billion so that everyone can run it locally. And we are going to categorize data like tech, finance, Apple, so that if you look for Samsung's subdomains, it can use Apple's subdomains, because they are both tech-related. There will be prioritization based on the enumeration result. For example, if you see login-dev, it will mark as hide, because login page and development. And our agentic target analyzer will be able to answer questions we ask about the target web. Releases, of course, it's hopefully not be like that. For all models, it will be published in Enumerate. For GitHub, this is the corresponding page. And you can check everything from enumerate.com. It currently is like a blank page, but there will be something. You can just go to the enumerate.com and follow the links from there. That will be published. And final verse, I would like to thank Alican Kras. He is a senior staff engineer at Trendyol. Some of them maybe know him already, Alican. He is the inventor of the Seneca LLM and Baron LLM, which are very cybersecurity-related trained big models you can use, and they're all open source. And he helped me with this all LLM stuff so much, so I couldn't have done without him. So thanks to him. And of course, thanks for listening to me. These are my address, and if you have any questions, I know we don't have pretty much time, but I will be happy to listen and answer after this talk.