1 00:00:00,000 --> 00:00:01,540 Good morning, everyone. 2 00:00:01,680 --> 00:00:05,940 Welcome to talk two in the creator stage four. 3 00:00:06,320 --> 00:00:08,660 Apologies to those who are watching online. 4 00:00:08,660 --> 00:00:10,880 We still are having technical difficulties. 5 00:00:11,020 --> 00:00:14,640 And so we only have the slides on the screen. 6 00:00:14,640 --> 00:00:15,960 We are working on it. 7 00:00:15,960 --> 00:00:18,080 Hopefully we'll have it for the next talk. 8 00:00:19,220 --> 00:00:29,460 But I would like to introduce Blackis on his talk from easy wins to epic challenges, the bounty hunter edition. 9 00:00:29,480 --> 00:00:30,420 Everyone involved. 10 00:00:37,510 --> 00:00:39,170 Hey, everyone. 11 00:00:39,170 --> 00:00:45,090 So I present you a bit of my journey in bug bounty. 12 00:00:45,090 --> 00:00:49,410 I tried to select some bugs that were quite surprising. 13 00:00:49,410 --> 00:00:55,190 Surprising in the sense of being very easy or being very difficult. 14 00:00:55,190 --> 00:00:59,470 So I will present a couple of fun bugs. 15 00:00:59,470 --> 00:01:02,070 So a bit about myself. 16 00:01:02,070 --> 00:01:05,470 So I'm doing bug bounty for seven years now. 17 00:01:05,470 --> 00:01:09,470 I did a lot of CTFSO for 15 years or something like that. 18 00:01:09,470 --> 00:01:12,390 And in general, I'm working for 18 years now. 19 00:01:12,390 --> 00:01:15,530 So that's quite a long time I'm doing that. 20 00:01:15,990 --> 00:01:19,730 I'm definitely a web application enjoyer. 21 00:01:19,730 --> 00:01:21,370 I love PHP. 22 00:01:21,370 --> 00:01:22,650 Who doesn't? 23 00:01:23,030 --> 00:01:25,750 And I love doing some source code review. 24 00:01:25,770 --> 00:01:28,570 I'm definitely not a recon guy. 25 00:01:28,570 --> 00:01:32,150 Not doing anything like reconnaissance or something like that. 26 00:01:32,150 --> 00:01:35,410 I'm just going to main apps and break them. 27 00:01:35,410 --> 00:01:37,170 Most of the time, at least. 28 00:01:37,550 --> 00:01:45,270 I really love, like, complex chain, complex exploit or something like that. 29 00:01:45,530 --> 00:01:53,170 And, yeah, in my journey, I did something around, like, $2 million across all platforms. 30 00:01:53,570 --> 00:01:56,550 And I'm also an ambassador for France. 31 00:01:56,550 --> 00:01:57,930 So, yeah, I'm French. 32 00:01:57,930 --> 00:02:00,450 That explains my pretty bad English. 33 00:02:00,450 --> 00:02:01,870 I'm sorry for that. 34 00:02:02,190 --> 00:02:07,090 If something isn't clear, don't hesitate to come later and just ask me. 35 00:02:08,190 --> 00:02:12,990 So we'll begin with first customer, Swisscom. 36 00:02:13,010 --> 00:02:16,470 So I will present a couple of bugs I found on them. 37 00:02:18,130 --> 00:02:22,570 Swisscom is a big provider in Switzerland. 38 00:02:22,590 --> 00:02:23,930 They are doing a lot of things. 39 00:02:24,290 --> 00:02:33,330 They are active in 2016. 40 00:02:33,690 --> 00:02:35,810 That was my first experience. 41 00:02:36,310 --> 00:02:39,910 I started, like, end of 2016 on them. 42 00:02:40,670 --> 00:02:43,130 And that's a pretty good team, to be honest. 43 00:02:43,130 --> 00:02:43,990 They're pretty fair. 44 00:02:43,990 --> 00:02:45,250 They're pretty kind. 45 00:02:45,250 --> 00:02:47,130 Good communication with them. 46 00:02:47,470 --> 00:02:51,950 They have a very big scope, like, millions of IP addresses. 47 00:02:51,950 --> 00:02:53,470 So it's pretty cool. 48 00:02:53,690 --> 00:02:58,270 And I did something around, like, $500,000 on them. 49 00:02:58,270 --> 00:03:00,810 So, yeah, that's quite good. 50 00:03:01,170 --> 00:03:13,650 Definitely the bug bounty, they decided to open definitely improved their security stuff over time. 51 00:03:13,750 --> 00:03:17,650 And, yeah, the bugs I'm presenting now are quite old. 52 00:03:17,650 --> 00:03:23,210 Definitely they're, like, pretty much other stuff now. 53 00:03:23,210 --> 00:03:25,290 But still quite some cool bugs. 54 00:03:25,290 --> 00: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. 55 00:03:35,910 --> 00:03:38,550 Everything is explained there. 56 00:03:39,390 --> 00:03:44,150 So let's talk about first target, which is Swisscom Cockpit. 57 00:03:44,150 --> 00:03:46,870 That's the mobile phone manager in Swisscom. 58 00:03:46,870 --> 00: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. 59 00:03:56,190 --> 00:03:59,390 There's locking process on it that is quite particular. 60 00:03:59,390 --> 00:04:03,890 It trusts you sending your phone number and you receive an SMS token. 61 00:04:03,890 --> 00:04:08,650 You need also to fill a capture and you're logged in if the card is valid, right? 62 00:04:09,190 --> 00:04:16,690 So it definitely manage some serious confidential data, a lot of PII payments, things like that. 63 00:04:16,810 --> 00:04:21,850 You can see everything that is related to subscription on there. 64 00:04:21,850 --> 00:04:24,470 So definitely a good target for me. 65 00:04:25,350 --> 00:04:28,290 Also, uh, pretty good stuff for us. 66 00:04:28,290 --> 00:04:33,490 There is a staging instance on the internet that is, like, publicly available. 67 00:04:33,750 --> 00:04:34,530 That was cool. 68 00:04:34,530 --> 00:04:39,950 There might be some, uh, stuff that is not published on the production server and things like that. 69 00:04:40,510 --> 00:04:43,710 So let's talk about the first bug. 70 00:04:43,710 --> 00:04:50,550 Uh, I saw that on the staging instance, the SMS token is always 1, 1, 1, 1. 71 00:04:50,550 --> 00:04:51,790 Pretty good. 72 00:04:52,270 --> 00:04:55,370 Uh, the problem is the staging log in doesn't work. 73 00:04:55,370 --> 00:04:59,730 It always throws some internal server error. 74 00:04:59,730 --> 00:05:02,070 So I can't log in with it. 75 00:05:02,210 --> 00:05:07,570 And I was, like, yeah, maybe that's the SMS repository. 76 00:05:07,570 --> 00:05:11,470 It might be, like, shared with the production system. 77 00:05:11,470 --> 00:05:14,890 So I just try to log in on the production system. 78 00:05:14,890 --> 00:05:17,830 Then try to log in on the staging system. 79 00:05:18,570 --> 00:05:22,630 Then use 1, 1, 1, 1 on production system. 80 00:05:22,870 --> 00:05:24,230 And I was logged in. 81 00:05:24,230 --> 00:05:28,050 So that was a very simple, uh, bug. 82 00:05:28,050 --> 00:05:30,390 But definitely a good impact. 83 00:05:30,390 --> 00:05:32,250 So let's see a demo. 84 00:05:32,250 --> 00:05:36,530 If everything is working well, we should be able to see. 85 00:05:36,590 --> 00:05:37,110 Yeah. 86 00:05:37,110 --> 00:05:39,770 So I'm just entering a phone number. 87 00:05:40,690 --> 00:05:42,830 Just trying to sign in. 88 00:05:42,830 --> 00:05:45,570 Doing the same on the staging instance. 89 00:05:48,700 --> 00:05:53,460 And I'm trying on the prod instance to just input 1, 1, 1, 1. 90 00:05:53,460 --> 00:05:54,920 Filling the capture. 91 00:05:56,780 --> 00:05:57,780 Sign in. 92 00:05:57,780 --> 00:05:59,060 And I'm signed in. 93 00:05:59,060 --> 00:06:00,280 So, yeah. 94 00:06:00,280 --> 00:06:01,460 Pretty easy. 95 00:06:01,640 --> 00:06:06,660 Uh, that's not video of the real system. 96 00:06:06,660 --> 00:06:09,040 I reproduced everything locally. 97 00:06:09,040 --> 00:06:15,680 I will share the demo, uh, the demos video and instances a bit later after the talk. 98 00:06:15,820 --> 00:06:16,880 So, yeah. 99 00:06:16,980 --> 00:06:19,160 This was paid 8,000 dollars. 100 00:06:19,160 --> 00:06:21,680 Which is pretty good because that was super easy. 101 00:06:21,680 --> 00:06:27,800 But that, uh, have a nice impact for them because I have like PII of every customer there. 102 00:06:27,800 --> 00:06:31,580 Uh, maybe millions of PII there. 103 00:06:31,580 --> 00:06:32,260 So, yeah. 104 00:06:32,260 --> 00:06:33,320 Pretty good. 105 00:06:34,220 --> 00:06:36,940 Uh, second bag. 106 00:06:37,520 --> 00:06:42,320 So, as I said, the login process is, uh, pretty easy. 107 00:06:42,320 --> 00:06:44,840 You just input, uh, your phone number. 108 00:06:44,840 --> 00:06:45,920 You submit. 109 00:06:46,180 --> 00:06:51,360 Then, uh, you receive, uh, SMS codes that you need to submit with, uh, capture. 110 00:06:51,580 --> 00:06:56,420 But the process is also setting you, uh, three encrypted cookies. 111 00:06:56,420 --> 00:06:58,840 The first one is a cockpit capture text. 112 00:06:58,840 --> 00:07:04,180 Uh, it definitely by the name, I guess, it definitely manages capture text. 113 00:07:04,420 --> 00:07:10,360 Uh, the cockpit MSISDN key that manage the phone numbers that you input at the first step. 114 00:07:10,680 --> 00:07:17,140 And the cockpit SMS token key which, I guess, is a pin code that was received by SMS. 115 00:07:17,140 --> 00:07:24,180 So, I was like, okay, maybe they are using, like, the same key for encryption. 116 00:07:24,180 --> 00:07:31,760 So, I decided to, like, copy the cockpit SMS token key cookie into the cockpit capture text. 117 00:07:31,800 --> 00:07:33,540 Reload the page. 118 00:07:33,540 --> 00:07:37,340 And the pin code is just leaked into the capture. 119 00:07:37,420 --> 00:07:38,780 So, here it is. 120 00:07:38,780 --> 00:07:44,380 That's not very clear because there's some, uh, maybe, uh, padding issue. 121 00:07:44,380 --> 00:07:49,320 But you can see the code there that is 7998. 122 00:07:49,320 --> 00: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. 123 00:08:01,220 --> 00:08:09,880 So, let's do a small, if I can move that. 124 00:08:10,920 --> 00:08:12,800 Here it is. 125 00:08:12,800 --> 00:08:14,040 Out of the demo. 126 00:08:14,880 --> 00:08:17,080 So, just filling the phone number again. 127 00:08:18,880 --> 00:08:21,420 Trying to see the cookies. 128 00:08:22,180 --> 00:08:26,740 Putting the SMS token key into the capture text cookie. 129 00:08:26,740 --> 00:08:27,920 Just reloading. 130 00:08:28,400 --> 00:08:36,800 And we get the pin code into the capture which is RKB5T. 131 00:08:36,800 --> 00:08:38,840 That's a pin code I received by SMS. 132 00:08:38,840 --> 00:08:42,500 So, I'm once again logged in with that. 133 00:08:43,060 --> 00: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. 134 00:08:54,160 --> 00:08:59,180 You can't really automate the attack so they decided to pay $3,000 for that. 135 00:08:59,360 --> 00: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. 136 00:09:10,160 --> 00:09:13,660 But no, here is a, is a cell bug. 137 00:09:13,960 --> 00: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. 138 00:09:24,460 --> 00:09:25,720 I have no idea why. 139 00:09:26,440 --> 00:09:31,400 I, I suppose they did something bad by patching, uh, some of my bugs. 140 00:09:31,660 --> 00:09:34,500 Uh, yeah, probably a fail. 141 00:09:34,500 --> 00: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. 142 00:09:40,820 --> 00:09:43,100 Uh, I suppose you don't expect a demo for that. 143 00:09:43,100 --> 00:09:46,260 I mean, that's not really needed, I guess. 144 00:09:46,260 --> 00:09:51,340 So, for this time, let's really move on to another target. 145 00:09:51,940 --> 00:09:59,420 So, uh, Swisscom WorkLink, uh, is a Swisscom acquisition that was like a company that just bought. 146 00:09:59,420 --> 00:10:01,500 I decided to have a check. 147 00:10:01,500 --> 00:10:10,620 They were using, uh, completely unknown CMS called weblication, something in PHP, you know, that trigger me always. 148 00:10:10,620 --> 00: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. 149 00:10:24,500 --> 00:10:29,040 Uh, firstly, I saw that the thing is not using SQL at all. 150 00:10:29,040 --> 00:10:37,320 Uh, it's only some, uh, XML databases and some, uh, file system storage, which is quite not so usual. 151 00:10:37,700 --> 00: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. 152 00:10:52,960 --> 00: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. 153 00:11:02,540 --> 00: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. 154 00:11:11,200 --> 00:11:16,340 So, there is, like, an easy bypass of the, uh, mechanism to prevent pass traversal. 155 00:11:16,340 --> 00:11:19,920 So, I decided to have a look for some pass traversal issues. 156 00:11:20,620 --> 00: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. 157 00:11:36,780 --> 00: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. 158 00:11:52,900 --> 00:11:58,960 So, I created the directory that was needed, uh, to reach the directory empty vulnerability. 159 00:11:59,140 --> 00:12:00,780 Uh, so, cool. 160 00:12:00,780 --> 00:12:06,440 I can delete files in directories, uh, but, come on, that's not useful. 161 00:12:06,440 --> 00:12:11,740 I'm definitely not wanting to deface their website, that's definitely not the goal. 162 00:12:12,340 --> 00: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. 163 00:12:33,380 --> 00: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. 164 00:12:46,760 --> 00: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, 165 00:13:09,440 --> 00:13:15,620 so I can just read it, that's an authentication bypass, that's a win. 166 00:13:15,640 --> 00:13:19,700 No, it works locally, it doesn't work remotely. 167 00:13:19,700 --> 00:13:26,200 I have like, uh, internal server error everywhere, so I was quite in despair, I was crying a bit. 168 00:13:26,820 --> 00: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, 169 00:13:51,280 --> 00:13:53,560 so, definitely didn't work. 170 00:13:53,560 --> 00:13:58,840 I decided to go and say, search, uh, other vulnerabilities. 171 00:13:58,860 --> 00: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. 172 00:14:07,160 --> 00:14:14,920 And I found something that was maybe interesting, but quite lame, I didn't see the impact at first. 173 00:14:14,920 --> 00:14:18,660 I found an XML injection in the log user database. 174 00:14:19,040 --> 00:14:26,020 Uh, so, pretty much the same, it's also, uh, PHP extension, uh, in the same directories. 175 00:14:26,140 --> 00: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, 176 00:14:46,440 --> 00:14:47,940 uh, specific database. 177 00:14:47,940 --> 00:14:50,740 So, there is a XML injection there. 178 00:14:50,740 --> 00:14:51,560 Okay. 179 00:14:51,840 --> 00:14:56,460 Not so useful, I can block up entire users maybe, but, yeah, quite lame. 180 00:14:56,960 --> 00: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. 181 00:15:08,900 --> 00: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. 182 00:15:19,200 --> 00:15:27,500 No luck for them, uh, thanks PHP, uh, it enabled X include instead, so definitely not what they wanted. 183 00:15:27,740 --> 00: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. 184 00:15:44,100 --> 00: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. 185 00:15:59,060 --> 00: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. 186 00:16:16,500 --> 00:16:23,160 But, uh, yeah, X include is doing their best to, like, reformat all the file to be a fully valid XML. 187 00:16:23,160 --> 00: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. 188 00:16:33,260 --> 00:16:40,640 But, no, that's still useless, I mean, yeah, I can include the database into another, but that's quite useless. 189 00:16:41,940 --> 00: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. 190 00:16:57,760 --> 00: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. 191 00:17:05,960 --> 00: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. 192 00:17:15,920 --> 00:17:21,540 So, the log database, uh, yes, I, I, I, I would say that. 193 00:17:21,540 --> 00: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. 194 00:17:31,100 --> 00: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. 195 00:17:39,800 --> 00:17:41,940 So, this time is a win. 196 00:17:42,000 --> 00:17:43,460 It works remotely. 197 00:17:43,680 --> 00: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. 198 00:17:55,260 --> 00:18:03,500 Exfiltrate it with X pass injection, get admin session, get RC and let, let's go for a demo . 199 00:18:09,210 --> 00:18:14,190 So, we can see there on the right that the blog database is empty. 200 00:18:16,030 --> 00: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. 201 00:18:26,910 --> 00:18:32,190 We now try to inject some XML to see if there is a XM injection there. 202 00:18:34,390 --> 00:18:35,990 And yes, it is. 203 00:18:35,990 --> 00:18:42,350 There is now a FUBAR attribute, uh, in the, in the block, uh, block entry. 204 00:18:42,930 --> 00: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, 205 00:18:58,590 --> 00:18:59,110 the login log. 206 00:18:59,110 --> 00:19:04,070 So, yeah, I just saw that the login log contains some, uh, session stuff there. 207 00:19:04,250 --> 00:19:08,430 So, we make that user with the payload to be blocked. 208 00:19:09,930 --> 00:19:16,170 We can see that to X include directive is now there in the file of the blocked, uh, database. 209 00:19:16,190 --> 00:19:20,350 We make, uh, another user, another random user to be blocked. 210 00:19:20,350 --> 00: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. 211 00:19:28,910 --> 00:19:36,510 So, this time it was completely replaced, uh, by the, by the original login logs file. 212 00:19:36,510 --> 00:19:39,970 So, now we can try to use, uh, the X pass injection. 213 00:19:39,970 --> 00:19:45,750 So, we are like targeting, uh, a log element, trying to infiltrate the session. 214 00:19:45,750 --> 00:19:49,210 We check here, we're checking if it begins by a L. 215 00:19:49,210 --> 00:19:52,950 We know it is because we can see that on the right screen. 216 00:19:53,090 --> 00:19:59,570 So, if it begins by a L, we should receive that the account is blocked. 217 00:19:59,570 --> 00:20:05,390 But if we check, uh, if it begins by X, we receive that no user is found. 218 00:20:05,390 --> 00:20:09,330 So, we have an hour to leak, uh, the characters one by one. 219 00:20:09,330 --> 00:20:11,470 So, I write a little script. 220 00:20:12,990 --> 00:20:17,410 And yeah, it definitely leaks the session token character by character. 221 00:20:17,410 --> 00:20:24,490 So, yeah, we got, we got an admin account to that and get RC remotely. 222 00:20:24,510 --> 00:20:29,150 For that, uh, Swisscom decided to pay me $3,000. 223 00:20:29,550 --> 00:20:38,690 So, uh, $2,500 for the bag, uh, $500 for the, um, for, uh, bonus for the nice shell. 224 00:20:38,690 --> 00:20:45,470 And also the editor decided to, uh, reward me for, with, uh, $2,000. 225 00:20:45,830 --> 00:20:49,730 They didn't have the bag money, but they were like impressed by the bag. 226 00:20:49,730 --> 00:20:52,190 So, pretty cool for the, for, from them. 227 00:20:52,970 --> 00:21:01,270 So, now let's switch to yet another customer, uh, another Swiss one, uh, so Swiss Post. 228 00:21:01,310 --> 00: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. 229 00:21:21,230 --> 00:21:24,950 Uh, they decide, uh, they, they are also very active in cyber security. 230 00:21:24,950 --> 00:21:30,310 They like about a lot of local, uh, cyber security, security companies. 231 00:21:30,350 --> 00:21:36,330 So, so they are like very active in the cyber security, uh, stuff in Switzerland. 232 00:21:36,630 --> 00: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. 233 00:21:47,850 --> 00:21:54,890 So, uh, they are pretty good, pretty much the same as Swisscom to be honest. 234 00:21:55,110 --> 00:21:59,670 Uh, we can have a lot of, uh, communication with them, they are pretty good. 235 00:21:59,930 --> 00: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. 236 00:22:13,690 --> 00:22:17,470 I'm not a crypto guy, so I'm not going back, maybe you are. 237 00:22:18,210 --> 00:22:26,170 So, if you want to have a check, uh, everything is described on their VDP page, so vdp.post.ch. 238 00:22:27,770 --> 00: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, 239 00:22:47,910 --> 00: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. 240 00:22:58,970 --> 00:23:04,990 I will switch this bag because we have some time issue, let's go on the second one. 241 00:23:04,990 --> 00: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, 242 00:23:26,950 --> 00: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. 243 00:23:44,110 --> 00: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. 244 00:23:58,370 --> 00:24:00,050 No idea what happened. 245 00:24:00,170 --> 00: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. 246 00:24:14,550 --> 00: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, 247 00:24:35,050 --> 00:24:44,470 so probably a bad check of payment states, it default to success instead of defaulting to, uh, a failure, so, yeah. 248 00:24:44,610 --> 00:24:47,290 Let's go for a demo. 249 00:24:49,410 --> 00:24:53,470 So, let's buy a very good croissant, because I'm French. 250 00:24:56,430 --> 00:24:58,210 Oh, that's not a good demo. 251 00:24:58,490 --> 00:25:00,910 I want a croissant, a bigger one. 252 00:25:01,490 --> 00:25:02,790 Let's go for it. 253 00:25:03,390 --> 00:25:04,170 Just wait. 254 00:25:04,170 --> 00:25:06,010 Just go grab a coffee, maybe. 255 00:25:09,600 --> 00:25:11,380 Are you patient enough? 256 00:25:12,400 --> 00:25:13,180 Oh, yeah. 257 00:25:15,360 --> 00:25:17,680 No, joking, it will just last. 258 00:25:17,680 --> 00:25:20,480 Yeah, success payments, just by waiting. 259 00:25:22,240 --> 00:25:27,280 I'm in pretty good solution to get some money, right? 260 00:25:27,620 --> 00: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. 261 00:25:34,880 --> 00:25:38,800 Definitely was quite profitable, right? 262 00:25:39,780 --> 00:25:43,420 So, let's go to another project of them. 263 00:25:43,420 --> 00:25:50,320 Uh, they have, like, a subdomain, uh, using, uh, very, very unknown, uh, CMS. 264 00:25:50,600 --> 00:25:54,280 So, Peppershop, that's like a Swiss page PCMS. 265 00:25:54,280 --> 00:25:57,040 They also do some manager thing and things like that. 266 00:25:57,040 --> 00:25:58,840 I never heard of them. 267 00:25:58,840 --> 00:26:06,400 So, I decided, once again, to buy a license, uh, of the CMS, so I get access to the code. 268 00:26:06,400 --> 00:26:10,200 Once again, it's PHP, so I'm super interested by that. 269 00:26:11,060 --> 00:26:18,960 And I just had a look at the code, everything was quite, you know, PHP. 270 00:26:19,420 --> 00:26:26,260 Uh, so I saw that, uh, an admin feature, uh, that is quite interesting is a restart backup thing. 271 00:26:26,380 --> 00:26:31,420 Uh, it's some, like, custom things. 272 00:26:31,420 --> 00:26:36,580 They decided that the delimiter between SQL queries will be that stuff. 273 00:26:36,580 --> 00:26:37,820 No idea why. 274 00:26:37,820 --> 00:26:41,520 Why don't use, like, semicolon like everyone do? 275 00:26:41,520 --> 00:26:42,360 I don't know. 276 00:26:42,360 --> 00:26:43,940 They decided it is. 277 00:26:44,260 --> 00: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. 278 00:26:54,800 --> 00: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. 279 00:27:09,000 --> 00:27:10,280 I don't know why. 280 00:27:10,280 --> 00:27:13,780 I, I, that's quite a strange feature to be honest. 281 00:27:14,340 --> 00: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. 282 00:27:31,360 --> 00: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. 283 00:27:47,560 --> 00: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, 284 00:28:09,860 --> 00:28:16,460 uh, maybe on my profile, on my, I don't know, username, name, other comments, uh, things like that. 285 00:28:16,820 --> 00:28:21,680 The first problem is, uh, most fields are sanitized by default. 286 00:28:21,680 --> 00:28:28,560 That's like a global sanitize, uh, sanitization that is done on every field. 287 00:28:28,560 --> 00:28:35,200 Um, so, no, no new lines, no hash, no special characters in general. 288 00:28:35,800 --> 00: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. 289 00:28:48,180 --> 00:28:52,960 I mean, for the first problem, the solution is quite easy. 290 00:28:53,020 --> 00:28:56,500 Most, uh, fields are sanitized but not all. 291 00:28:56,500 --> 00:28:58,100 They are like exception. 292 00:28:58,240 --> 00:29:02,280 One of them are like, uh, comments that are put on the other. 293 00:29:02,280 --> 00:29:07,160 So, I can definitely reach that field, uh, on the front end. 294 00:29:07,320 --> 00:29:15,320 And the second, uh, problem, we have like a separate between queries and way to inject single code. 295 00:29:15,320 --> 00:29:22,320 So, that should be possible, uh, to get like a valid file after injecting things. 296 00:29:23,140 --> 00:29:30,820 So, let's imagine, uh, uh, a valid SQL query in the file formats. 297 00:29:30,960 --> 00:29:34,720 So, we control fully the values of Bimmerkugen. 298 00:29:34,720 --> 00:29:39,120 I have no idea what it means but that's the name of the database, of the, uh, table. 299 00:29:39,120 --> 00:29:40,860 I have no idea what it is. 300 00:29:41,240 --> 00:29:46,380 So, we can control that fully and you can see the separator at the end. 301 00:29:46,380 --> 00:29:51,840 So, we're trying to use their base 64 feature to break from single codes. 302 00:29:51,840 --> 00:29:55,760 So, we're trying to get something like that. 303 00:29:55,880 --> 00:29:59,040 That will be transformed to that. 304 00:29:59,040 --> 00:30:07,540 So, we inject a single code, a parenthesis, a comment and that is working pretty well to be honest. 305 00:30:07,940 --> 00:30:13,000 So, then my goal is to inject new queries in the packet file. 306 00:30:13,320 --> 00:30:22,240 So, this time I'm also adding, uh, a separator and a new, uh, query with a comment at the end. 307 00:30:22,280 --> 00:30:28,500 So, after being, uh, uh, passed by the restore procedures that will give that. 308 00:30:28,500 --> 00:30:30,640 And that's definitely valid. 309 00:30:30,640 --> 00:30:41,280 So, I was able to, uh, just inject, uh, an update to, uh, an arbitrary table, changing arbitrary column there. 310 00:30:41,280 --> 00:30:42,820 Pretty good. 311 00:30:43,260 --> 00:30:50,620 Um, so, the impact is I can run arbitrary queries on the restore process. 312 00:30:50,620 --> 00:30:55,460 If they take a backup and restore, that will run my queries. 313 00:30:55,700 --> 00:30:57,020 Pretty good. 314 00:30:57,020 --> 00: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. 315 00:31:09,340 --> 00:31:11,340 Storing full objects. 316 00:31:11,840 --> 00:31:18,060 So, I found, uh, pretty fastly a custom gadget, uh, that allow to delete local files. 317 00:31:18,400 --> 00: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. 318 00:31:26,960 --> 00:31:33,820 But I saw that, uh, the admin authentication mechanism is just, uh, dot access file. 319 00:31:33,820 --> 00:31:45,120 So, if we delete the dot access file, uh, everyone can go to slash admin and, uh, I mean, just that. 320 00:31:45,120 --> 00:31:46,880 There is no authentication besides that. 321 00:31:46,880 --> 00:31:52,240 Such as, like, you need, as a valid credential or you need to pipe as a dot access. 322 00:31:52,760 --> 00:31:56,640 The payload is too big for the screen, I'm sorry. 323 00:31:57,060 --> 00:32:00,260 So, let's get a demo for this one. 324 00:32:02,200 --> 00:32:04,300 Once again, super classic. 325 00:32:04,300 --> 00:32:05,380 So, the payload is in shop. 326 00:32:07,740 --> 00:32:12,240 So, we put the payload, uh, in the other commands. 327 00:32:15,080 --> 00:32:16,760 You can see the payload there. 328 00:32:16,760 --> 00:32:18,020 It's pretty big. 329 00:32:18,020 --> 00: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. 330 00:32:28,520 --> 00:32:39,240 So, now, my user have, uh, like another ways, uh, or, uh, or tags, uh, or by basics for tags. 331 00:32:39,240 --> 00:32:42,180 So, let's go to an administrator account. 332 00:32:42,180 --> 00:32:44,040 Let's do a backup. 333 00:32:46,420 --> 00:32:48,140 Yeah, that's a fail. 334 00:32:50,100 --> 00:32:51,700 Let's go to the backup. 335 00:32:51,720 --> 00:32:52,960 Let's log in. 336 00:32:56,800 --> 00:33:01,180 So, let's do a backup and now trying to restore it. 337 00:33:01,380 --> 00: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. 338 00:33:10,540 --> 00:33:12,200 So, now, trying to restore. 339 00:33:12,200 --> 00:33:14,200 That's definitely not the same data. 340 00:33:14,200 --> 00:33:20,120 We were able to update the other and add, like, a serialized object. 341 00:33:20,120 --> 00: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. 342 00:33:32,860 --> 00: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. 343 00:33:49,040 --> 00:33:49,840 Oops. 344 00:33:50,480 --> 00: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. 345 00:34:13,840 --> 00:34:18,140 You know, like, problem of memory issues and things like that. 346 00:34:18,140 --> 00: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. 347 00:34:25,600 --> 00:34:28,380 So, yeah, still quite firm. 348 00:34:29,740 --> 00:34:36,060 Let's go on another customer, the most known one, redacted. 349 00:34:36,280 --> 00:34:46,340 Uh, I wasn't able to name them so let's consider that, uh, we just put a bit of context. 350 00:34:46,340 --> 00: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. 351 00:35:03,760 --> 00: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. 352 00:35:15,580 --> 00:35:20,300 So, the maintainers decided to make an emergency patch. 353 00:35:20,780 --> 00:35:24,280 I decided to reverse it, obviously. 354 00:35:24,520 --> 00:35:29,960 Uh, so, uh, there is like a double level of templating, uh, on the app. 355 00:35:30,320 --> 00: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. 356 00:35:41,300 --> 00:35:46,580 Uh, the problem is, maybe someone saw that? 357 00:35:48,140 --> 00:35:49,600 You saw that? 358 00:35:49,600 --> 00:35:50,520 I know. 359 00:35:50,600 --> 00:35:53,080 The regex is not matching new lines. 360 00:35:53,320 --> 00: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. 361 00:36:05,960 --> 00: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. 362 00:36:20,240 --> 00:36:29,300 So, that was enough, uh, templates, uh, will contain some tags, ending tags later, so, yeah, that's also bypass it. 363 00:36:30,340 --> 00: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. 364 00:36:43,860 --> 00:36:53,080 So, I found a bag, uh, that is, to be honest, barely exportable, but it's super fun technically. 365 00:36:54,060 --> 00: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. 366 00:37:05,880 --> 00:37:17,840 So, for the context, uh, that application, uh, was using Laminas PHP library to, for everything that is using, like, emails. 367 00:37:18,440 --> 00: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, 368 00:37:37,000 --> 00:37:39,980 uh, used for sending some emails. 369 00:37:40,520 --> 00: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. 370 00:37:57,840 --> 00: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. 371 00:38:07,200 --> 00:38:14,020 There are, like, no next point to that, uh, but it definitely depends on the MTA that is used. 372 00:38:14,060 --> 00:38:19,920 So, uh, every MTA is chipped with different send mail binaries. 373 00:38:19,920 --> 00:38:26,160 So, for this, uh, talk, we will consider, uh, send mail MTA here. 374 00:38:26,160 --> 00:38:27,960 That's like a first condition. 375 00:38:27,960 --> 00:38:29,140 Why send mail? 376 00:38:29,140 --> 00:38:30,800 Because I'm cheating. 377 00:38:30,800 --> 00:38:31,820 That's my bug. 378 00:38:31,820 --> 00:38:35,700 I decide to whatever is the condition. 379 00:38:35,700 --> 00:38:39,900 So, that's what, uh, I want to be. 380 00:38:40,900 --> 00:38:46,480 So, uh, the problem is Laminas validating email address. 381 00:38:46,480 --> 00:38:51,540 We can't, like, put anything that is not a valid email address. 382 00:38:51,540 --> 00:38:58,800 Uh, Laminas is supporting, uh, cutted string, uh, format, so, uh, double quotes and pretty much anything. 383 00:38:58,820 --> 00:39:03,440 Uh, dot atom format, that's like the standard, uh, email formats. 384 00:39:03,740 --> 00:39:06,680 Uh, for that, they are using super big regrets. 385 00:39:06,720 --> 00:39:09,340 Uh, that was super hard to read. 386 00:39:10,820 --> 00: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. 387 00:39:24,180 --> 00: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. 388 00:39:36,720 --> 00:39:42,840 Uh, double escape means, uh, no escape at all, means argument injection, thanks PHP. 389 00:39:44,560 --> 00: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. 390 00:40:04,780 --> 00: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. 391 00:40:21,000 --> 00:40:21,760 Painful. 392 00:40:21,760 --> 00:40:24,100 I was, like, a bit in despair. 393 00:40:24,100 --> 00:40:27,880 I was pretty sure that won't be exploitable at all. 394 00:40:27,920 --> 00:40:33,760 But, yeah, I still decided to make, like, cause of testing. 395 00:40:33,780 --> 00:40:36,980 I was pretty much like that after a few hours. 396 00:40:37,360 --> 00: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. 397 00:40:47,180 --> 00: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. 398 00:40:56,420 --> 00:40:58,320 I was, like, that's, that's strange. 399 00:40:58,320 --> 00:41:01,140 That's definitely not the domain I put in my mail. 400 00:41:01,680 --> 00:41:05,060 So, I decided to debug a bit the behavior. 401 00:41:05,060 --> 00:41:08,900 So, Laminas, uh, did, uh, the validation of the email. 402 00:41:08,900 --> 00: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. 403 00:41:18,420 --> 00:41:22,500 Then, uh, Laminas passed the generated email. 404 00:41:22,500 --> 00:41:26,400 Then, the app is extracting the sender again from it. 405 00:41:26,700 --> 00:41:30,820 Validates that it's still a valid email. 406 00:41:30,920 --> 00:41:33,300 So, painful process. 407 00:41:33,740 --> 00:41:36,880 So, I was like, okay, but that doesn't explain the error. 408 00:41:36,880 --> 00:41:40,800 So, that's a traditional form header. 409 00:41:40,800 --> 00:41:47,780 So, it's just, uh, double quotes your name, double quotes and in brackets , uh, the full email. 410 00:41:47,780 --> 00:41:55,800 But, when I tried to inject XSX right brackets at black dot S, that was like the form that was generated. 411 00:41:55,800 --> 00:42:04,120 So, we have like an injection in the email part, but that's quite useless in my opinion. 412 00:42:04,600 --> 00:42:10,960 Uh, there was like no CRLs, there was like protection and mechanism to prevent that. 413 00:42:10,960 --> 00:42:13,480 So, I was like, okay, that's definitely useless. 414 00:42:13,480 --> 00:42:19,840 But, I decided to like investigate because that's quite a dirty thing still. 415 00:42:19,840 --> 00:42:20,940 So, yeah. 416 00:42:21,780 --> 00: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. 417 00:42:31,040 --> 00:42:36,420 So, uh, that's described by the, uh, the RFC 2047. 418 00:42:36,580 --> 00:42:42,520 That's for using special characters in, uh, email headers and body. 419 00:42:43,400 --> 00:42:52,280 That's a format, so, uh, it was seen, uh, 420 00:42:56,780 --> 00:43:01,820 so, in that case, I'd like generate AAA. 421 00:43:02,740 --> 00: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. 422 00:43:12,980 --> 00:43:17,740 At least, uh, in the double, uh, double code encoded formats. 423 00:43:18,180 --> 00:43:24,780 So, I was like, maybe I can inject mime uncoded words in my, uh, sender email. 424 00:43:25,140 --> 00: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. 425 00:43:41,920 --> 00:43:49,360 So, uh, I needed, uh, some spaces to like inject another argument to send mail. 426 00:43:49,740 --> 00: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. 427 00:43:59,960 --> 00:44:05,520 So, we can, uh, just input, uh, spaces by using an underscore. 428 00:44:05,520 --> 00:44:09,040 Don't ask me why, there's probably a reason for that. 429 00:44:09,520 --> 00: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. 430 00:44:20,480 --> 00:44:26,040 So, we need to have, uh, a control of a malicious local file. 431 00:44:26,220 --> 00:44:29,960 Fortunately for us, the CMS have, uh, a nice file upload. 432 00:44:29,960 --> 00:44:31,480 So, we can upload files there. 433 00:44:31,480 --> 00: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. 434 00:44:44,220 --> 00:44:47,700 So, that's a problem, but not so much. 435 00:44:47,700 --> 00: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. 436 00:45:01,180 --> 00:45:07,560 So, let's consider that, uh, a web route is, uh, slash app. 437 00:45:07,560 --> 00:45:08,560 That's short . 438 00:45:08,560 --> 00:45:10,180 That's definitely what I need. 439 00:45:10,180 --> 00:45:13,880 So, I'm still, uh, cheating again. 440 00:45:13,880 --> 00:45:16,300 So, uh, that's another preconditions. 441 00:45:16,300 --> 00:45:23,600 The first one is you need send mail to be used and you need, uh, a short , uh, web route. 442 00:45:23,600 --> 00:45:26,880 So, yeah, that's quite some strong precondition. 443 00:45:27,740 --> 00:45:35,600 So, I knew that send mail payload that I am using, uh, the C and the X, uh, arguments. 444 00:45:35,600 --> 00:45:38,020 That's definitely too long for us. 445 00:45:38,060 --> 00:45:44,080 So, I was like, okay, uh, the C arguments is, uh, loading arbitrary config file. 446 00:45:44,940 --> 00:45:46,900 Maybe that's enough to see. 447 00:45:46,900 --> 00:45:49,660 Maybe we don't need, uh, uh, X arguments. 448 00:45:49,660 --> 00:45:54,980 So, I decided to focus on that and see what is possible to, uh, send a config file. 449 00:45:55,600 --> 00:46:00,160 So, in the config file you have, like, the path to the dead letter file. 450 00:46:00,160 --> 00:46:06,820 So, the dead letter is like where it, with, it will log, uh, like, incidents in sending emails. 451 00:46:06,860 --> 00: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. 452 00:46:18,940 --> 00: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. 453 00:46:36,420 --> 00: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. 454 00:46:53,520 --> 00: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. 455 00:47:05,620 --> 00:47:10,180 So, then I'm sending the mail to not existent at localhost so it fails. 456 00:47:10,280 --> 00:47:12,140 So, that will bounce. 457 00:47:12,220 --> 00:47:16,080 So, that, uh, the, the, the config that I was using. 458 00:47:18,020 --> 00:47:25,560 So, I decided to have a look at the MyMainCodedWord and trying to, like, reduce the size of it. 459 00:47:26,060 --> 00:47:31,560 Uh, I was able to win some size like you can just empty the car sets. 460 00:47:31,560 --> 00:47:33,920 There is no need of, uh, filling it. 461 00:47:34,540 --> 00: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. 462 00:47:45,600 --> 00:47:51,200 Don't ask me why but we need, we needed to end it with, uh, two double cuts. 463 00:47:51,200 --> 00:47:52,760 I have no idea that's magic. 464 00:47:52,760 --> 00:47:55,420 I didn't investigate it that. 465 00:47:55,840 --> 00:48:01,220 So, we can definitely use the uppercase later now because we have the MyMainCodedWords. 466 00:48:01,420 --> 00: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. 467 00:48:17,320 --> 00:48:24,460 So, it's, uh, upper class and the final payload was just that. 468 00:48:24,860 --> 00:48:29,920 Don't ask me why that's a magic, uh, definitely some magic payload. 469 00:48:29,920 --> 00:48:35,940 I have now a t-shirt but it's my, in my hotel room with a payload printed on it. 470 00:48:36,000 --> 00:48:44,680 Uh, yeah, that's quite a unisex payload and it is to Prius SE on the top in very specific conditions. 471 00:48:44,680 --> 00: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. 472 00:49:07,040 --> 00:49:10,620 But, yeah, you need some Einstein's to explain that. 473 00:49:10,620 --> 00:49:15,800 So, definitely not, uh, not really a spot up in the right but still was quite fun technically. 474 00:49:16,400 --> 00:49:19,480 So, let's go for a demo. 475 00:49:19,620 --> 00:49:21,240 The last one. 476 00:49:22,700 --> 00:49:25,900 Uh, so, uh, once again, the question shop. 477 00:49:30,840 --> 00:49:40,460 I'm just uploading, uh, the send mail MTA default config file with just like or do two config keys. 478 00:49:44,340 --> 00:49:48,400 Yeah, doing the upload manually, sorry, it takes a bit of time. 479 00:49:53,880 --> 00: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. 480 00:50:04,880 --> 00:50:08,580 So, yeah, now the config file is uploaded. 481 00:50:08,580 --> 00:50:15,060 We can just run the payload in the from, uh, in the from email. 482 00:50:15,940 --> 00:50:19,060 That's exactly the payload from the, the slides. 483 00:50:19,060 --> 00:50:24,120 We're sending that to, uh, a local host address that doesn't exist. 484 00:50:24,120 --> 00:50:26,020 So, that should draw, draw an error. 485 00:50:26,020 --> 00:50:30,880 We see that the page is completed bank because that generated an error. 486 00:50:30,880 --> 00:50:35,440 So, now we can go to, uh, the slash back dot dot PHP. 487 00:50:35,440 --> 00: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. 488 00:50:45,180 --> 00:50:48,900 So, definitely quite cool. 489 00:50:49,240 --> 00:50:56,940 So, that was paid 5,000, uh, dollars despite the fact that it was, uh, hardly exploitable. 490 00:50:57,480 --> 00:51:00,780 Uh, made me cry a bit. 491 00:51:00,780 --> 00:51:02,780 I spent a lot of time on it. 492 00:51:02,780 --> 00:51:07,900 So, I hope your brain fried exactly, uh, like me. 493 00:51:07,900 --> 00:51:09,900 And that's my end word. 494 00:51:09,900 --> 00:51:12,660 So, uh, thanks for having listened to the end. 495 00:51:12,660 --> 00:51:13,460 Hope you had fun. 496 00:51:13,460 --> 00:51:15,100 Hope you learned some things. 497 00:51:15,100 --> 00: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. 498 00:51:24,300 --> 00:51:28,400 So, yeah, follow me on Twitter if you want some news and thank you.