WEBVTT

00:00.000 --> 00:09.880
So today we'll be talking about examining access control vulnerabilities in GraphQL and REST API as well and this will be a case, a field case study on data exposure.

00:09.880 --> 00:21.200
So we'll be talking about this dating app called Fieldy and how the access controls in the REST API and GraphQL API impacted this app.

00:21.680 --> 00:23.120
So who am I?

00:23.220 --> 00:35.600
Senior Pentester at 4Bridge, accreditation in Pentesting, DevSecOps and GCP security and I've been working in the past in the banking and gambling industry especially.

00:35.600 --> 00:39.400
I have more than ten years of experience in security, especially Pentesting.

00:39.600 --> 00:41.680
So what is this talk about?

00:41.700 --> 00:45.200
This talk is about the importance of access controls.

00:45.820 --> 00:55.900
And according to us, top ten API, it is on the first place known as BOLA category, broken object level authorization.

00:55.960 --> 01:04.920
And for web apps, it is also on first place known as broken access controls category in 2021.

01:05.300 --> 01:12.680
So as we can see for API and web apps, it is on the first place, the access controls issue.

01:12.680 --> 01:13.080
Okay.

01:13.080 --> 01:15.000
Let's see what is Fieldy?

01:15.000 --> 01:22.080
Our target for research for the security of the API regarding access controls.

01:22.080 --> 01:27.280
So this dating app Fieldy launched in 2014 under the name of Trendr.

01:27.280 --> 01:33.840
As the name implies, Trendr, it was focused solely on threesomes.

01:34.300 --> 01:43.280
In 2016 because of a naming conflict, Tinder Trendr, they changed their name to Fieldy and they became more open to the idea of dating.

01:43.280 --> 01:51.120
So Fieldy is a dating app just like Tinder, Bumble and others where you can filter by distance, by age, by gender.

01:51.120 --> 01:55.220
There are more than ten genders, couples and by location.

01:55.480 --> 02:05.440
If you buy premium membership and you are a premium user, you can also search by the type of kink you are interested in, three ways, group scenarios or the type of relationship you are interested in.

02:05.480 --> 02:08.680
On Android, it has more than one million downloads.

02:09.040 --> 02:10.640
So this is about Fieldy.

02:10.640 --> 02:13.200
Now let's see how this mobile app looks like.

02:13.360 --> 02:15.500
So we have four menus, four main menus.

02:15.500 --> 02:29.320
The first one, discover profile menus where you get the name of the photos, the name, how far that person is and where he's active, a short bio and what the person is interested in.

02:29.560 --> 02:34.360
The second menu, who liked your menu, this is the view as a basic user.

02:34.360 --> 02:37.300
All you can see is the name and the blurred photos.

02:38.080 --> 02:44.060
The third menu, messages, where you chat with the people you matched with.

02:44.060 --> 02:53.520
And the fourth menu, my profile, where you upload your photos, edit your biography and you can buy some premium membership.

02:53.520 --> 02:56.260
So this is how the Fieldy app looks like.

02:56.680 --> 03:00.900
Now let's see what we will be talking about today regarding API security.

03:00.920 --> 03:09.820
So I discovered eight vulnerabilities in this dating app, all of them related to access control issues.

03:09.820 --> 03:14.380
We will be taking them one by one and discuss each of them.

03:14.380 --> 03:22.740
The first one is part of the broken object property level authorization and the other seven are part of the BOLA category.

03:23.120 --> 03:25.120
What's the difference between these two?

03:26.420 --> 03:45.060
The BOLA category refers to unauthorized access to a whole user, to a whole object, whereas the BOLA category refers to unauthorized access to a specific property within the whole allowed object.

03:45.420 --> 03:45.800
Okay.

03:45.800 --> 03:52.540
Let's take them one by one and see how to reproduce them and what's the impact for all these API issues.

03:52.540 --> 03:57.300
First one, disclosure of profile information to non-premium users.

