start	end	text
0	11200	It is my absolute pleasure to introduce Jonas Cernica, who will be talking about Silent Leaks, Harvesting Secrets from Shared Linux Environments.
11200	12620	Take it away.
13840	15500	Thank you.
16380	21340	So, welcome to my presentation, Silent Leaks, Harvesting Secrets from Shared Linux Environments.
21340	23120	My name is Jonas Cernica.
23440	26660	So, for today, so I'm...
27320	31380	Okay, I was thinking I did an update, but it's okay.
31540	43380	I'm an application security engineer for UiPath, and also I'm an AI security researcher, bug bounty hunter, former CTF player, and former entrepreneur.
44040	54280	For today, I'll have a short introduction about multi-user Linux environments, how the process arguments are leaked through commands in Linux.
54420	61460	Then I'll speak about jailing and isolation systems, temporary file leaks, and a demo, and closing remarks, the conclusion.
62580	68420	So, multi-user Linux environments is where you have multiple users with unprivileged...
72740	75700	you are not privileged... you haven't... you don't have privilege...
77320	87620	privileges, and mostly you find in hosting panels, dev servers, education labs, providers, and CTF infrastructure, maybe.
87860	100920	The assumption you have no root privileges, and you don't have to do the local privilege escalation, you just have a basic user with maybe an SSH shell, access, or a web shell.
100920	104740	You can do both ways.
104860	114900	So, as an attacker goal, you have to discover secrets like database secrets, API keys, passwords, and other kinds of secrets.
114900	125080	Then you can fingerprint, you have to fingerprint the users or domain if you can do that, and then prepare for the lateral movement.
126780	134500	Process arguments leaks most of the time are leaked through this command, ps, which is a default...
135140	138000	is default for each Linux installation.
138460	153880	Sometimes I found that I can cut in the prox prox directory any bid, but in some situations, not all the situations, and you can use the big rep in the shared Linux environments, like web hosting providers and so on.
154800	158680	Why is this default behavior like you can use the command ps?
158900	179600	Legacy of transparency, so the Linux was designed to trust multi-user environments for university or shared labs, and it was a good debugging and monitor way to do it for tools, and in this case, just in this case, it wasn't a security, it was a priority of the security,
179600	186840	so it's about a backward compatibility changing this behavior would break many tools, as I said earlier.
187960	201200	I will not name affected providers in this presentation, because, yeah, I reported these issues in early of April this year, and I want to give them more time.
202080	208360	One of the providers did a very quick fix in a few days, and it was very proactive.
208360	214140	They told me not to put their name on the slides, but I can do the demo with them.
216040	222160	To act responsibly, so I choose not to give names about the providers, but most of them have problems.
222160	226240	You'll see in the examples, and then you'll see in the demo.
227140	233200	So let's run the command in Linux ps au xww.
233220	237140	It's au xww to take the full command and all the arguments.
237140	239740	That's why I choose this.
240900	255880	You have to run it in a loop to take each, I don't know, you can put, you can make a loop, which at 100 milliseconds you run this command and take the output.
256180	259460	And let's see some data.
259740	275680	In one of the hosting providers, when you run this from one of your users, so you have just to register as a user, you have your web access, your website, you have web access shell or you have SSH shell, I don't know, they can provide this to you.
275880	282400	Maybe most of you know about the web hosting providers, how it works and you get some SSH shell.
282400	288440	If not, there are ways to get to run system commands on the Linux.
288740	297880	So from another user I run the command that the ps au xww and I took this kind of information.
297880	317400	Another user like test one here, he was installing his newly website, it was about WordPress and in the command it was linked the user name of the newly WordPress install and the password here as you can see.
317480	322000	So it's easy to wait for new users and take their passwords.
322600	336760	On another web hosting provider, this command was run by root, I redacted the first part of the output of the command ps because you figure out which provider it would be.
336760	347380	But it was running by root and as you can see, the root is installing the new user test two and his password, this is the Linux user as you can see.
347380	352160	And he is creating the home directory, public HTML and so on.
352160	357860	So I can find his password on the leaked command arguments.
357940	368940	So you figure out already that most of them they put passwords and important data in the arguments of newly installed websites and so on.
369060	369920	Okay.
369960	377060	Here another case, another web hosting provider, he's running as root, this will be the demo at the end.
377700	391580	They run as root and they created the ‑‑ when I tried to ‑‑ to come back, the other two cases was about to wait for other users to come on the website and register.
391580	394800	This case, you can trigger this exploit by your own.
394800	397440	So you have to create a database backup.
397440	406320	We'll create this temporary directory which I will show you in another slide that you can leak this one because it's readable by any user.
406320	414660	You have to wait in the temporary directory and grab anything from there that is coming because this will be deleted in seconds, in milliseconds.
414920	421300	And as well you can see in the process arguments that you have the root MySQL and the password of the root user.
421300	425300	And you can grab all the databases from the hosting provider.
426620	434380	So he was doing a backup restore with the user root just to don't have any problems.
434380	440060	And he used the root user name to do the restoration.
440460	453420	In another case, I know that all these cases have similarities, but they do in a way or another they do differently.
453420	463240	So here he chose to run as root and put the database name, database user and the database password and you can leak it through other user.
464120	471680	As well in another case, again the root is installing the new database for a newly user from the web hosting panel.
472160	481060	He put here the database name, database user, database password and you can grab it very easy with your user.
481920	482560	Okay.
482560	497940	Now solutions for this would be to, I don't know, to install a new, to remount the proc directory so with high speed too, but it may break some tools and monitor debugging tools.
498200	505600	Also a lot of hosting providers they are using containers or like docker, but not a lot.
505600	516540	You can use the containerization, but I think it will cost a lot to do that, but most of the hosting providers they are using cage FS with cloud Linux.
516540	519900	But you'll see that you can break that too.
520560	520800	Okay.
520800	528860	Jailing and installation systems, most of the hosting providers they are using this first two, cage FS and cage root.
529040	549100	The others I didn't see, I did bug bounty on these problems and I found a lot of things, but most of the hosting providers which gives you the ability to look on their stuff and they have a public bug bounty program for their web hosting, they use cage FS or cage root.
549900	559140	So now bug bounty time, I used to have to use this information and make some money.
559900	577840	So escape, I used to escape the cage FS in a major hosting panel, but after I used that on their panel, I figured out that that escaping solution was working on all other hosting panels because it was a general problem.
578140	590900	So I cannot speak about this one because I sent this problem to the vendor, but he didn't give me any clue when this problem will be fixed.
590900	601310	I told them that I will speak at DEF CON about this problem, but maybe that's why they delayed the fix, I'm not sure.
601390	617770	So I was able to find the binary in the cage FS that was executing in the ‑‑ not in the isolation environment, in the Linux itself.
617770	620470	So outside the cage FS.
620470	626450	So I was able to read any file from most of the users, but I combined with another exploit for that.
628470	643910	Another way to create isolation was with chroot, and most of the chroot isolation they are using the file browser, which is a software written in Go.
643910	645250	Let me go back.
649420	651260	I'm not sure it's not ‑‑ okay.
651520	662940	It's a software written in Go and it's a UI interface for the file system, so the user that has a website can access their files through this file browser.
662940	675580	So I find an undocumented command on file browser to run commands, system commands, and that's how I escaped the chroot from one of the hosting panels.
676780	680900	Another problem was credential exposure via light speed.
680900	691400	Light speed is an optimization software for ‑‑ so when you create isolation environments, you have problems with ‑‑ I don't know.
691580	699060	You have problems that your websites can run much slower and so on.
699060	701540	So they created light speed for caching.
701540	706420	It's a caching technique for isolated systems for web hosting.
706660	712880	And the major hosting providers are using light speed because they have thousands of users.
713100	724720	And in a lot of bug bounties programs, I found that if you execute a script and then read the proc ‑‑ I'm not sure why it doesn't work anymore.
724720	725200	Okay.
725200	734400	If you read the proc self file descriptor number 2, you will read the STD error log file which is from all the users.
734540	739480	And I reported this on 31 March and they on 3 April light speed already fixed this.
739480	742220	That's why I can speak about this right now.
742320	754420	So what I found in bug bounty programs with this kind of problem, so I read that file and I find it was the full request like the response and the request that was sent to the server.
754420	774020	So there you can find user name, password, when cookie was set for web servers, you can grab the cookie and the domain where you have to use that cookie or the authorization tokens from PayPal or other websites domain.
774540	780180	So there were a lot of information in those files or gigabytes of files.
780180	786840	I just look for a few kinds of information and just to prove that it is a big problem.
787680	803600	Now I'll speak about temporary file leaks and poor file permission because when you install a new website or you are doing something on the disk, sometimes they create new files on temporary directories and those files are readable by anyone.
803600	824880	So here it's an example of hosting provider which when you install that software, you have in temporary file directory, a directory then a log where you can find all these passwords and you can take control over the hosting panel.
825540	827820	I report this it's already fixed.
827820	841300	They fix it in a few days but I didn't speak with them because they didn't want to show to speak their name to a conference.
842200	862480	Another example and this one will be in my demo, is when you are trying to create, to restore a database, you first create the restoration data, you first create the backup, then the backup will be named, will be placed on your space, on your public user.
862520	872800	But firstly when it's created, it will be sent in temporary directory then deleted from them and it will be sent, I don't know, via e-mail or something like this.
872840	882160	But if you, from another user, if you want to grab all these files, you can do it easily and you can read all the databases that are backup from the system.
883660	897120	In another bug bounty program, it was about not web hosting necessary but they didn't have, I didn't have access to the proc directory, the PS command as well.
897120	905560	It was very easily, it was very good, and it was very good isolated.
905560	913040	But I found that they were installed scripts for each user with their passwords and so on.
913040	918620	It was in a temporary directory under a random name and then main.php.
918620	927240	So it was exposing credentials like WordPress passwords and other kind of credentials, not just WordPress.
928080	928800	Okay.
930000	935240	Let me go on the first demonstration.
935720	937820	Oh no, this is not mine.
940880	944740	There are multiple,
948130	950890	I think it's this, yeah.
951590	965050	So in this demo it's about our panel which is a web hosting software, which right now I create a backup copy here.
965170	970890	I already, here, I already created the backup copy.
972910	992510	And after that, when the backup is created, now I'm going to my shell, I'm on the user A, there is the user B, and I run this command, the PS AAUXWW in a loop, and I grab the content at 100 milliseconds.
992590	1002450	So now I'll restore the database and let's see what I took from the output of the PS command.
1004870	1012390	So here is the whole output and now I look for the root password from my shell.
1015950	1018050	So here is the root password of my shell.
1019170	1021890	Let me show you here.
1022210	1041850	As you can see, I trigger a backup copy of my database, then I try a restoration of the database and when I read the output of the command PS, I find the root password of my shell and I can take all the databases from that web hosting software.
1047570	1048770	Here is it.
1049130	1060170	And as you can see, it has the temporary file with random name and you can grab it from another user, it's readable and so on.
1060230	1065850	Another example, it is for file leak, the second video.
1067830	1092530	So here, here is just when you install a new website, you create a new website, you'll do the, let's see, I'll cut everything that starts with temporary A, A, W, B, C, E, I and every file that starts with that name, I'll cut and redirect to another file,
1092530	1093750	to a dump file.
1095750	1097170	So let's see what's happening.
1097170	1104150	Right now I'm under the user A, so I try to hack the user B, which is the newly user created.
1108580	1115500	Okay, the dump file which was under the user A and let's see what's in there.
1115880	1121780	So we have data about the user B, the user password, the user B account and so on.
1121780	1124960	So you can easily take this kind of data.
1130650	1139680	Now, going back to my presentation, yeah,
1147980	1165440	as closing remarks, so multi-user environments are full of unexpected leaks and maybe sometimes are devastating and can take everything from your, you have to give like databases and passwords.
1165440	1172720	So security is not just about exploits, it's about assumptions, so don't make wrong assumptions about your system.
1173180	1186500	So tools like PS or PGREP are trusted because they are standard, but in shared environments you can see that are not so, they can have a lot of problems, you can have a lot of problems with them.
1187680	1189120	That's all, thank you.
