All right, it is my fantastic opportunity to introduce Ravid and Jay talking about Bolobuster. All right, all right, check, check. Everybody hear me? Okay, great. So good morning, everybody, and thanks for joining. We are really excited to present in the AppSec Village, and today we are going to talk about Bolobuster, our methodology that we developed in order to automate detection at scale using LLMs. But first, let's introduce ourselves. So my name is Ravid. I'm a security researcher at Palo Alto Networks. I expertise in the WAAS field, which is web application and API security, mainly. And in my free time, I enjoy watching football games, traveling the world, and I take care of my dog, Maple. Hi, my name is Jay. I am a security researcher with Palo Alto Networks, and my research has been focusing on identifying the threat and risk in the cloud environment, and recently I have shifted my research focus towards generative AI, in particular looking into the potentially adversarial use of generative AI. When I'm not working, I spend most of time with my hyperactive twin boys. They behave just like minions and head off to the parent there with young kids. I know how difficult it is to take care of young kids when working. And I'm also a cat lover, so I also spend a lot of time scrolling through funny cat videos when I'm not working or working. Great, so let's go over the agenda for today. So we are going to cover the concept of BOLA. We will show you our methodology of automating BOLA hunting using LLMs. You are going to see a real BOLA testing that is part of our methodology. And finally, you will see how we hunted down 17 new BOLA vulnerabilities in one of the most popular open source projects out there. So broken object level authorization or short for BOLA. So our motivation for the research was pretty huge, I would say. For those of you who are not familiar with BOLA, it is ranked at the top risk at the OWASP API top ten. And it is also the fourth most reported vulnerability in HackerOne. So it's really popular and it's really severe. And yet, there is no automation tool that can actually and reliably detect BOLA at scale. So all of this was a big reason for us to try to solve basically an unsolved issue today. And let's understand first what is exactly BOLA. So if you take a look at this example, we have a patient, we have a clinic application and we have a patient that can query his visit ID and get his doctor notes. Pretty straight forward. But what would happen if this patient would decide to act maliciously and try to fetch another visit ID that does not belong to him? If he would be able to do it, it means that the back end will have an authorization issue and this is basically a BOLA. So in a straight forward way, if I can delete or modify let's say Jay's comment from Twitter or Instagram, this is a clear BOLA because I shouldn't have the permission to access, modify or delete another user object that does not belong to me. And the consequences can be huge. It can start from data leaks to data manipulation and even the full account takeover as we will see today. We faced many challenges when we tried to automate the process of BOLA detection. The first was the complex authorization mechanism. So application these days actually has typically multiple users with multiple roles with multiple resources. So it's very difficult to say which user can do what. Which user is allowed to do which action exactly. And this really can get complex. Also applications are stateful today. So each action you make or each API call you make can affect the state of the application. And basically each endpoint is dependent on one another. So imagine you try to delete a comment from an article or a post. So first you would need to create this post and create a comment for this post and only then you will be able to delete this comment. So they are dependent on each other. You cannot isolate one of them. And the execution order is really important in order to not have any technical issue. So it is a big challenge to understand that these endpoint dependencies actually. Also BOLA doesn't have a there is a lack of vulnerability indicator basically. So unlike XSS or SQL injection which is pretty straightforward to recognize the pattern of the payload, BOLA is a logical error. So it's not really malicious by definition. So it's hard to analyze and understand whether it is a BOLA or not. And lastly the context. So we try to understand which endpoint in the application and which parameter contains sensitive data. And it's not that easy to understand it. And also to understand what is the impact actually of each action that we can take in the application. So all of this was pretty big challenges that we faced during the process. Thanks, Ravi, for covering the background. I hope everyone understands why automating data BOLA detection is difficult. So it was only two years ago that we realized that AI may be able to give this problem a glimpse of hopes. Because of the recent advancement of AI, we were provided with new tools to solve the problem that were not possible to solve in the past. And also in particular, our challenge of extracting context and logic information from textual data aligns well with the capabilities of large language model. So that's the start of our journey in using AI to solve BOLA detection. Here is a high-level overview of our methodology. The only required input of our methodology is an OpenAPI spec or a Swagger spec. The first stage, identify the endpoint that can be vulnerable to BOLA. Not every endpoint can be vulnerable to BOLA. We used AI to help analyze every endpoint and its parameters to determine, to select a subset of endpoints as our target. This step helped us narrow down our target endpoint and avoid wasting time on the endpoints that are not at risk. We call this endpoint a potentially vulnerable endpoint, short for PVE, or target endpoint. We will refer to this endpoint as target endpoint or PVE in the rest of the talk. The next stage, uncover the dependency relationship between endpoints. Modern web applications are complex. Typically, one endpoint depending on many others. For example, in order to test an endpoint that updates an invoice, you first need to call the endpoint that creates the invoice. And in order to create an invoice, you first need to call the endpoint that creates the transactions that can be included in the endpoint. As a result, it is crucial to understand the endpoint that my target endpoint depends on before I can accurately test it. With the endpoint dependency relationship, identify the next stage, calculate the execution path to each target endpoint, and create a test plan for each target endpoint. The next stage then transforms the test plan into multiple executable bash scripts using large language model. There may be one or multiple execution paths to each target endpoint, and we aim to cover as many paths as possible. Finally, we set up a target API server and run all the test script generated in the previous step. The process of user registration, user login, and token refresh have all been automated. And we also use AI to help analyze the response and logs produced during the test. Let's dive into a little bit more detail in each stage. In the first stage, we try to identify the endpoint with input parameters that reference private, sensitive, or confidential information. These are the endpoints that we target. These are our target endpoints. For example, let's look at the first endpoint. The username here indicates that the endpoint may reference two data associated with the individual. If this endpoint is vulnerable to BOLA, an attacker may be able to reset another user's password. Similarly, if the second endpoint input user email is vulnerable to BOLA, an attacker may be able to change another user's email. Traditionally, pentesters manually look for this endpoint and their parameters to determine their target endpoint. This process is slow and cumbersome, especially for very large applications with hundreds of endpoints. So we use AI's capabilities of reasoning and understanding text to automate this step. Here is a snippet of our prompt that shows how we teach AI to recognize parameters that may reference two sensitive data. Essentially, we instruct AI a set of rules and examples. At the end, AI returns us the endpoint and parameters that meet any of the condition that we provided. The next stage uncovers the dependency relationship between endpoints. As I mentioned, due to the complexity of modern web application, each API call may change the state of the application and affect the outcome of other API endpoints. As a result, it is crucial to identify their dependency relationship before we can test them. In this diagram, we call the endpoint on the right as consumers and the endpoint on the left as producers. Producer endpoints output the values that consumer endpoints need as input. Again, producer endpoints output the values that consumer endpoints use as input. This is one of the most important concepts in our research, in our methodology. Let's look at this endpoint as an example, delete user. In order to correctly test this endpoint we need to feed it with an existing username. If we feed it with a random variable, a random username, this endpoint will always, the API call will always fail and give us meaningless result. That's why we need to identify its producers. In this case, this consumer endpoint has four producers and each of them can output the existing username that endpoint can use. Here is a snippet of the prompt that we use to teach AI how to recognize dependency relationship. I want to emphasize that also we can use heuristic algorithm to match the output parameter name of an endpoint with the input parameter name of a consumer. This heuristic algorithm is not reliable. The reason is that developers sometimes use different parameter names to reference the same data object within the system. Developers may also use the same parameter names to reference different data object across the system. That's why we use a combination of heuristic and AI to uncover the dependency relationship. We need AI to analyze each parameter endpoint's functionality in order to reestablish their dependency relationship based on their functionalities. Once we have the, using the dependency relationship uncovered in the previous stage, this stage build up a dependency tree for each potentially vulnerable endpoint. In this dependency tree, the root node represent our, one of our target endpoint, or PVE. And any two directly connected nodes in a tree represent a consumer and producer relationship in which consumer, the parent node is a consumer and the child node is a producer. Let's use the upper half of a tree as an example. In this case, endpoint is a producer of PVE. Endpoint output the value that PVE need as an input. And endpoint one itself also has two producer, endpoint three and four, which produce the output that endpoint one need as the input. Finally, in the next stage, we turn, we calculate the execution path to each potentially vulnerable endpoint. So in the dependency tree, a path from the leaf node to the root node represent an execution path. This is a reverse tree traversal. So the path is actually from the leaf node to the root node instead of from the root node to the leaf node. And let's plug in some real endpoint to see how we do the calculation. In this example, the target endpoint is delete comment. And this endpoint has two producers, get comment and post comment. And these two producers in turn also each has two producer. So at the end, there are four execution paths that can all reach the target endpoint delete comment. In the last stage, we then turn each execution path into an executable bash script using large language model and run the script to actually send HTTP request to the target endpoint. The process is more complicated than just generating and sending the request as Ravid will explain in the next few slides. Great. Thank you Jay for the overview of our methodology. And before we can see actually a real BOLA test and view our BOLA that we found, let's see the prerequisites that we have before we can create an actual test. So we use LLMs again to create the user registration process and to collect the login data of the application. So basically we generate user LLM, generate user credentials that meets the criteria in terms of the, for example, password complexity and ATC. And we execute the user registration process and we fetch the login data from the spec. So this is crucial in order to then log in the users of the specific test and get a valid and unique token for each one of them. This information will be stored in a dedicated file so we will have an easy access and usage. Then we will want to isolate the test data. So if you ever saw a swagger or open API spec file, you know that it can be huge. It can be thousand lines of code, especially for the biggest, for the bigger applications. And we want to isolate only the data that is needed for the specific test. So Jay mentioned that we have a consumer and producers in each test so we would like to have only the data which is relevant to these endpoints. So we will create a new file, we will feed it to AI and it will save us about 90 to 95 percent of the spec. So we do it for efficiency to ensure that LLM will get only the accurate data that it actually needs for each test creation. And for cost, we want to have as lowest tokens as we can. And finally, we're creating the test script and it will be saved as an executable bash script. You can see an example of a very simple consumer and producer. We have a put user password and a get user to get the user name. This kind of test will be saved in a put get directory. Put would be the parent, get would be the child. And the test generation actually runs asynchronously in order to save time. And right now we averaged a 1.5 second for each test. And we have a 1.5 second for each test creation. Right, so the final step would be to actually run the test script in the application. So we have an execution order and our main goal is to avoid any chance that a test would fail due to technical reasons. So we want the test to fail only if the PVE is not vulnerable to BOLA. It should be. So we will first run the test that populate data and resources to the application before we can fetch them. And also we will try to push and delete, to push update and delete operation to the end so we won't experience a scenario where we delete a user or delete a resource and then try to fetch it. So again, the main reason for this is not to have technical issues in the test that will make it fail eventually. So right after we finished our, preparing our methodology, we wanted to evaluate our BOLA buster actually and see the results. So what we did is we took the, maybe the best API fuzzer, which is open source right now, which is Ressler. Ressler is a Microsoft developed API fuzzer. You can find it on GitHub. And its goal is to automate the process of API testing and to find vulnerabilities, like our goal. So what we did is we took three open source applications which are deliberately vulnerable to the OWASP API top ten. We took Vampy, Capital and Crappy. You can see from the table that they have unknown BOLAs. And we started to test our tool against Ressler. As you can see, Ressler could not identify any BOLA of these applications and it made a pretty big number of API calls. Thousands and even hundreds of thousands. Then we tested our tool, again the same application, and the results were amazing. I hope you can see, we found all the BOLAs in each one of the applications and we made significantly lower API calls. So eventually we made less than one percent of the calls that Ressler made. So this is a crucial part. It proved our efficiency and we didn't make the application load too much. Finally we wanted to have a 100 percent true positive rate. So our goal was to find any BOLA if it exists in the application. We did have some false positives, you can't avoid it, but again our main goal was to focus on the true positive rate which was 100 percent. Now we can take a look on a real scenario for a BOLA test. So we have this high level example where first Alice create an article, then Alice create a comment for this article, and then Bob will try to delete Alice's comment which is the PVE. So first Alice and Bob will log into the system, they will get a unique token which will be saved. Alice will create a new article in the system, we will save the article title. We will do the same with the comment, so Alice will create a comment, we will save the comment ID, and finally the PVE, the maliciously Bob will try to attempt to delete Alice's comment. And this scenario can have two results. If it will be successful we will have a potentially BOLA for this endpoint, or if the application can defend BOLA as well, so it will be forbidden. Let's see the actual snippet of our code. So first of all we will create a unique random string each time, so we will be able to create an article for multiple tests without getting an error that it already exists. So as you can see we make a POST request to slash API slash articles, you can see that we use user A token which reference to Alice, and we use the article title as a random string. We will save the slide which is in this case the article title. Next Alice will create a comment, so what's special about this is that if you take a look at the actual endpoint, you can see that we dynamically use SLAG. So we saved this parameter from the previous request, and then we dynamically use it. So now we can reference to it as a, we can know that this resource actually belongs to Alice. Again, we save the comment ID, and then finally we use the PVE, the delete operation. You can see again that we use SLAG and comment ID that belongs to Alice. And the main difference, now we use the user B token, so now we can identify that this request is made by Bob and not Alice. And lastly we will check if the test passed. Now I want to emphasize that actually every boiler test that we make is, if you think about it, is malicious by definition. The last request, the PVE, will always, we will try to perform an action that you shouldn't be able to perform, right? Bob shouldn't be able to delete Alice's comment. So in case it is successful, we can mark this test as at least potentially vulnerable to boiler before we can make further analysis and verification let's say in the application context. So you just need to understand that every boiler test is malicious by definition. So let's see how we actually hunted some boilers in the wild. We have a quick demo of showing the running of the tool. So this is a Python based and it will, I hope you can see, it's testing each API endpoint and in case the result is successful, it will mark it with boiler found and the actual API endpoint. After this we will take the list and we'll further analyze it and try to understand if this is a real boiler or not. So all of these applications, it has something in common. We found boilers in it. So first of all, Harbor. It is a cloud native container registry. It is basically a equivalent to Docker Hub, which I'm sure most of you are familiar with. It is a CNCF graduated project, so it's been in the wild for a while. It has around 2 million downloads these days and we actually found, this year we found a new boiler, which we will talk in a bit. And next up, Grafana. It's a data visualization and monitoring tool. Very, very popular. It's being used by 20 million users actually these days. And we also found a new boiler there. And lastly we have Easy Appointments, which is an open source tool. It has almost 200,000 downloads and we actually have been able to find 15 new boiler vulnerabilities there. A little bit. The most amazing thing about it is actually that 7 of them are critical. So they got a CVSS of 9.9 which actually allows a low privilege user to gain admin access. Remember we talked about compromise, so we have a full application compromise in this case. Let's talk about Arbor vulnerability. It's pretty interesting. So Arbor has projects in it. You can have roles, so you can be an admin, a maintainer, a developer or a guest. Basically we found the vulnerable feature to be the project configuration metadata. So I hope you can see the attributes there for the configuration. Basically an admin can change the project to be private, public, it can implement some image vulnerability scanning and have more power. So Arbor claimed that in the official documentation that only the admin project should be able to create and modify this kind of configurations. Which makes sense. And actually we found out that an unauthorized user can do the same operation. So we tried to play with the roles of the project and we saw that the maintainer for example could not make any change via the UI. So this is a maintainer login which is grayed out, you cannot modify it. But maintainer can actually create, delete and modify these attributes via the API. So there is a big discrepancy between the UI and the API behavior. And this vulnerability actually create an extent in the maintainer privileges. So now a maliciously maintainer could be able to make a private project public, deploy unverified images and actually control every configuration that you can control in a project. And as you can imagine the consequences can be pretty high. So we can compromise the whole integrity of a project and actually the security posture. So Harbo verified, that's it, okay. So just would say that Harbo identified this vulnerability and you can find it in their security advisory. We got a CVE and you can check out our blog about it when we technically talk about how we found this. Okay, thanks. I will just use the last 30 seconds to share the most important lessons we learned from working with AI. First, AI isn't always the best solution. Problems with existing heuristic solutions should not be solved by AI like sorting, finding trees or solving equations. Those problems have existing optimal solutions and always use heuristic rather than AI. Second, don't trust, always validate. Blindly trusting the output of AI can be very, very dangerous. So always validate the output of AI before using them or passing them to the next stage. Finally, makes AI's jobs easier. Treat AI like a very capable junior worker who can do simple tasks exceptionally well, but can start making mistakes when the job becomes more complex. So when working with AI, it is always a good idea, good strategy to use divide and conquer to simplify its task. Thank you so much.