WEBVTT

00:00.000 --> 00:01.540
Good morning, everyone.

00:01.680 --> 00:05.940
Welcome to talk two in the creator stage four.

00:06.320 --> 00:08.660
Apologies to those who are watching online.

00:08.660 --> 00:10.880
We still are having technical difficulties.

00:11.020 --> 00:14.640
And so we only have the slides on the screen.

00:14.640 --> 00:15.960
We are working on it.

00:15.960 --> 00:18.080
Hopefully we'll have it for the next talk.

00:19.220 --> 00:29.460
But I would like to introduce Blackis on his talk from easy wins to epic challenges, the bounty hunter edition.

00:29.480 --> 00:30.420
Everyone involved.

00:37.510 --> 00:39.170
Hey, everyone.

00:39.170 --> 00:45.090
So I present you a bit of my journey in bug bounty.

00:45.090 --> 00:49.410
I tried to select some bugs that were quite surprising.

00:49.410 --> 00:55.190
Surprising in the sense of being very easy or being very difficult.

00:55.190 --> 00:59.470
So I will present a couple of fun bugs.

00:59.470 --> 01:02.070
So a bit about myself.

01:02.070 --> 01:05.470
So I'm doing bug bounty for seven years now.

01:05.470 --> 01:09.470
I did a lot of CTFSO for 15 years or something like that.

01:09.470 --> 01:12.390
And in general, I'm working for 18 years now.

01:12.390 --> 01:15.530
So that's quite a long time I'm doing that.

01:15.990 --> 01:19.730
I'm definitely a web application enjoyer.

01:19.730 --> 01:21.370
I love PHP.

01:21.370 --> 01:22.650
Who doesn't?

01:23.030 --> 01:25.750
And I love doing some source code review.

01:25.770 --> 01:28.570
I'm definitely not a recon guy.

01:28.570 --> 01:32.150
Not doing anything like reconnaissance or something like that.

01:32.150 --> 01:35.410
I'm just going to main apps and break them.

01:35.410 --> 01:37.170
Most of the time, at least.

01:37.550 --> 01:45.270
I really love, like, complex chain, complex exploit or something like that.

01:45.530 --> 01:53.170
And, yeah, in my journey, I did something around, like, $2 million across all platforms.

01:53.570 --> 01:56.550
And I'm also an ambassador for France.

01:56.550 --> 01:57.930
So, yeah, I'm French.

01:57.930 --> 02:00.450
That explains my pretty bad English.

02:00.450 --> 02:01.870
I'm sorry for that.

02:02.190 --> 02:07.090
If something isn't clear, don't hesitate to come later and just ask me.

02:08.190 --> 02:12.990
So we'll begin with first customer, Swisscom.

02:13.010 --> 02:16.470
So I will present a couple of bugs I found on them.

02:18.130 --> 02:22.570
Swisscom is a big provider in Switzerland.

02:22.590 --> 02:23.930
They are doing a lot of things.

02:24.290 --> 02:33.330
They are active in 2016.

02:33.690 --> 02:35.810
That was my first experience.

02:36.310 --> 02:39.910
I started, like, end of 2016 on them.

02:40.670 --> 02:43.130
And that's a pretty good team, to be honest.

02:43.130 --> 02:43.990
They're pretty fair.

02:43.990 --> 02:45.250
They're pretty kind.

02:45.250 --> 02:47.130
Good communication with them.

02:47.470 --> 02:51.950
They have a very big scope, like, millions of IP addresses.

02:51.950 --> 02:53.470
So it's pretty cool.

02:53.690 --> 02:58.270
And I did something around, like, $500,000 on them.

02:58.270 --> 03:00.810
So, yeah, that's quite good.

03:01.170 --> 03:13.650
Definitely the bug bounty, they decided to open definitely improved their security stuff over time.

03:13.750 --> 03:17.650
And, yeah, the bugs I'm presenting now are quite old.

03:17.650 --> 03:23.210
Definitely they're, like, pretty much other stuff now.

03:23.210 --> 03:25.290
But still quite some cool bugs.

03:25.290 --> 03:35.870
So if some people are interested by their bug bounty programs, they're outside of any platform, you can just take a peek of the URL.

03:35.910 --> 03:38.550
Everything is explained there.

03:39.390 --> 03:44.150
So let's talk about first target, which is Swisscom Cockpit.

03:44.150 --> 03:46.870
That's the mobile phone manager in Swisscom.

03:46.870 --> 03:55.590
That's basically where you can see your subscription and where you can just buy some packs for traveling and things like that.

03:56.190 --> 03:59.390
There's locking process on it that is quite particular.

03:59.390 --> 04:03.890
It trusts you sending your phone number and you receive an SMS token.

04:03.890 --> 04:08.650
You need also to fill a capture and you're logged in if the card is valid, right?

04:09.190 --> 04:16.690
So it definitely manage some serious confidential data, a lot of PII payments, things like that.

04:16.810 --> 04:21.850
You can see everything that is related to subscription on there.

04:21.850 --> 04:24.470
So definitely a good target for me.

04:25.350 --> 04:28.290
Also, uh, pretty good stuff for us.

04:28.290 --> 04:33.490
There is a staging instance on the internet that is, like, publicly available.

04:33.750 --> 04:34.530
That was cool.

04:34.530 --> 04:39.950
There might be some, uh, stuff that is not published on the production server and things like that.

04:40.510 --> 04:43.710
So let's talk about the first bug.

04:43.710 --> 04:50.550
Uh, I saw that on the staging instance, the SMS token is always 1, 1, 1, 1.

04:50.550 --> 04:51.790
Pretty good.

04:52.270 --> 04:55.370
Uh, the problem is the staging log in doesn't work.

04:55.370 --> 04:59.730
It always throws some internal server error.

04:59.730 --> 05:02.070
So I can't log in with it.

05:02.210 --> 05:07.570
And I was, like, yeah, maybe that's the SMS repository.

05:07.570 --> 05:11.470
It might be, like, shared with the production system.

05:11.470 --> 05:14.890
So I just try to log in on the production system.

05:14.890 --> 05:17.830
Then try to log in on the staging system.

05:18.570 --> 05:22.630
Then use 1, 1, 1, 1 on production system.

05:22.870 --> 05:24.230
And I was logged in.

05:24.230 --> 05:28.050
So that was a very simple, uh, bug.