03:57.300 --> 04:03.800
So as I said, we go to the who liked you menu, we see as a basic user we only see the name.

04:03.880 --> 04:05.660
Everything else is blurred.

04:06.040 --> 04:08.280
So as a basic user we don't see anything.

04:08.280 --> 04:31.280
However, if we use a proxy tool such as burp, we intercept this request and we check the response, we will see a GraphQL request with the operation name likes query and in the response we will see details about these people that liked us.

04:31.280 --> 04:34.720
In this case we see imaginary name Sam.

04:35.120 --> 04:37.300
Interaction status, they liked us.

04:37.300 --> 04:39.060
We didn't like Sam yet.

04:39.060 --> 04:40.800
The status is active.

04:40.800 --> 04:42.980
So Sam is active.

04:42.980 --> 04:47.340
It's not a majestic meaning premium user.

04:47.720 --> 04:50.200
And we see a photo section.

04:50.360 --> 05:05.000
So if we copy the first photo of this user Sam and we paste it in the browser, we will get this photo of user Sam which belongs to this first photo blurred from user Sam.

05:05.000 --> 05:14.320
So as a basic user without paying for premium subscription, we managed to get more information than probably a premium user could get.

05:15.000 --> 05:15.300
Okay.

05:15.300 --> 05:22.740
So this was first vulnerability, disclosure of profile information to non-premium user.

05:22.740 --> 05:30.540
Another interesting field here for us that we can get is stream user ID which is unique to every user.

05:30.840 --> 05:38.800
So this is for user Sam and we will use this stream user ID value in order to build upon the next vulnerability.

05:39.420 --> 05:43.020
So vulnerability number two, read other people's messages.

05:43.260 --> 05:47.820
In order to do this, we will need the stream user ID from the previous vulnerability.

05:49.760 --> 05:54.300
To reproduce this issue, we go to the discover profiles menu.

05:54.300 --> 06:13.280
We intercept the GraphQL request which will be with operation name discover profiles and we will copy a random stream user ID, in this case ending with B4F which belongs to user Claw, this stream user ID.

06:13.280 --> 06:21.920
So now to read the messages of user Claw, we go in the app to the messages menu.

06:21.920 --> 06:39.680
We intercept the request to the end point slash channels and from this request we only leave the parameter members in and the stream user ID of our victim user called Claw and in the response we will find the messages of user Claw.

06:39.680 --> 06:43.860
If we search by text, we will see the first message saying hi, Claw.

06:44.420 --> 06:53.960
And in total, if we search by text, there will be 92 matches sent and received by our victim user Claw.

06:54.520 --> 06:55.380
Okay.

06:55.380 --> 07:06.380
Now that we can read the messages of specific users, when we read the messages, we will discover in those messages that there are attachments.

07:06.640 --> 07:20.260
You can send in the app multiple attachments such as photos and videos and the photos can be replayable or time limited and the videos can be replayable or time limited, play once only.

07:20.300 --> 07:22.260
So we have four types of attachments.

07:22.260 --> 07:25.760
Let's take them one by one and see how we can reproduce this issue.

07:26.220 --> 07:33.060
So to give you the high level overview, first the photo gets for replayable photos.

07:33.160 --> 07:37.960
The photo first gets uploaded on a third party domain.

07:37.960 --> 07:47.160
Then will be made available from two different end points for the sender and for the receiver to slash photo ID.

07:49.040 --> 08:14.740
In order to exploit it, we go in the opposite way from the bottom and we copy this, we leak this photo ID, we build these two URLs for a sender or receiver and because the back end doesn't even check the sender grid or the receiver grid, in this case we can just use an X or any letter and the back end will just validate for the photo ID and return the photo.

08:15.160 --> 08:18.900
And then we will have as an attacker to leak this URL.

08:19.160 --> 08:25.660
So this is the high level overview from the bottom to the top from the attacker's perspective.

08:25.660 --> 08:30.680
And it's the same, the high level overview for the time limited photos.

