start	end	text
8320	12420	We are really excited to present in the AppSec village.
13020	25120	And today we are going to talk about Bollabuster, our methodology that we developed in order to automate Bolladetection at scale using LLMs.
27540	30360	But first, let's introduce ourselves.
30360	35580	So my name is Reivid, I'm a security researcher at Palo Alto Networks.
35840	42060	I expertise in the WAAS field, which is web application and API security mainly.
42740	51760	And in my free time I enjoy watching football games, traveling the world, and take care of my dog, Maple.
55400	76020	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 cloud environment and recently I've shifted my research focus towards generative AI, in particular looking into the potentially adversarial use of generative AI.
76260	86000	And I'm not 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.
86000	89560	I know how difficult it is to take care of young kids when working.
89880	99500	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.
103230	107310	Great, so let's go over the agenda for today.
107390	133970	So we are going to cover the concept of BOLA, we will show you our methodology of automating BOLA hunting using LLMs, you are 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.
137590	142050	So broken object level authorisation, or short for BOLA.
142650	148810	So our motivation for the research was pretty huge, I would say.
148850	163750	For those of you who are not familiar with BOLA, it is ranked at the top risk at the OWASP API top 10, and it is also the fourth most reported vulnerability in HackerOne.
163750	166530	So it's really popular and it's really severe.
167450	175070	And yet there is no automation tool that can actually and reliably detect BOLA at scale.
175550	182770	So all of this was a big reason for us to try to solve basically an unsolved issue.
185670	189990	And let's understand first what is exactly BOLA.
190250	202750	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.
202850	204350	Pretty straightforward.
205130	213170	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?
214090	222130	If he would be able to do it, it means that the backend will have an authorisation issue, and this is basically a BOLA.
222350	241930	So in a straightforward 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.
243090	245510	And the consequences can be huge.
245510	252210	It can start from data leaks to data manipulation and even the full account takeover, as we will see today.
255610	261670	We faced many challenges when we tried to automate the process of BOLA detection.
261990	265150	The first was the complex authorisation mechanism.
265910	273750	So application these days actually has typically multiple users with multiple roles, with multiple resources.
273910	278070	So it's very difficult to say which user can do what.
278130	281750	Which user is allowed to do which action exactly.
282510	284910	And this really can get complex.
286150	295510	Also applications are stateful today, so each action you make or each API call you make can affect the state of the application.
296590	300410	And basically each endpoint is dependent on one another.
300410	306210	So imagine you try to delete a comment from an article or a post.
306630	313730	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.
314150	319530	So they are dependent on each other, you cannot isolate one of them.
319950	326170	And the execution order is really important in order to not have any technical issue.
327050	333930	So it is a big challenge to understand this endpoint dependencies actually.
336550	352170	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 recognise the pattern of the payload, BOLA is a logical error.
352370	359190	It's not really malicious by definition, so it's hard to analyse and understand whether it is a BOLA or not.
361510	364170	And lastly, the context.
364610	371490	So we try to understand which endpoint in the application and which parameter contains sensitive data.
371710	374870	And it's not that easy to understand it.
375010	381330	And also to understand what is the impact actually of each action that we can take in the application.
382390	390130	So all of this was pretty big challenges that we faced during the process.
395270	397430	Thanks, Ravi, for covering the background.
397430	403170	I hope everyone understands why automating data BOLA detection is difficult.
403510	412830	So it was only two years ago that we realised that AI may be able to give this problem a glimpse of hopes.
413150	422630	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.
422850	435990	And also in particular, our challenge of extracting context and logic information from textual data aligns well with the capabilities of large language model.
436330	441730	So that's the start of our journey in using AI to solve BOLA detection.
441730	446470	Here is a high-level overview of our methodology.
446470	452930	The only required input of our methodology is an open API spec or a swagger spec.
453270	459430	The first stage, identify the endpoint that can be vulnerable to BOLA.
459430	463090	Not every endpoint can be vulnerable to BOLA.
463090	472580	We use AI to help analyse every endpoint and its parameters to determine, to select a subset of endpoints as our target.
473550	484530	This step helps us narrow down our target endpoint and avoid wasting time on the endpoints that are not at risk.
484530	492190	We call this endpoint a potentially vulnerable endpoint, short for PVE or target endpoint.
492190	498350	We will refer to this endpoint as target endpoint or PVE in the rest of the talk.
498450	503450	The next stage, uncover the dependency relationship between endpoints.
503730	509510	Modern web applications are complex, typically one endpoint depending on many others.
509510	520030	For example, in order to test an endpoint that updates an invoice, you first need to call the endpoint that creates the invoice.
520030	527890	In order to create an invoice, you first need to call the endpoint that creates the transactions that can be included in the endpoint.
527890	537310	As a result, it is crucial to understand the endpoint that my target endpoint depends on before I can accurately test it.
538150	551810	With the endpoint dependency relationship identified, the next stage, calculate the execution path to each target endpoint and create a test plan for each target endpoint.
552510	562050	The next stage then transforms the test plan into multiple executable bash scripts using large language model.
562050	570290	There may be one or multiple execution paths to each target endpoint and we aim to cover as many paths as possible.
570630	579470	Finally, we set up a target API server and run all the test script generated in the previous step.
579490	591870	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.
595620	599340	Let's dive into a little bit more detail in each stage.
599340	608240	In the first stage, we try to identify the endpoint with input parameter that reference private sensitive or confidential information.
608240	611200	These are the endpoints that we target.
611200	613480	These are our target endpoints.
614200	616860	For example, let's look at the first endpoint.
616860	624380	The username here indicates that the endpoint may reference to data associated with the individual.
624380	630960	If this endpoint is vulnerable to BOLA, an attacker may be able to reset another user's password .
632180	646720	Similarly, if the second endpoint input user email is vulnerable to BOLA, an attacker may be able to change another user's email.
647280	657780	Traditionally, pen tester manually look for this endpoint and their parameters to determine their target endpoint.
657780	666280	This process is slow and cumbersome, especially for very large applications with hundreds of endpoints.
666280	674660	So we use AI's capabilities of reasoning and understanding text to automate this step.
675120	687710	Here is a snippet of our prompt that show how we teach AI to recognize parameters that may reference to sensitive data.
687710	693710	Essentially, we instruct AI a set of rules and examples.
694550	702890	At the end, AI returns us the endpoint and parameters that meet any of the conditions that we provided.
704550	709610	The next stage uncovers the dependency relationship between endpoints.
709730	726050	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.
726050	732770	As a result, it is crucial to identify their dependency relationship before we can test them.
733650	741370	In this diagram, we call the endpoint on the right as consumers and the endpoint on the left as producers.
741790	748230	Producer endpoints output the values that consumer endpoints need as input.
748230	755830	Again, producer endpoints output the values that consumer endpoints use as input.
755830	761190	This is one of the most important concepts in our research, in our methodology.
761270	766330	Let's look at this endpoint as an example, delete user.
766330	774110	In order to correctly test this endpoint, we need to feed it with an existing username.
774110	785130	If we feed it with a random variable, a random username, this endpoint will always, API code will always fail and give us meaningless result.
785130	788610	That's why we need to identify its producers.
788810	799150	In this case, this consumer endpoint has four producers and each of them can output the existing username that endpoint can use.
800270	808490	Here is a snippet of the prompt that we use to teach AI how to recognize dependency relationship.
808490	822710	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.
823010	826930	This heuristic algorithm is not reliable.
826930	837090	The reason is that developers sometimes use different parameter names to reference the same data object within the system.
837230	845750	Developers may also use the same parameter names to reference different data objects across the system.
845750	852850	That's why we use a combination of heuristic and AI to uncover the dependency relationship.
852850	865410	We need AI to analyze each endpoint functionality in order to establish their dependency relationship based on their functionalities.
868070	881570	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.
883130	891190	In this dependency tree, the root node represents one of our target endpoint or PVE.
891210	907050	Any two directly connected nodes in a tree represent a consumer and producer relationship in which the parent node is the consumer and the child node is the producer.
907670	911110	Let's use the upper half of a tree as an example.
911110	921270	In this case, endpoint is a producer of PVE endpoint output, the value that PVE needs as the input.
921270	932930	Endpoint 1 itself also has two producers, endpoint 3 and 4, which produce the output that endpoint 1 needs as the input.
934470	945370	Finally, in the next stage, we calculate the execution path to each potentially vulnerable endpoint.
946190	956390	In the dependency tree, a path from the leaf node to the root node represent an execution path.
956710	967830	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.
968250	972690	Let's plug in some real endpoint to see how we do the calculation.
972690	983650	In this example, the target endpoint is delete comment, and this endpoint has two producers, get comment and post comment.
984090	998950	These two producers in turn also each has two producers, so at the end, there are four execution paths that can all reach the target endpoint, delete comment.
1000290	1018450	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.
1018890	1024310	The process is more complicated than just generating and sending the request, but it's a lot of work , so I'm going to leave it at that , and Mr .
1024310	1027210	Stravit will explain in the next few slides.
1030530	1031270	Great.
1031270	1034590	Thank you, Jay, for the overview of our methodology.
1035810	1048550	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.
1048890	1056710	So we use LLMs, again, to create the user registration process and to collect the login data of the application.
1057910	1067590	So basically, we generate user... LLM generates user credentials that meets the criteria in terms of the, for example, password complexity and ETC.
1068390	1075890	And we execute the user registration process and we fetch the login data from the spec.
1075890	1087690	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.
1088210	1093970	This information will be stored in a dedicated file, so we will have an easy access and usage.
1095370	1099270	Then we will want to isolate the test data.
1099970	1106130	So if you ever saw a API spec file, you know that it can be huge.
1106130	1111510	It can be a thousand lines of code, especially for the bigger applications.
1112150	1117990	And we want to isolate only the data that is needed for the specific test.
1118750	1127830	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.
1128730	1138550	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.
1139390	1147990	So we do it for efficiency to ensure that LLM will get only the accurate data that it actually needs for each test creation.
1148930	1154710	And for cost, we want to have as lowest tokens as we can.
1156830	1164450	And finally, we're creating the test script and it will be saved as an executable bash script.
1164710	1170730	You can see an example of a very simple consumer and producer.
1170730	1175710	We have a put user password and a get user to get the username.
1176110	1179510	This kind of test will be saved in a put get directory.
1179510	1183110	Put would be the parent, get would be the child.
1184810	1189870	And the test generation actually runs asynchronously in order to save time.
1190790	1197140	And right now we averaged 1.5 seconds for each test creation.
1199390	1206580	Right, so the final step would be to actually run the test script in the application.
1207380	1216820	So we have an execution order and our main goal is to avoid any chance that a test would fail due to technical reasons.
1217340	1221520	So we want the test to fail only if the PVE is not vulnerable to bola.
1221560	1222620	It should be.
1223460	1229720	So we will first run the test that populate data and resources to the application before we can fetch them.
1231240	1242820	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.
1243220	1252120	So again, the main reason for this is not to have technical issues in a test that will make it fail eventually.
1254260	1266600	So right after we finished preparing our methodology, we wanted to evaluate our bola buster actually and see the result.
1266820	1274620	So what we did is we took maybe the best API fuzzer, which is open source right now, which is Restler.
1275020	1278280	Restler is a Microsoft -developed API fuzzer.
1278280	1280420	You can find it on GitHub.
1281140	1289320	And its goal is to automate the process of API testing and to find vulnerabilities, like our goal.
1289940	1298700	So what we did is we took three open source applications, which are deliberately vulnerable to the OWASP API top 10.
1299160	1301640	We took Vampi, Capital and Krapi.
1301640	1305740	You can see from the table that they have unknown bolas.
1306380	1310200	And we started to test our tool against Restler.
1311900	1318940	As you can see, Restler could not identify any bola of these applications.
1319160	1323320	And it made a pretty big number of API calls.
1323320	1326240	Thousands and even hundreds of thousands.
1327400	1333160	Then we tested our tool, again the same application, and the results were amazing.
1333760	1342500	I hope you can see, we found all the bolas in each one of the applications and we made significantly lower API calls.
1342720	1347760	So eventually we made less than 1% of the calls that Restler made.
1348000	1350540	So this is a crucial part.
1350540	1359020	It proved our efficiency and we didn't make the application load too much.
1360340	1365960	Finally, we wanted to have a 100% true positive rate.
1366480	1372300	So our goal was to find any bola if it exists in the application.
1372820	1376340	We did have some false positives, you can't avoid it.
1376540	1383900	But again, our main goal was to focus on the true positive rate, which was 100%.
1385940	1391540	Now we can take a look on a real scenario for a bola test.
1391780	1404720	So we have this high-level example, where first Alice creates an article, then Alice creates a comment for this article, and then Bob will try to delete Alice's comment, which is the PVE.
1406420	1413020	So first, Alice and Bob will log into the system, they will get a unique token, which will be saved.
1414620	1419280	Alice will create a new article in the system, we will save the article title.
1420600	1425720	We will do the same with the comment, so Alice will create a comment, we will save the comment ID.
1426540	1433420	And finally, the PVE, the maliciously Bob, will try to attempt to delete Alice's comment.
1434020	1436460	And this scenario can have two results.
1437100	1448420	If it will be successful, we will have a potentially bola for this endpoint, or if the application can defend the bola as well, so it will be forbidden.
1450420	1453540	Let's see the actual snippet of our code.
1454040	1468780	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.
1469600	1485060	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.
1487420	1492160	We will save the slug, which is in this case the article title.
1494700	1498940	Next, Alice will create a comment.
1499080	1507880	So what's special about this is that if you take a look at the actual endpoint, you can see that we dynamically use slug.
1507960	1515440	So we saved this parameter from the previous request, and then we dynamically use it.
1515440	1522600	So now we can reference to it as a... we can know that this resource actually belongs to Alice.
1524580	1531660	Again, we save the comment ID, and then finally we have the PVE, the delete operation.
1532400	1539300	You can see again that we use slug and comment ID that belongs to Alice.
1539600	1548620	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.
1549640	1551840	And lastly, we will check if the test passed.
1552760	1560980	Now I want to emphasize that actually every BOLA test that we make is, if you think about it, it is malicious by definition.
1561540	1569900	The last request, the PVE, we will always, we will try to perform an action that you shouldn't be able to perform, right?
1570020	1573300	Bob shouldn't be able to delete Alice's comment.
1573420	1587780	So in case it is successful, we can mark this test as at least potentially vulnerable to BOLA, before we can make a further analysis and verification, let's say, in the application context.
1588180	1593520	So you just need to understand that every BOLA test is malicious by definition.
1596470	1601790	So let's see how we actually hunted some BOLAs in the wild.
1604560	1608340	We have a quick demo of showing the running of the tool.
1609200	1626200	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 BOLA found and the actual API endpoint.
1627540	1635120	After this, we will take the list and we'll further analyze it and try to understand if this is a real BOLA or not.
1637540	1642080	So all of these applications, it has something in common.
1642080	1643940	We found BOLAs in it.
1644420	1646140	So first of all, Harbor.
1647420	1650240	It is a cloud-native container registry.
1650240	1655480	It is basically equivalent to Docker Hub, which I'm sure most of you are familiar with.
1656020	1663140	It is a CNCF-graduated project, so it's been in the wild for a while .
1664180	1674520	It has around 2 million downloads these days and we actually found, this year we found a new BOLA, which we will talk in a bit.
1675840	1677580	Next up, Grafana.
1677580	1680620	It's a data visualization and monitoring tool.
1680740	1682220	Very, very popular.
1682220	1687060	It's being used by 20 million users, actually, these days.
1687060	1690020	And we also found a new BOLA there.
1691540	1695860	And lastly, we have Easy Appointments, which is an open-source tool.
1696340	1706100	It has almost 200,000 downloads and we've actually been able to find 15 new BOLA vulnerabilities there.
1706340	1707120	Yeah.
1707660	1709200	Little bit.
1710240	1715460	The most amazing thing about it is actually that seven of them are critical.
1716100	1725100	So they got a CVSS of 9.9, which actually allows a low-privileged user to gain admin access.
1725100	1727040	Remember we talked about compromise?
1727040	1731940	So we have a full application compromise in this case.
1734260	1737180	Let's talk about Arbor vulnerability.
1737180	1738740	It's pretty interesting.
1739840	1743480	So, Arbor has projects in it.
1743660	1749020	You can have roles, so you can be an admin, a maintainer, a developer, or a guest.
1749660	1756640	Basically, we found the vulnerable feature to be the project configuration metadata.
1756640	1761120	So I hope you can see the attributes there for the configuration.
1761500	1772520	Basically, an admin can change the project to be private, public, you can implement some image vulnerability scanning and have more power.
1773620	1785060	So Arbor claimed that in their official documentation that only the admin project should be able to create and modify these kind of configurations, which makes sense.
1786440	1793000	And actually, we found out that an unauthorized user can do the same operation.
1793320	1802240	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.
1802440	1805920	So this is a maintainer login, which is grayed out.
1805920	1807720	You cannot modify it.
1807720	1816480	But maintainer can actually create, delete, and modify these attributes via the API.
1816660	1822160	So there is a big discrepancy between the UI and the API behavior.
1822660	1842860	And this vulnerability actually creates an extent in the maintainer privileges, so now a malicious 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.
1844160	1855140	And as you can imagine, the consequences can be pretty high, so we can compromise the integrity of a project and actually the security posture.
1857100	1869560	So Harbo verified this vulnerability and you can find it in their security advisory.
1869560	1870860	We got a CVE.
1871200	1878040	And you can check out our blog about it when we technically talk about how we found this bola.
1881120	1882160	Thanks.
1882420	1889080	I will just use the last 30 seconds to share the most important lessons we learned from working with AI.
1889080	1891960	First, AI isn't always the best solution.
1892520	1899980	Problems with existing heuristic solutions should not be solved by AI, like sorting, finding trees, or solving equations.
1899980	1906140	Those problems have existing optimal solutions and always use heuristic rather than AI.
1906140	1908280	Second, don't trust, always validate.
1908280	1912080	Blindly trusting the output of AI can be very, very dangerous.
1912360	1918400	So always validate the output of AI before using them or passing them to the next stage.
1918400	1921440	Finally, make AI's jobs easier.
1922140	1932720	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.
1932720	1940680	So when working with AI, it is always a good idea, good strategy to use divide and conquer to simplify its tasks.
1941120	1943540	And thank you so much.