05:28.050 --> 05:30.390
But definitely a good impact.

05:30.390 --> 05:32.250
So let's see a demo.

05:32.250 --> 05:36.530
If everything is working well, we should be able to see.

05:36.590 --> 05:37.110
Yeah.

05:37.110 --> 05:39.770
So I'm just entering a phone number.

05:40.690 --> 05:42.830
Just trying to sign in.

05:42.830 --> 05:45.570
Doing the same on the staging instance.

05:48.700 --> 05:53.460
And I'm trying on the prod instance to just input 1, 1, 1, 1.

05:53.460 --> 05:54.920
Filling the capture.

05:56.780 --> 05:57.780
Sign in.

05:57.780 --> 05:59.060
And I'm signed in.

05:59.060 --> 06:00.280
So, yeah.

06:00.280 --> 06:01.460
Pretty easy.

06:01.640 --> 06:06.660
Uh, that's not video of the real system.

06:06.660 --> 06:09.040
I reproduced everything locally.

06:09.040 --> 06:15.680
I will share the demo, uh, the demos video and instances a bit later after the talk.

06:15.820 --> 06:16.880
So, yeah.

06:16.980 --> 06:19.160
This was paid 8,000 dollars.

06:19.160 --> 06:21.680
Which is pretty good because that was super easy.

06:21.680 --> 06:27.800
But that, uh, have a nice impact for them because I have like PII of every customer there.

06:27.800 --> 06:31.580
Uh, maybe millions of PII there.

06:31.580 --> 06:32.260
So, yeah.

06:32.260 --> 06:33.320
Pretty good.

06:34.220 --> 06:36.940
Uh, second bag.

06:37.520 --> 06:42.320
So, as I said, the login process is, uh, pretty easy.

06:42.320 --> 06:44.840
You just input, uh, your phone number.

06:44.840 --> 06:45.920
You submit.

06:46.180 --> 06:51.360
Then, uh, you receive, uh, SMS codes that you need to submit with, uh, capture.

06:51.580 --> 06:56.420
But the process is also setting you, uh, three encrypted cookies.

06:56.420 --> 06:58.840
The first one is a cockpit capture text.

06:58.840 --> 07:04.180
Uh, it definitely by the name, I guess, it definitely manages capture text.

07:04.420 --> 07:10.360
Uh, the cockpit MSISDN key that manage the phone numbers that you input at the first step.

07:10.680 --> 07:17.140
And the cockpit SMS token key which, I guess, is a pin code that was received by SMS.

07:17.140 --> 07:24.180
So, I was like, okay, maybe they are using, like, the same key for encryption.

07:24.180 --> 07:31.760
So, I decided to, like, copy the cockpit SMS token key cookie into the cockpit capture text.

07:31.800 --> 07:33.540
Reload the page.

07:33.540 --> 07:37.340
And the pin code is just leaked into the capture.

07:37.420 --> 07:38.780
So, here it is.

07:38.780 --> 07:44.380
That's not very clear because there's some, uh, maybe, uh, padding issue.

07:44.380 --> 07:49.320
But you can see the code there that is 7998.

07:49.320 --> 08:01.220
So, that's once again an authentication bypass by leaking, uh, the SMS pin token into the capture which is, like, pretty lame but pretty good for me.

08:01.220 --> 08:09.880
So, let's do a small, if I can move that.

08:10.920 --> 08:12.800
Here it is.

08:12.800 --> 08:14.040
Out of the demo.

08:14.880 --> 08:17.080
So, just filling the phone number again.

08:18.880 --> 08:21.420
Trying to see the cookies.

08:22.180 --> 08:26.740
Putting the SMS token key into the capture text cookie.

08:26.740 --> 08:27.920
Just reloading.

08:28.400 --> 08:36.800
And we get the pin code into the capture which is RKB5T.

08:36.800 --> 08:38.840
That's a pin code I received by SMS.

08:38.840 --> 08:42.500
So, I'm once again logged in with that.

08:43.060 --> 08:54.160
So, pretty cool but definitely, uh, not as serious as the previous bug but because it was pretty hard to see, to read the capture.

08:54.160 --> 08:59.180
You can't really automate the attack so they decided to pay $3,000 for that.

08:59.360 --> 09:09.860
Once again, it was quite an easy bug so I can complain, uh, on the amount so I decided it might be the time to stop on cockpits.

09:10.160 --> 09:13.660
But no, here is a, is a cell bug.

09:13.960 --> 09:24.440
Uh, try to log in, input your phone number but at the time you receive the SMS pin code, just cancel and authentication successful.

09:24.460 --> 09:25.720
I have no idea why.

09:26.440 --> 09:31.400
I, I suppose they did something bad by patching, uh, some of my bugs.

09:31.660 --> 09:34.500
Uh, yeah, probably a fail.

09:34.500 --> 09:40.780
So, they decided to pay, uh, $8,000 for that because I just canceled the login process and I was logged in.

09:40.820 --> 09:43.100
Uh, I suppose you don't expect a demo for that.

09:43.100 --> 09:46.260
I mean, that's not really needed, I guess.

09:46.260 --> 09:51.340
So, for this time, let's really move on to another target.

09:51.940 --> 09:59.420
So, uh, Swisscom WorkLink, uh, is a Swisscom acquisition that was like a company that just bought.

09:59.420 --> 10:01.500
I decided to have a check.

10:01.500 --> 10:10.620
They were using, uh, completely unknown CMS called weblication, something in PHP, you know, that trigger me always.

10:10.620 --> 10:23.640
Uh, so I decided to, uh, buy a weblication license, uh, so I can grab the code and turn that into, like, some source code review.

10:24.500 --> 10:29.040
Uh, firstly, I saw that the thing is not using SQL at all.

10:29.040 --> 10:37.320
Uh, it's only some, uh, XML databases and some, uh, file system storage, which is quite not so usual.

10:37.700 --> 10:52.160
So, firstly, I saw that, uh, they have a general pass traversal prevention mechanism and in general, uh, they're trying, like, to sanitize every, uh, every variables that you can input.

10:52.960 --> 11:02.540
There is an easy bypass because they are, like, uh, trying to remove, uh, pass traversal characters and later in the process, they're trying to remove pipes.

11:02.540 --> 11:11.200
So, you can just, like, uh, use, uh, dot pipe dot pipe slash and it will be transformed to pipe, uh, to dot dot slash.