08:30.980 --> 08:41.380
First a valid user uploads it on a third party and then it will be made available to two different end points, sender grid and receiver grid.

08:41.460 --> 08:53.900
And after ten seconds this end point will be deleted and we will have to abuse and create this URL and then as an attacker we will have to leak this URL in order to get it unauthenticated.

08:53.900 --> 08:58.260
So now let's reproduce the issue and see exactly how we managed to exploit this.

08:59.400 --> 09:02.520
So uploading replayable photos.

09:03.180 --> 09:06.080
First request, let's do this as a valid user.

09:06.080 --> 09:15.360
There will be a GraphQL request with operation name called Cloudinary Generate Upload Credentials.

09:15.500 --> 09:27.500
It will generate some credentials for us, which will be used in a subsequent request where we upload the photo with those credentials.

09:28.640 --> 09:41.080
And then in a third request, I believe this request will make our photo available to the other two end points.

09:41.960 --> 09:47.060
And then it will paste the photo ID in the chat.

09:48.180 --> 09:52.400
So let's do this as an attacker.

09:52.540 --> 09:54.200
We log in as an attacker.

09:54.200 --> 10:08.320
We use the stream user ID of our victim to read their messages and we see in the attachment section the photo ID that we want to leak from our victim.

10:08.320 --> 10:11.960
And we see that it is of type image and it is replayable.

10:11.980 --> 10:25.780
So in order to leak this photo ending in FF4, we will have to build the URL, FF4, and I said they do not even check who sent it or who receives it.

10:25.780 --> 10:27.560
So an X could work.

10:27.580 --> 10:36.720
And then it will just return the photo without checking properly the end point if it's the sender or the receiver.

10:36.800 --> 10:38.780
However, we will need to be authenticated.

10:38.780 --> 10:45.280
So now that we got the photo as an attacker authenticated, let's see how we leak the unauthenticated URL.

10:46.240 --> 11:02.640
As part of the functionality of the application, there is an end point with V1 in front of it to this photo ID which actually leaks us the URL to the third party domain where we can access the photo unauthenticated.

11:02.640 --> 11:04.300
And this is what we did.

11:04.300 --> 11:12.440
And we have access to a photo unauthenticated on the third party domain from my desk office.

11:13.980 --> 11:16.680
So that was just abusing their functionality.

11:17.460 --> 11:18.280
Okay.

11:18.280 --> 11:22.280
Type 2, uploading type limited photos.

11:22.280 --> 11:26.280
So there are two main differences from the previous process.

11:26.320 --> 11:33.960
First we send an extra parameter saying visibility milliseconds, 15,000 milliseconds meaning 15 seconds.

11:34.000 --> 11:45.600
And then in order to leak the photo in order of the previous X, we will need the sender's profile grid to build the URL and leak the photo.

11:45.800 --> 11:46.340
Okay.

11:46.340 --> 11:47.980
Let's reproduce again the issue.

11:47.980 --> 11:49.880
We upload the photo.

11:52.000 --> 11:57.020
We pass the extra parameter, visibility milliseconds, 15,000.

11:58.260 --> 12:12.360
Now we read the chat as the attacker and we see an attachment section saying photo ID ending in E49, playable duration 15 seconds and replay mode view once only.

12:12.360 --> 12:15.460
So we copy this E49 photo ID.

12:16.600 --> 12:29.720
And if we paste it and build the URL with let's say the receiver photo ID, because the receiver already saw the photo, it will say attachment has expired.

12:29.720 --> 12:37.900
So here we will have to use the sender's profile ID.

12:38.000 --> 12:47.980
So in order to leak the photo, we will need the sender's profile ID and this will always return the photo to authenticated users.

12:49.300 --> 13:08.660
Then afterwards in order to leak it unauthenticated, we just prepend V1 in front of the URL and this will leak our E49 photo from the third party domain, in this case cloudinary.com.

13:08.920 --> 13:12.020
And this is the photo unauthenticated.