11:11.200 --> 11:16.340
So, there is, like, an easy bypass of the, uh, mechanism to prevent pass traversal.

11:16.340 --> 11:19.920
So, I decided to have a look for some pass traversal issues.

11:20.620 --> 11:36.780
Uh, I found pretty easily, uh, vulnerabilities that allow me to delete all the files, uh, in a directory, but, uh, it wasn't, uh, reachable because it checked for a specific directory on the app that was never used anywhere.

11:36.780 --> 11:52.900
So, there is no way to create that, uh, I found, uh, an arbitrary directory creation, which is generally something that is quite useless, but for that case, it was quite useful for me.

11:52.900 --> 11:58.960
So, I created the directory that was needed, uh, to reach the directory empty vulnerability.

11:59.140 --> 12:00.780
Uh, so, cool.

12:00.780 --> 12:06.440
I can delete files in directories, uh, but, come on, that's not useful.

12:06.440 --> 12:11.740
I'm definitely not wanting to deface their website, that's definitely not the goal.

12:12.340 --> 12:33.280
So, uh, I did, I, I had a check, and, uh, in the weblications, slash, uh, five directories, there is a .htaccess file, that's the only file there, but in the subdirectories, there is like all the databases, uh, all the XML databases there.

12:33.380 --> 12:46.560
Uh, the only, uh, mechanism of protection there is a .htaccess file, so maybe we can just remove the .htaccess file, so we can access the XML databases then.

12:46.760 --> 13:09.440
For some reason, I don't know why, but I decided that to, uh, name all the XML databases with a .php extension, that's quite a strange, uh, decision, but I found that, uh, the logs, uh, the login logs, uh, that, uh, database is containing, uh, the session token for all users there,

13:09.440 --> 13:15.620
so I can just read it, that's an authentication bypass, that's a win.

13:15.640 --> 13:19.700
No, it works locally, it doesn't work remotely.

13:19.700 --> 13:26.200
I have like, uh, internal server error everywhere, so I was quite in despair, I was crying a bit.

13:26.820 --> 13:51.280
Um, so my guess was, uh, my, uh, so WorkLink was using, uh, PHP short tags, so, uh, it clashed with, uh, XML open tags, so the, the system was, uh, thinking that the XML file was some PHP, it broke because of some syntax error, and so just through internal server error,

13:51.280 --> 13:53.560
so, definitely didn't work.

13:53.560 --> 13:58.840
I decided to go and say, search, uh, other vulnerabilities.

13:58.860 --> 14:06.780
I found a pre-auth FC there, but it failed again for the exact same reason, so I cried a bit again.

14:07.160 --> 14:14.920
And I found something that was maybe interesting, but quite lame, I didn't see the impact at first.

14:14.920 --> 14:18.660
I found an XML injection in the log user database.

14:19.040 --> 14:26.020
Uh, so, pretty much the same, it's also, uh, PHP extension, uh, in the same directories.

14:26.140 --> 14:46.440
So, uh, the, the injection is on the user name, and that's like the database that contains, uh, if a user name is, uh, blocked by the system, so if you're trying to log in, uh, with a specific user name more than three times, and the login is failed, you're like injected in that,

14:46.440 --> 14:47.940
uh, specific database.

14:47.940 --> 14:50.740
So, there is a XML injection there.

14:50.740 --> 14:51.560
Okay.

14:51.840 --> 14:56.460
Not so useful, I can block up entire users maybe, but, yeah, quite lame.

14:56.960 --> 15:08.900
So, I did have a check on how, uh, the XML database are passed by the application, uh, I saw that, uh, the developers, uh, did that quite well.

15:08.900 --> 15:18.720
They decided to add some layers of protection, uh, trying to prevent, uh, X include by calling dumb document, uh, X include function with a false parameter.

15:19.200 --> 15:27.500
No luck for them, uh, thanks PHP, uh, it enabled X include instead, so definitely not what they wanted.

15:27.740 --> 15:41.360
Uh, so for those that don't know, X include is, uh, XML features that allow to include other XML or even not XML documents into the current one, so it's like, exactly like PHP include, but for XML.

15:44.100 --> 15:59.000
So, trying to put, uh, that username will definitely, uh, add a X include directive that will load, uh, the login logs database into the, uh, blocked users database.

15:59.060 --> 16:16.220
Uh, that's, that's a notation for X include directive, uh, that's a bit complicated, but, yeah, definitely the impact there is, like, we can just include the entire, uh, login logs database into the blocked user database.

16:16.500 --> 16:23.160
But, uh, yeah, X include is doing their best to, like, reformat all the file to be a fully valid XML.

16:23.160 --> 16:32.680
You can break, you can't really break, uh, the file by using X include, which is quite good, it's doing, like, automatic correction and things like that.

16:33.260 --> 16:40.640
But, no, that's still useless, I mean, yeah, I can include the database into another, but that's quite useless.

16:41.940 --> 16:57.460
But, I tried to see how the log users feature is working and I found a blind X pass injection, so, in the username is you, if you can, if you inject, uh, some X pass, uh, notation, you have, uh, an injection there.

16:57.760 --> 17:05.960
So, you can definitely extract the entire log, uh, log database and I guess you see, uh, what's the interest there.

17:05.960 --> 17:15.920
We can, uh, inject, uh, the content of, of the database, uh, in, in the log database and then we can, like, exfiltrate it.

17:15.920 --> 17:21.540
So, the log database, uh, yes, I, I, I, I would say that.

17:21.540 --> 17:30.480
But, uh, so we can choose a, a blind X pass injection, we can exfiltrate session token byte by a byte per bytes.

17:31.100 --> 17:39.800
That gave me, I mean, take around the application and that time in the admin panel there is, like, feature to get RC.

17:39.800 --> 17:41.940
So, this time is a win.

17:42.000 --> 17:43.460
It works remotely.

17:43.680 --> 17:54.100
So, the chain was log user with, uh, XM injection in the username with X include directive pointing to the XM logs.

17:55.260 --> 18:03.500
Exfiltrate it with X pass injection, get admin session, get RC and let, let's go for a demo .

18:09.210 --> 18:14.190
So, we can see there on the right that the blog database is empty.

18:16.030 --> 18:26.910
Now we try to log in with X, uh, to see that just the blog database is now filled with, uh, one entry for the X, uh, user.

18:26.910 --> 18:32.190
We now try to inject some XML to see if there is a XM injection there.

18:34.390 --> 18:35.990
And yes, it is.

18:35.990 --> 18:42.350
There is now a FUBAR attribute, uh, in the, in the block, uh, block entry.

18:42.930 --> 18:55.430
So, that time we're using the payloads that, uh, we saw before with the X include directive trying to include, uh,

18:58.590 --> 18:59.110
the login log.

18:59.110 --> 19:04.070
So, yeah, I just saw that the login log contains some, uh, session stuff there.

19:04.250 --> 19:08.430
So, we make that user with the payload to be blocked.

19:09.930 --> 19:16.170
We can see that to X include directive is now there in the file of the blocked, uh, database.

19:16.190 --> 19:20.350
We make, uh, another user, another random user to be blocked.

19:20.350 --> 19:28.910
So, the file will be passed again and this time there is like the entire login log database in that block database.

19:28.910 --> 19:36.510
So, this time it was completely replaced, uh, by the, by the original login logs file.

19:36.510 --> 19:39.970
So, now we can try to use, uh, the X pass injection.

19:39.970 --> 19:45.750
So, we are like targeting, uh, a log element, trying to infiltrate the session.

19:45.750 --> 19:49.210
We check here, we're checking if it begins by a L.

19:49.210 --> 19:52.950
We know it is because we can see that on the right screen.

19:53.090 --> 19:59.570
So, if it begins by a L, we should receive that the account is blocked.

19:59.570 --> 20:05.390
But if we check, uh, if it begins by X, we receive that no user is found.

20:05.390 --> 20:09.330
So, we have an hour to leak, uh, the characters one by one.

20:09.330 --> 20:11.470
So, I write a little script.

20:12.990 --> 20:17.410
And yeah, it definitely leaks the session token character by character.

20:17.410 --> 20:24.490
So, yeah, we got, we got an admin account to that and get RC remotely.

20:24.510 --> 20:29.150
For that, uh, Swisscom decided to pay me $3,000.

20:29.550 --> 20:38.690
So, uh, $2,500 for the bag, uh, $500 for the, um, for, uh, bonus for the nice shell.

20:38.690 --> 20:45.470
And also the editor decided to, uh, reward me for, with, uh, $2,000.

20:45.830 --> 20:49.730
They didn't have the bag money, but they were like impressed by the bag.

20:49.730 --> 20:52.190
So, pretty cool for the, for, from them.

20:52.970 --> 21:01.270
So, now let's switch to yet another customer, uh, another Swiss one, uh, so Swiss Post.

21:01.310 --> 21:21.230
I'm not sure I need to explain what is Swiss Post, but it's about, they are like the postal office in Switzerland, but they are also a private company, uh, doing a lot of different things and they are like involved in a lot of, uh, major projects in Switzerland like e-voting.

21:21.230 --> 21:24.950
Uh, they decide, uh, they, they are also very active in cyber security.

21:24.950 --> 21:30.310
They like about a lot of local, uh, cyber security, security companies.

21:30.350 --> 21:36.330
So, so they are like very active in the cyber security, uh, stuff in Switzerland.

21:36.630 --> 21:47.850
They decided to start, uh, bag bounty in 2019, uh, especially for their e-voting platform, uh, and they decided to add, uh, assets, uh, over time.

21:47.850 --> 21:54.890
So, uh, they are pretty good, pretty much the same as Swisscom to be honest.

21:55.110 --> 21:59.670
Uh, we can have a lot of, uh, communication with them, they are pretty good.

21:59.930 --> 22:13.570
And yeah, if some people are from the voting village, uh, go on their bag bounty programs, they are paying like, uh, 230K for a very critical bag there, that's definitely a good program.

22:13.690 --> 22:17.470
I'm not a crypto guy, so I'm not going back, maybe you are.

22:18.210 --> 22:26.170
So, if you want to have a check, uh, everything is described on their VDP page, so vdp.post.ch.

22:27.770 --> 22:47.910
So, uh, for, for the first bag, I will talk about their, uh, payment system, so they are like their own payment system, uh, completely custom, uh, everything is quite common, you get some sign requests, uh, there's a lot of different endpoints for failure and success,

22:47.910 --> 22:58.530
and, uh, also you can stack money on your account, on your postal account, you have a balance system, so it's always interesting if we can get, like, infinite money there.

22:58.970 --> 23:04.990
I will switch this bag because we have some time issue, let's go on the second one.

23:04.990 --> 23:26.950
So, I did find a lot of, uh, stuff there, so I was, uh, hacking on them, and I was trying to manipulate some payment session there, uh, changing price in a transaction, uh, a lot of things, but, uh, a delivery man rang the doorbell in my office, so I need to get the package,

23:26.950 --> 23:43.230
seeing everything, I decided that was the time for a coffee break, and then after maybe 10, 15 minutes, I don't know, got back to my chair, and I had some money coming from nowhere on my account, so I had no idea why.

23:44.110 --> 23:58.130
So, I decided to replay everything I did, I was like, probably I triggered something, and I didn't even know, so I tried to replay everything, so, that failed.

23:58.370 --> 24:00.050
No idea what happened.

24:00.170 --> 24:14.170
So, I did to replay everything, including the coffee break, that was maybe the main point, so I did a coffee break with a colleague, and there was my account was affected again.

24:14.550 --> 24:35.050
So, I was like, okay, what's the fact, I tested a lot of things, and the real explanation is, uh, when you run the transaction, after the transaction is timed out, so you didn't, uh, make the payment, uh, in the good time frame, it's just considered successful,

24:35.050 --> 24:44.470
so probably a bad check of payment states, it default to success instead of defaulting to, uh, a failure, so, yeah.

24:44.610 --> 24:47.290
Let's go for a demo.

24:49.410 --> 24:53.470
So, let's buy a very good croissant, because I'm French.

24:56.430 --> 24:58.210
Oh, that's not a good demo.

24:58.490 --> 25:00.910
I want a croissant, a bigger one.

25:01.490 --> 25:02.790
Let's go for it.

25:03.390 --> 25:04.170
Just wait.

25:04.170 --> 25:06.010
Just go grab a coffee, maybe.

25:09.600 --> 25:11.380
Are you patient enough?