13:13.320 --> 13:14.020
Okay.

13:14.020 --> 13:15.260
This was for the photos.

13:15.260 --> 13:16.920
Let's see what's the process for videos.

13:16.920 --> 13:19.160
For videos it's simpler.

13:19.980 --> 13:26.420
We just upload the video and we will get the URL from a third party domain.

13:27.800 --> 13:35.000
The URL will contain base line U0026, so we will have to change that for the ampersand sign.

13:36.360 --> 13:39.860
And this URL will be sent in the chat, of course.

13:40.690 --> 13:46.160
Then the attacker, we read the messages of our victim.

13:46.860 --> 13:52.100
As seen here for using our victim stream user ID.

13:52.100 --> 14:06.420
We see the attachment section saying that the attachment is of type video, the URL of the video where we have to copy it and exchange a backslash U0026 for the ampersand sign and that the video is replayable.

14:06.420 --> 14:17.680
So we copy this URL, put the ampersand sign where it's needed, and we will get a video unauthenticated from my desk office.

14:17.680 --> 14:22.280
So this was for videos replayable.

14:22.280 --> 14:35.360
And for videos once only, it will be similar, just that there is an extra parameter saying replay mode view once, duration zero, as seen in the response.

14:35.720 --> 14:39.440
We read it, read our victim's messages as the attacker.

14:39.840 --> 14:51.780
We do the we exchange the swap the U0026 for the ampersand sign and again we get access unauthenticated to the videos that delete themselves.

14:52.880 --> 14:53.920
Okay.

14:54.880 --> 14:59.940
This is before and after the receiver sees the video once.

14:59.940 --> 15:03.780
So this is when you get a video.

15:03.780 --> 15:05.060
It says tap to view.

15:05.060 --> 15:08.240
And after you see the video, it will say video expired.

15:08.240 --> 15:12.160
However, all the videos are public online unauthenticated.

15:13.380 --> 15:13.960
Okay.

15:13.960 --> 15:16.460
Just to do a short recap what happened.

15:16.520 --> 15:20.480
So in 2014, the app launched under the name of Trendr.

15:20.480 --> 15:24.580
In 2024, at the end of the year, we published this.

15:24.580 --> 15:32.260
And this specific vulnerability shows that all photos and videos were available online without authentication.

15:32.480 --> 15:37.220
And on Android Play Store, the app has more than 1 million downloads.

15:37.220 --> 15:39.360
Now all the issues are fixed.

15:39.360 --> 15:39.840
Okay.

15:39.840 --> 15:41.680
Let's continue.

15:42.300 --> 15:46.060
Vulnerability number four, delete, recover and edit other people's messages.

15:46.060 --> 15:51.760
So we discovered that we can recover other people's messages that were deleted in a chat.

15:51.760 --> 15:59.620
In addition, not only you can delete them, but you can edit and recover or delete them.

16:00.100 --> 16:01.820
Let's reproduce the issue.

16:01.820 --> 16:05.260
So the end point will be slash messages slash message ID.

16:05.260 --> 16:07.980
The methods will be delete and put.

16:08.440 --> 16:08.920
Okay.

16:08.920 --> 16:15.200
Let's reproduce the issue, leave a message to someone such as got any plans for tomorrow?

16:15.240 --> 16:19.620
And we will see the message ID will be ending in 880.

16:20.700 --> 16:22.980
We go to the end point.

16:22.980 --> 16:24.380
We delete the message.

16:24.380 --> 16:27.540
So delete method on this message ID, 880.

16:28.000 --> 16:34.100
And it will show 880 got any plans for tomorrow, meaning that it worked.

16:34.200 --> 16:47.880
So now if an attacker, we want to read the messages, this message of our victim, we put the stream user ID of our victim and it will say that the message ID, 880, this message was deleted.

16:47.880 --> 16:51.280
So as expected, the app so far is working okay.

16:51.280 --> 17:05.320
But now if we as an attacker, we apply the same method, delete, on this exact same message ID, 880, we got back the original message, got any plans for tomorrow, just by deleting it one more time.