25:12.400 --> 25:13.180
Oh, yeah.

25:15.360 --> 25:17.680
No, joking, it will just last.

25:17.680 --> 25:20.480
Yeah, success payments, just by waiting.

25:22.240 --> 25:27.280
I'm in pretty good solution to get some money, right?

25:27.620 --> 25:34.880
So, I was paid, uh, $3,000 for that, uh, that's probably the most I get for, like, a coffee break or two.

25:34.880 --> 25:38.800
Definitely was quite profitable, right?

25:39.780 --> 25:43.420
So, let's go to another project of them.

25:43.420 --> 25:50.320
Uh, they have, like, a subdomain, uh, using, uh, very, very unknown, uh, CMS.

25:50.600 --> 25:54.280
So, Peppershop, that's like a Swiss page PCMS.

25:54.280 --> 25:57.040
They also do some manager thing and things like that.

25:57.040 --> 25:58.840
I never heard of them.

25:58.840 --> 26:06.400
So, I decided, once again, to buy a license, uh, of the CMS, so I get access to the code.

26:06.400 --> 26:10.200
Once again, it's PHP, so I'm super interested by that.

26:11.060 --> 26:18.960
And I just had a look at the code, everything was quite, you know, PHP.

26:19.420 --> 26:26.260
Uh, so I saw that, uh, an admin feature, uh, that is quite interesting is a restart backup thing.

26:26.380 --> 26:31.420
Uh, it's some, like, custom things.

26:31.420 --> 26:36.580
They decided that the delimiter between SQL queries will be that stuff.

26:36.580 --> 26:37.820
No idea why.

26:37.820 --> 26:41.520
Why don't use, like, semicolon like everyone do?

26:41.520 --> 26:42.360
I don't know.

26:42.360 --> 26:43.940
They decided it is.

26:44.260 --> 26:54.800
And they also have, uh, some features I never, I don't know why, because I didn't see any occurrences where they are using that, but they do.

26:54.800 --> 27:08.400
So, if you use, uh, the base64 start and the base64 end tags, that will be replaced by a single coded string of, uh, the base64 decoded string that is between the tag.

27:09.000 --> 27:10.280
I don't know why.

27:10.280 --> 27:13.780
I, I, that's quite a strange feature to be honest.

27:14.340 --> 27:30.780
So, uh, the restart backup, uh, the restart, uh, feature is using, uh, backup from a local file system, uh, that needs to be generated from the CMS backup feature, so, uh, you can't upload anything or something like that.

27:31.360 --> 27:46.620
So, my goal was, maybe I can inject SQL queries in backup from the frontend, uh, the method is exploiting the very, like, strange passing to break SQL contexts.

27:47.560 --> 28:09.860
So, my idea is, uh, if I use, like, so specific, uh, separator or, uh, like, tags in some data, uh, that is stored in the database, uh, so, uh, that will be stored in the database, uh, maybe when they will backup and restart again, that will break something if I get some data with those tags,

28:09.860 --> 28:16.460
uh, maybe on my profile, on my, I don't know, username, name, other comments, uh, things like that.

28:16.820 --> 28:21.680
The first problem is, uh, most fields are sanitized by default.

28:21.680 --> 28:28.560
That's like a global sanitize, uh, sanitization that is done on every field.

28:28.560 --> 28:35.200
Um, so, no, no new lines, no hash, no special characters in general.

28:35.800 --> 28:47.060
Uh, the second problem is that if the restore fail on one SQL query, it's like ending the process and not going further in the file.

28:48.180 --> 28:52.960
I mean, for the first problem, the solution is quite easy.

28:53.020 --> 28:56.500
Most, uh, fields are sanitized but not all.

28:56.500 --> 28:58.100
They are like exception.

28:58.240 --> 29:02.280
One of them are like, uh, comments that are put on the other.

29:02.280 --> 29:07.160
So, I can definitely reach that field, uh, on the front end.

29:07.320 --> 29:15.320
And the second, uh, problem, we have like a separate between queries and way to inject single code.

29:15.320 --> 29:22.320
So, that should be possible, uh, to get like a valid file after injecting things.

29:23.140 --> 29:30.820
So, let's imagine, uh, uh, a valid SQL query in the file formats.

29:30.960 --> 29:34.720
So, we control fully the values of Bimmerkugen.

29:34.720 --> 29:39.120
I have no idea what it means but that's the name of the database, of the, uh, table.

29:39.120 --> 29:40.860
I have no idea what it is.

29:41.240 --> 29:46.380
So, we can control that fully and you can see the separator at the end.

29:46.380 --> 29:51.840
So, we're trying to use their base 64 feature to break from single codes.

29:51.840 --> 29:55.760
So, we're trying to get something like that.

29:55.880 --> 29:59.040
That will be transformed to that.

29:59.040 --> 30:07.540
So, we inject a single code, a parenthesis, a comment and that is working pretty well to be honest.

30:07.940 --> 30:13.000
So, then my goal is to inject new queries in the packet file.

30:13.320 --> 30:22.240
So, this time I'm also adding, uh, a separator and a new, uh, query with a comment at the end.

30:22.280 --> 30:28.500
So, after being, uh, uh, passed by the restore procedures that will give that.

30:28.500 --> 30:30.640
And that's definitely valid.

30:30.640 --> 30:41.280
So, I was able to, uh, just inject, uh, an update to, uh, an arbitrary table, changing arbitrary column there.

30:41.280 --> 30:42.820
Pretty good.

30:43.260 --> 30:50.620
Um, so, the impact is I can run arbitrary queries on the restore process.

30:50.620 --> 30:55.460
If they take a backup and restore, that will run my queries.

30:55.700 --> 30:57.020
Pretty good.

30:57.020 --> 31:09.340
But, uh, the database is obviously that PHP, uh, storing some serialized, uh, PHP objects because, you know, relational databases is done for that.

31:09.340 --> 31:11.340
Storing full objects.

31:11.840 --> 31:18.060
So, I found, uh, pretty fastly a custom gadget, uh, that allow to delete local files.

31:18.400 --> 31:26.820
Once again, not the most interesting primitive for us because that's definitely not a goal to delete, uh, files on them.

31:26.960 --> 31:33.820
But I saw that, uh, the admin authentication mechanism is just, uh, dot access file.

31:33.820 --> 31:45.120
So, if we delete the dot access file, uh, everyone can go to slash admin and, uh, I mean, just that.

31:45.120 --> 31:46.880
There is no authentication besides that.

31:46.880 --> 31:52.240
Such as, like, you need, as a valid credential or you need to pipe as a dot access.

31:52.760 --> 31:56.640
The payload is too big for the screen, I'm sorry.

31:57.060 --> 32:00.260
So, let's get a demo for this one.

32:02.200 --> 32:04.300
Once again, super classic.

32:04.300 --> 32:05.380
So, the payload is in shop.

32:07.740 --> 32:12.240
So, we put the payload, uh, in the other commands.

32:15.080 --> 32:16.760
You can see the payload there.

32:16.760 --> 32:18.020
It's pretty big.

32:18.020 --> 32:27.080
It's just, uh, trying to update the other table and set, uh, a big, uh, serialized, uh, object in the data of the others.

32:28.520 --> 32:39.240
So, now, my user have, uh, like another ways, uh, or, uh, or tags, uh, or by basics for tags.

32:39.240 --> 32:42.180
So, let's go to an administrator account.

32:42.180 --> 32:44.040
Let's do a backup.

32:46.420 --> 32:48.140
Yeah, that's a fail.

32:50.100 --> 32:51.700
Let's go to the backup.

32:51.720 --> 32:52.960
Let's log in.

32:56.800 --> 33:01.180
So, let's do a backup and now trying to restore it.

33:01.380 --> 33:10.540
Not, not, before restoring it, we can see in the other that, uh, we have, like, or data that is injected, uh, in the other.

33:10.540 --> 33:12.200
So, now, trying to restore.

33:12.200 --> 33:14.200
That's definitely not the same data.

33:14.200 --> 33:20.120
We were able to update the other and add, like, a serialized object.

33:20.120 --> 33:32.860
So, let's go see the others that triggered, uh, the serialized objects and now we can go to the admin panel and there's no more authentication on it.

33:32.860 --> 33:49.040
So, yeah, that definitely deleted, uh, the htaccess so everyone is admin which is, uh, to be honest a bit, uh, frightening because, like, by exporting that I gave everyone admin access.

33:49.040 --> 33:49.840
Oops.

33:50.480 --> 34:13.780
So, they pay me, uh, six and, six hundred fifty dollars which is quite bad but, uh, the real, uh, thing is that Swiss Post is not using the backup and restore feature because they have too much data and the official backup feature there is just crashing because there is too much data.

34:13.840 --> 34:18.140
You know, like, problem of memory issues and things like that.

34:18.140 --> 34:25.600
So, that's even fair they decided to pay a bounty for that because they are, like, no chance they are using the backup and restore feature.

34:25.600 --> 34:28.380
So, yeah, still quite firm.

34:29.740 --> 34:36.060
Let's go on another customer, the most known one, redacted.

34:36.280 --> 34:46.340
Uh, I wasn't able to name them so let's consider that, uh, we just put a bit of context.

34:46.340 --> 35:02.820
Imagine a PHP CMS, once again PHP, widely used, uh, with a lot of complex code, complex features, and a little blacklist criticizing the code at every release, every time.

35:03.760 --> 35:15.580
So, first bag, there is a new CV there, uh, that's a Prius SE to a SSTI in the wild, like used by a threat actor.

35:15.580 --> 35:20.300
So, the maintainers decided to make an emergency patch.

35:20.780 --> 35:24.280
I decided to reverse it, obviously.

35:24.520 --> 35:29.960
Uh, so, uh, there is like a double level of templating, uh, on the app.

35:30.320 --> 35:41.100
And the patch from, uh, the maintainers were just a plain replace to, uh, remove, uh, the tags just after a single evaluation of the templates.

35:41.300 --> 35:46.580
Uh, the problem is, maybe someone saw that?

35:48.140 --> 35:49.600
You saw that?

35:49.600 --> 35:50.520
I know.

35:50.600 --> 35:53.080
The regex is not matching new lines.

35:53.320 --> 36:05.120
Uh, that means that you can just use the original payload, but use a new line before the closing tags, you're bypassing that regex, and that's like a Prius SE again.

36:05.960 --> 36:20.240
That was paid, uh, ten thousand dollars, because, you know, Prius SE are always cool, and small bonus, my colleague, uh, also found another bypass, you just had to not close the tags.

36:20.240 --> 36:29.300
So, that was enough, uh, templates, uh, will contain some tags, ending tags later, so, yeah, that's also bypass it.

36:30.340 --> 36:43.860
So, as a second bag, and I'm sorry, this one will be quite complex, I will try my best to explain it, uh, correctly, but, yeah, that's a complex one.

36:43.860 --> 36:53.080
So, I found a bag, uh, that is, to be honest, barely exportable, but it's super fun technically.

36:54.060 --> 37:05.380
So, the worst impact, uh, to use was, uh, Prius SE, but, uh, the precondition of it make it quite unlikely, but, yeah, it's still a fun one.

37:05.880 --> 37:17.840
So, for the context, uh, that application, uh, was using Laminas PHP library to, for everything that is using, like, emails.

37:18.440 --> 37:37.000
Laminas is doing a lot of checks and transformation to be sure that the email is valid and things like that, there's like a lot of different label, uh, libraries there, and on the application we're testing, uh, we have, uh, control over, uh, from header that will be,

37:37.000 --> 37:39.980
uh, used for sending some emails.

37:40.520 --> 37:57.360
So, that parameter will be passed, uh, over the fifth argument of mail, for those who know, uh, mail function, uh, of a fifth argument that is, like, arguments that will be passed to the send mail, uh, binary.

37:57.840 --> 38:06.680
So, if that fifth argument is, uh, completely controlled by an attacker, you can have, like, argument injection to the send mail binary.

38:07.200 --> 38:14.020
There are, like, no next point to that, uh, but it definitely depends on the MTA that is used.

38:14.060 --> 38:19.920
So, uh, every MTA is chipped with different send mail binaries.

38:19.920 --> 38:26.160
So, for this, uh, talk, we will consider, uh, send mail MTA here.

38:26.160 --> 38:27.960
That's like a first condition.

38:27.960 --> 38:29.140
Why send mail?

38:29.140 --> 38:30.800
Because I'm cheating.

38:30.800 --> 38:31.820
That's my bug.