17:06.380 --> 17:07.140
Okay.

17:07.200 --> 17:10.800
Now let's try to edit someone else's message.

17:10.800 --> 17:12.360
We send the message.

17:12.360 --> 17:14.180
My phone number is 123.

17:14.700 --> 17:19.560
And it will say my phone number is 123 for the message ID, 72.

17:19.980 --> 17:22.380
We read the messages of our victim.

17:23.320 --> 17:26.180
We see this message ID, 72.

17:26.720 --> 17:32.880
The victim will receive a notification from user D, my phone number is 123.

17:33.080 --> 17:46.140
However, if as an attacker, we apply the put method on this message ID, 72, saying my new phone number is 456, so completely something else, then this will be reflected in the response.

17:46.420 --> 17:52.000
And now when the victim clicks on the previous notification, it will see the new message.

17:52.000 --> 17:56.120
My new phone number is 456, saying below edited.

17:56.160 --> 18:03.300
However, the victim cannot know who edited that message, if it was the original sender or someone else.

18:03.300 --> 18:07.080
So it has no knowledge regarding that.

18:07.080 --> 18:09.360
Might have been the original sender.

18:09.840 --> 18:14.380
Okay, vulnerability number 5, update someone else's profile information.

18:14.380 --> 18:19.460
So you can update someone else's profile information including name, sexuality, age, et cetera.

18:19.640 --> 18:24.040
The end point is slash GraphQL with operation name profile update.

18:25.460 --> 18:26.940
Let's try this.

18:26.940 --> 18:30.120
Let's try to update our own profile first.

18:30.120 --> 18:34.700
So we are logged in as profile ID 91F, as shown in this header.

18:34.920 --> 18:48.340
We update our own biography saying ABCD and then in our ID field, we change, we swap our profile ID with that of a random user, 29C.

18:48.340 --> 18:57.320
And we will see in the response saying 200 okay, profile ID 29C, biography has been updated to ABCD.

18:57.320 --> 19:02.220
So that worked without an issue showing another access control missing.

19:02.840 --> 19:08.600
Now another interesting vulnerability is get the like from any profile.

19:09.260 --> 19:16.260
So as details, you could send likes from profile number 2 to profile number 3 while being logged in as profile number 1.

19:16.260 --> 19:21.200
The vulnerable end point is slash GraphQL with operation name profile like.

19:21.200 --> 19:23.120
So let's reproduce the issue.

19:23.120 --> 19:34.660
We are logged in as profile 29C and we send a normal like from user ourself 29C to user our test account 91F.

19:34.660 --> 19:35.820
And it will say sent.

19:35.820 --> 19:38.140
As expected, it worked okay.

19:38.480 --> 19:51.020
However, if we swap to send a like from user 91F to ourselves, it will say you cannot like a profile you own.

19:51.400 --> 19:58.600
So let's try to send from a random user to another random user to see if it works.

19:58.940 --> 20:00.040
And this is what we did.

20:00.040 --> 20:06.680
We are logged in as 29C and we send a like from 63 to 91F and it will say stay to send.

20:06.680 --> 20:10.740
So that worked to control the like.

20:10.740 --> 20:13.860
And now let's investigate who is this user 63.

20:14.980 --> 20:24.220
We make a GraphQL request with the operation name profile query to query this user 63 to see who just liked us.

20:24.240 --> 20:31.600
And what we see is imagine name Annie, gender woman, age 26.

20:31.640 --> 20:39.660
And if we check our mobile app and we go to who liked us, we will see Annie and I blurred Annie's face.

20:39.660 --> 20:43.800
Because I have a premium subscription, I can see who liked me.

20:43.800 --> 20:47.460
So this issue shows another access control missing.

20:47.520 --> 20:51.560
Vulnerability number 7, send messages in other people's chats.

20:51.760 --> 20:55.860
Vulnerable end point slash channel slash messaging slash channel ID slash message.