38:31.820 --> 38:35.700
I decide to whatever is the condition.

38:35.700 --> 38:39.900
So, that's what, uh, I want to be.

38:40.900 --> 38:46.480
So, uh, the problem is Laminas validating email address.

38:46.480 --> 38:51.540
We can't, like, put anything that is not a valid email address.

38:51.540 --> 38:58.800
Uh, Laminas is supporting, uh, cutted string, uh, format, so, uh, double quotes and pretty much anything.

38:58.820 --> 39:03.440
Uh, dot atom format, that's like the standard, uh, email formats.

39:03.740 --> 39:06.680
Uh, for that, they are using super big regrets.

39:06.720 --> 39:09.340
Uh, that was super hard to read.

39:10.820 --> 39:23.480
And, yeah, the thing is, uh, they're also using, uh, escape shell lag, uh, on the email before being used on the, uh, main function.

39:24.180 --> 39:36.460
But, uh, PHP is automatically applies escape shell command to the entire command, uh, when calling mail, uh, that will apply escape shell command to send mail.

39:36.720 --> 39:42.840
Uh, double escape means, uh, no escape at all, means argument injection, thanks PHP.

39:44.560 --> 40:04.220
So, another problem is, uh, Laminas or the application, I don't know, is, uh, lower casing your email and every exploit for, uh, send mail, uh, generally using, uh, the C and the X uppercase arguments with very long pass.

40:04.780 --> 40:20.280
And the, the problem is we are limited to 64 characters for the local parts and definitely if you need, like, long pass, uh, for two arguments, that's definitely not cool because we are, like, limited in size.

40:21.000 --> 40:21.760
Painful.

40:21.760 --> 40:24.100
I was, like, a bit in despair.

40:24.100 --> 40:27.880
I was pretty sure that won't be exploitable at all.

40:27.920 --> 40:33.760
But, yeah, I still decided to make, like, cause of testing.

40:33.780 --> 40:36.980
I was pretty much like that after a few hours.

40:37.360 --> 40:46.440
But, at some point, I saw that, uh, there was, like, a stranger if my email contains, uh, uh, right angle brackets.

40:47.180 --> 40:56.420
So, if I put XSX, uh, right angle bracket at black dot is, I received by the app invalid domain black dot is right bracket.

40:56.420 --> 40:58.320
I was, like, that's, that's strange.

40:58.320 --> 41:01.140
That's definitely not the domain I put in my mail.

41:01.680 --> 41:05.060
So, I decided to debug a bit the behavior.

41:05.060 --> 41:08.900
So, Laminas, uh, did, uh, the validation of the email.

41:08.900 --> 41:17.680
Laminas and the app, uh, were crafting a full email with the headers and the body and put the email in the form, uh, header.

41:18.420 --> 41:22.500
Then, uh, Laminas passed the generated email.

41:22.500 --> 41:26.400
Then, the app is extracting the sender again from it.

41:26.700 --> 41:30.820
Validates that it's still a valid email.

41:30.920 --> 41:33.300
So, painful process.

41:33.740 --> 41:36.880
So, I was like, okay, but that doesn't explain the error.

41:36.880 --> 41:40.800
So, that's a traditional form header.

41:40.800 --> 41:47.780
So, it's just, uh, double quotes your name, double quotes and in brackets , uh, the full email.

41:47.780 --> 41:55.800
But, when I tried to inject XSX right brackets at black dot S, that was like the form that was generated.

41:55.800 --> 42:04.120
So, we have like an injection in the email part, but that's quite useless in my opinion.

42:04.600 --> 42:10.960
Uh, there was like no CRLs, there was like protection and mechanism to prevent that.

42:10.960 --> 42:13.480
So, I was like, okay, that's definitely useless.

42:13.480 --> 42:19.840
But, I decided to like investigate because that's quite a dirty thing still.

42:19.840 --> 42:20.940
So, yeah.

42:21.780 --> 42:30.500
Uh, we received, uh, a lot of RFC, a lot of documentation and I saw there's like something called, uh, my man coded words.

42:31.040 --> 42:36.420
So, uh, that's described by the, uh, the RFC 2047.

42:36.580 --> 42:42.520
That's for using special characters in, uh, email headers and body.

42:43.400 --> 42:52.280
That's a format, so, uh, it was seen, uh,

42:56.780 --> 43:01.820
so, in that case, I'd like generate AAA.

43:02.740 --> 43:12.980
So, all the characters that is used, uh, in the mime uncoded words notation are also valid characters in an email address.

43:12.980 --> 43:17.740
At least, uh, in the double, uh, double code encoded formats.

43:18.180 --> 43:24.780
So, I was like, maybe I can inject mime uncoded words in my, uh, sender email.

43:25.140 --> 43:41.340
So, uh, that will be put in the mail headers and when extracting back by Laminas, it will like pass the mime uncoded words and generate an email that will maybe contain, uh, some, uh, parameter injection to send mail.

43:41.920 --> 43:49.360
So, uh, I needed, uh, some spaces to like inject another argument to send mail.

43:49.740 --> 43:59.960
Uh, but, uh, equal, uh, equal 20 is forbidden by the specification of the AFC, but I found that, uh, underscore is defined as a space by the AFC.

43:59.960 --> 44:05.520
So, we can, uh, just input, uh, spaces by using an underscore.

44:05.520 --> 44:09.040
Don't ask me why, there's probably a reason for that.

44:09.520 --> 44:20.480
So, as we saw, uh, the send mail, uh, send mail payload is always, uh, needing to point to a local configuration file.

44:20.480 --> 44:26.040
So, we need to have, uh, a control of a malicious local file.

44:26.220 --> 44:29.960
Fortunately for us, the CMS have, uh, a nice file upload.

44:29.960 --> 44:31.480
So, we can upload files there.

44:31.480 --> 44:44.220
The problem is, uh, the upload file that contains underscore, but underscore replaced by spaces, but we can replace, uh, underscore by, uh, equal five F characters.

44:44.220 --> 44:47.700
So, that's a problem, but not so much.

44:47.700 --> 45:01.180
The problem is, uh, we need a lot of replacement character and the size limitation is still 64 characters and the mime encoded routes, uh, increase the size of a string by quite a lot.

45:01.180 --> 45:07.560
So, let's consider that, uh, a web route is, uh, slash app.

45:07.560 --> 45:08.560
That's short .

45:08.560 --> 45:10.180
That's definitely what I need.

45:10.180 --> 45:13.880
So, I'm still, uh, cheating again.

45:13.880 --> 45:16.300
So, uh, that's another preconditions.

45:16.300 --> 45:23.600
The first one is you need send mail to be used and you need, uh, a short , uh, web route.

45:23.600 --> 45:26.880
So, yeah, that's quite some strong precondition.

45:27.740 --> 45:35.600
So, I knew that send mail payload that I am using, uh, the C and the X, uh, arguments.

45:35.600 --> 45:38.020
That's definitely too long for us.

45:38.060 --> 45:44.080
So, I was like, okay, uh, the C arguments is, uh, loading arbitrary config file.

45:44.940 --> 45:46.900
Maybe that's enough to see.

45:46.900 --> 45:49.660
Maybe we don't need, uh, uh, X arguments.

45:49.660 --> 45:54.980
So, I decided to focus on that and see what is possible to, uh, send a config file.

45:55.600 --> 46:00.160
So, in the config file you have, like, the path to the dead letter file.

46:00.160 --> 46:06.820
So, the dead letter is like where it, with, it will log, uh, like, incidents in sending emails.

46:06.860 --> 46:18.540
So, maybe we can, like, uh, that's, uh, a file that will be in the web routes and I have maybe a file right but we don't control anything in the mail.

46:18.940 --> 46:36.420
And there is also, uh, uh, bound second recipient in that config file that will be included in the dead letter because that will, like, you have an email that is failed but then it will try to send to that second recipient and it will write that in the dead letter file.

46:36.420 --> 46:52.980
So, maybe we can have arbitrary file rights or at least, uh, partial arbitrary file right but that's PHP so if I have just, uh, a partial file right that would be enough to get a valid PHP file.

46:53.520 --> 47:05.620
So, I just sent, uh, a default send mail MTA config and, uh, the two, uh, option, uh, to get arbitrary file right and that's, that was sufficient.

47:05.620 --> 47:10.180
So, then I'm sending the mail to not existent at localhost so it fails.

47:10.280 --> 47:12.140
So, that will bounce.

47:12.220 --> 47:16.080
So, that, uh, the, the, the config that I was using.

47:18.020 --> 47:25.560
So, I decided to have a look at the MyMainCodedWord and trying to, like, reduce the size of it.

47:26.060 --> 47:31.560
Uh, I was able to win some size like you can just empty the car sets.

47:31.560 --> 47:33.920
There is no need of, uh, filling it.

47:34.540 --> 47:45.600
Uh, don't, uh, we get, we need double cuts around the payloads because, uh, the email need to be valid and you need to use a double coded, uh, format.

47:45.600 --> 47:51.200
Don't ask me why but we need, we needed to end it with, uh, two double cuts.

47:51.200 --> 47:52.760
I have no idea that's magic.

47:52.760 --> 47:55.420
I didn't investigate it that.

47:55.840 --> 48:01.220
So, we can definitely use the uppercase later now because we have the MyMainCodedWords.

48:01.420 --> 48:17.320
Uh, so, 64 cards is still too short but with the precondition of having a short web root and everything that just enter exactly, uh, the, the 64 characters.

48:17.320 --> 48:24.460
So, it's, uh, upper class and the final payload was just that.

48:24.860 --> 48:29.920
Don't ask me why that's a magic, uh, definitely some magic payload.

48:29.920 --> 48:35.940
I have now a t-shirt but it's my, in my hotel room with a payload printed on it.

48:36.000 --> 48:44.680
Uh, yeah, that's quite a unisex payload and it is to Prius SE on the top in very specific conditions.

48:44.680 --> 49:06.800
So, yeah, that was just, uh, settings, uh, if I re-uploaded in to send my command injecting a new, uh, config file for send mail, get arbitrary rights, some PHP in the web app, get RCE, works only on send mail MTA, web root being short so I cheated a bit.

49:07.040 --> 49:10.620
But, yeah, you need some Einstein's to explain that.

49:10.620 --> 49:15.800
So, definitely not, uh, not really a spot up in the right but still was quite fun technically.

49:16.400 --> 49:19.480
So, let's go for a demo.

49:19.620 --> 49:21.240
The last one.

49:22.700 --> 49:25.900
Uh, so, uh, once again, the question shop.

49:30.840 --> 49:40.460
I'm just uploading, uh, the send mail MTA default config file with just like or do two config keys.

49:44.340 --> 49:48.400
Yeah, doing the upload manually, sorry, it takes a bit of time.

49:53.880 --> 50:03.600
So, yeah, you can see that I'm putting the dead letter in the slash app slash back dot dot PHP with a double bounce address containing a payload.

50:04.880 --> 50:08.580
So, yeah, now the config file is uploaded.

50:08.580 --> 50:15.060
We can just run the payload in the from, uh, in the from email.

50:15.940 --> 50:19.060
That's exactly the payload from the, the slides.

50:19.060 --> 50:24.120
We're sending that to, uh, a local host address that doesn't exist.

50:24.120 --> 50:26.020
So, that should draw, draw an error.

50:26.020 --> 50:30.880
We see that the page is completed bank because that generated an error.

50:30.880 --> 50:35.440
So, now we can go to, uh, the slash back dot dot PHP.

50:35.440 --> 50:45.180
We can see the dead letter there and I did add some back dot there and we get arbitrary PHP, uh, execution.

50:45.180 --> 50:48.900
So, definitely quite cool.

50:49.240 --> 50:56.940
So, that was paid 5,000, uh, dollars despite the fact that it was, uh, hardly exploitable.

50:57.480 --> 51:00.780
Uh, made me cry a bit.

51:00.780 --> 51:02.780
I spent a lot of time on it.

51:02.780 --> 51:07.900
So, I hope your brain fried exactly, uh, like me.

51:07.900 --> 51:09.900
And that's my end word.

51:09.900 --> 51:12.660
So, uh, thanks for having listened to the end.

51:12.660 --> 51:13.460
Hope you had fun.

51:13.460 --> 51:15.100
Hope you learned some things.

51:15.100 --> 51:23.940
And also I will maybe soon open a blog, uh, a blog with a lot of my bags, like a hundred of them.

51:24.300 --> 51:28.400
So, yeah, follow me on Twitter if you want some news and thank you.