20:56.600 --> 21:05.080
We read our victim's messages and we find the channel ID ending in 0BD.

21:05.080 --> 21:09.760
We send a message to this end point to this channel ID 0BD.

21:09.760 --> 21:11.360
Hello from the attacker.

21:12.040 --> 21:17.840
And the victim will receive a notification from user B, which is the attacker.

21:18.020 --> 21:22.200
And in this chat is between user D and Bogdan.

21:22.200 --> 21:26.760
And the notification comes from a third party user B.

21:26.760 --> 21:36.780
However, because in the app it allows you to change your name, these are not unique so you can even impersonate one of the counterparts in the chat.

21:36.800 --> 21:40.180
So it worked to send a message in other people's chat.

21:40.540 --> 21:47.280
And the last issue, view other people's messages, end point slash GraphQL, operation name chat list query.

21:48.980 --> 21:54.080
We can query our own matches.

21:54.080 --> 21:59.640
And if we search by imaginary name, we see that we have a total of three matches on our own account.

21:59.640 --> 22:10.380
However, if we swap the profile ID with that of a random user, let's say 91F, and we search by imaginary name, we see that this account has 45 matches.

22:10.480 --> 22:16.180
So this is another access control issue that is an access control that is missing.

22:16.180 --> 22:18.340
Remediation for developers.

22:18.340 --> 22:22.800
Implement authorization checks between users.

22:22.800 --> 22:25.860
This must be on the backend and not frontend.

22:26.000 --> 22:27.640
Implement user levels.

22:27.640 --> 22:31.740
And based on these user levels, implement access controls between them.

22:31.740 --> 22:35.780
For DevSecOps people, integrate CICD tools in the pipeline.

22:35.780 --> 22:47.580
However, for this specific category of issues, it is very difficult to validate which profile ID is valid, which one is not, and is being abused.

22:47.580 --> 22:53.300
So this is very challenging to find such sort of issues.

22:54.000 --> 23:08.420
For CISOs, do data mapping, identify personal data that your organization collects, including where it's located, and introduce measures to protect this data.

23:08.420 --> 23:28.280
For example, Uber was fined for GDPR violation for sending driver's license from EU to US, and TikTok was fined as well for GDPR issues, breaches, for sending European user data to China.

23:29.500 --> 23:38.960
Regarding remediation, we informed the field regarding these issues, and after six months, all the issues have been patched.

23:39.040 --> 23:42.220
And immediately afterwards, the blog was published.

23:43.080 --> 23:48.060
The research is fully available on our blog post.

23:48.180 --> 23:52.980
There has been a Guardian article on this issue as well.

23:52.980 --> 23:55.760
And the slides will be published on our GitHub.

23:56.880 --> 24:01.440
Now a short video in case... okay, it's not available anymore.

24:02.920 --> 24:05.780
And Q&A, if you have any in case there is any.

24:05.780 --> 24:09.320
If not, I will... one minute maximum.

24:09.840 --> 24:10.920
Yes, please.

24:16.120 --> 24:17.960
I cannot hear you, sorry.

24:22.500 --> 24:27.820
That is a very good question, and it is very challenging to do that.

24:27.820 --> 24:32.000
Because, for example, let's take this issue, the other people's matches.

24:32.400 --> 24:39.320
Here is a request to check my own matches, which returns a response.

24:39.320 --> 24:46.080
Then I swap this profile ID, and for a different profile ID, and it returns someone else's matches.

24:46.080 --> 24:52.920
How do you identify in this response what's different from the other response?

24:52.920 --> 24:54.760
Because it returns matches.

24:54.760 --> 25:02.000
So it's... you need someone's intuition to realize that you should not have access to someone else's response.

25:02.000 --> 25:06.940
So at the moment, I'm not aware of such a tool that can make such a comparison.

25:07.200 --> 25:09.780
In case anyone knows, please let me know.

25:09.780 --> 25:11.240
I'd be curious to find out.

