start	end	text
0	1960	Hello everybody.
2340	3560	Thanks to be here.
3560	5560	Thanks Defcon.
5640	14800	So um today uh we are gonna talk about uh some way to abuse uh Google cloud services.
15100	22980	In order to perform uh um some action in a context of uh red teaming operations.
25080	29980	Uh first of all uh let uh let me introduce myself.
30300	33020	My name is Valerio Alessandroni.
33260	39000	Uh currently I am an offensive security leader at UI Italy.
39000	44640	Uh my background is uh based on uh pentesting and red teaming.
46860	56060	So the first topic uh is uh um research I performed uh in 2023.
56060	58840	Which is called the Google calendar rat.
59720	74860	Uh that was uh that is a tool uh a post exploitation tool that abuses uh of uh uh Google calendar in order to use it as a command and control infrastructure.
76180	80920	Why I I developed this tool?
80920	91120	Uh first of all because I wanted to um reduce uh the time to set up uh command and control infrastructure.
91460	96020	And uh in order to to save uh to save money.
96240	104380	Uh I wanted to perform some creative way to bypass uh uh defenses mechanism.
104480	110160	And uh last but not least uh I wanted to have fun during the development.
111720	113300	How it works?
113300	114600	Pretty simple.
114780	119560	Google calendar is the middle man inside this schema.
120020	126040	Um you have uh uh an agent that you deploy on your target machine.
126060	131340	Uh the the original uh POC has been developed in uh in Python.
131400	141800	Uh with a polling mechanism um the agent uh and the attacker can communicate uh with the Google calendar in the middle.
142100	149580	And then you can establish uh connections and commands and receive the the output of those commands.
151420	155640	Uh I think it's stuck.
155640	156760	Okay.
157280	160760	So I released the tool in 2023.
160860	171960	Uh a few months later uh the Google cyber security action team uh mentioned the tool uh uh within the threat horizon report.
172380	181220	Uh um but the most important uh event that happened was about uh few months ago.
181220	183680	Maybe on April of this year.
183680	192680	Uh while um APD41 uh used uh a similar technique based on uh Google calendar.
192680	195120	But we will talk about it later.
198430	201810	So uh how it works?
201810	202810	Pretty easy.
202810	211810	Uh when you create uh an event on uh Google calendar you have uh two two fields that you can uh put your data on.
211810	214250	The title field and the description field.
215090	221750	Uh the title accept up to uh 1,024 characters.
221750	225190	And the description more than 8,000 characters.
225190	238770	So I ask myself why can't I use that in order to put data and create a communication channel uh exploiting Google uh Google calendar.
238770	258530	So uh I developed the the tool uh and the um the requirements uh to use it are the creation of a service account which is basically um uh an account that can take uh the control of your Gmail account.
258530	262750	Uh so you can use it inside uh a software for automation.
262810	267130	And you you have to enable the the API.
267130	269790	In this case the the Google calendar API.
270410	282090	Once you create uh a Google calendar um and you share with your accounts, you are ready for establish the communication.
283670	289230	So this is uh um the the POC of the tool.
289230	293650	On the uh left side there is the target machine.
293650	297150	On the uh right side uh the attacker machine.
297150	299370	So we are running the tool.
300310	305030	And uh it uh communicates directly with Google calendar.
305030	317170	For this example we will use the Google uh calendar web application interface uh in order to in order to send and receive the commands.
317330	334790	Uh we can see in the description field of the event uh on the left side uh uh the input command and right after with a pipe as a separator, the output that is uh base 64 encoded.
335810	350870	So you can see that uh it's pretty easy to use it and uh no direct connection between uh the attacker and the target uh uh is established.
353810	356870	Some security consideration.
358070	360590	You don't need an infrastructure.
360590	367170	So you can set up uh uh your environment uh in uh in few minutes.
367170	368850	You don't need to buy domain name.
368850	376170	You don't need to buy VPS uh and that's because you exploit the Google trust.
376710	382330	Uh as accounts uh Google is a single point of failure.
382330	391330	Because uh if an organization doesn't allow the traffic to Google uh it will it will it won't work.
394890	409490	Few months ago uh Google analyzed uh some APT 41 actions uh and they discovered that uh they were spreading a malware called tough progress.
411010	422650	Um I thank their effort for this uh research uh but I think they missed uh um a point.
422650	430030	When I released the GCR, the Google Calendar Router, I put an IOC inside the code.
430110	435810	Which was uh um hard coded data of for the event creation.
435810	439550	Which was set up on May 30, 2023.
439770	445630	And on the left image you can see the GSR, GCR sorry.
445670	448750	Uh events with that that date.
448750	453870	And on the right image the Google report.
453870	464070	So APT use the same the same data that's an in an indicator that uh tough progress uh is based on uh a Google Calendar Router.
466340	474180	Of course uh uh that is not the only tool that abuses uh Google Cloud.
474180	476300	There are multiple tool.
476320	478800	One of them uh is called GSR.
478800	489260	Is uh a tool I developed uh um some few months uh later the later I released the Google Calendar Router.
489260	494320	But all those tools has something in common.
494720	501320	They are limited to a synchronous uh request response uh communication model.
501320	508220	And uh you are not able to vehiculate to tunnel your own uh protocol.
509360	530380	That's why today I'm gonna release a new tool uh which uh allow you to tunnel uh your your uh favorite protocol uh within a SOCKS5 proxy server uh by using uh Google uh Google Cloud.
530680	534500	So the tool is called the GSSOCKS.
534500	537700	Is a post uh exploitation tool.
537700	542440	Uh this time I decided to use uh Go as a language.
542620	557060	And uh and uh set up a uh a uh a uh a uh a uh a uh a SOCKS5 proxy in order to vehiculate to tunnel uh every protocol by using proxy chains for example.
560980	564680	The mechanism is similar to Google Calendar Router.
564680	568100	Uh we have 2 2 parts.
568100	569240	2 entities.
569240	572680	The GSSOCKS client and the server.
572680	583940	The client stays on the attacker machine and the server uh is the is the agent that must be deployed on the on the target machines.
584160	594760	Uh this time I decided to use Google Sheets uh because it's the most similar uh service uh that functions as a database.
594840	601980	Um the client uh uh open a listener on port uh on a local port.
601980	604360	This case a 9191.
604380	611820	You can set up uh a proxy chains in order to send uh all the traffic through this port.
611880	615260	Uh traffic go over Google Sheets.
615260	622920	On the other side the server the agent uh read those information and send them to a proxy server.
622920	631460	And then you are able to reach uh every service uh that is uh reachable from the from the target machine.
633020	638660	So uh this is the the the Sheets model.
638660	643140	Uh we have uh some uh some columns.
643140	644400	The socket ID.
644400	649140	Uh a label to identify the client or the server.
649140	652920	Uh a time stamp and um and the payload.
656270	658230	So uh there are some limitations.
658770	674230	Uh for uh for the payload encoding uh I had to use base 64 which uh increase uh the overhead uh about of uh 33 percent.
674590	683670	And uh Google Sheets has uh a limit for uh a single cell of 5,000 characters.
683890	688490	So um the the first test of which is uh to uh to uh to uh to execute a command.
688490	691350	So I was using uh some common tools.
691350	692450	PSX sec.
692450	694870	PSX sec and secret dumps.
694870	699410	So common pen testing tools to uh for Windows exploitation.
699510	707610	And uh before the optimization uh PSX sec required about 20 minutes to execute a command.
707610	715610	While secret dump required uh 15 minutes to execute uh to to extract uh the the information.
715730	730590	So I opted my uh the the software uh splitting uh the the payload the the byte stream uh considering the limitation of 5,000 characters.
730590	739470	But the main improvement is uh uh the implementation of um uh rotational account system.
739470	746830	So after those uh corrections uh PSX sec required 2 minutes.
747870	750470	And secret dump uh just 1 minute.
750470	752430	So it's pretty usable.
754740	760320	Uh this is a demo of uh the execution of secret dump.
761160	767000	So um the agent is uh already deployed on a target machine.
767040	769520	Uh we won't see that uh here.
769760	778720	Uh we set up uh on the uh um right side top uh top right uh uh our client.
778720	785860	And we use the other virtual machine on the left uh uh running uh proxy chains uh and secret dump.
785860	787940	Secret dump over proxy chains.
787940	794780	And on the bottom right uh we can see the information transmitted through Google sheets.
801400	807380	So in a few seconds uh it will be completely executed and we'll read all the secrets.
815860	830520	For this uh example I used uh about uh 3 and 3 accounts on the client and 4 accounts uh on the on the server.
830520	833840	Due to the API quota limits.
834380	836220	So it works.
836220	844960	Everything has been executed and no direct connection has been performed for this exploitation.
848710	857290	If uh if you want to see the uh you try to analyze uh traffic of uh the agent of the server.
857290	865490	You'll see that only uh connection to Google infrastructure uh is established.
865490	877810	So it means that uh even uh uh we even um traffic inspection uh won't work against that.
877950	895470	Uh for the future I'm gonna analyze further um what can be done in terms of uh analysis but I will release on the uh repository page repository GitHub soon.
898520	900400	Google mitigation.
900400	908280	During testing uh I I encountered this message.
908280	913860	So I was testing and uh some of my account uh has been disabled.
913860	917500	So I say oh yeah uh Google catched me.
917600	920240	Uh but there is a button right there.
920240	921300	Start appeal.
921300	935980	And I I started an appeal and uh I was surprised that in less than 1 hour uh my account were fully restored so I continued my test and they have not been blocked again.
938260	939960	Thank you so much.
940280	944000	If you have uh any questions I'll be right there.
944600	952680	And uh for my friends, Italian friends uh for Sanaboly.
953280	954900	Thank you so much.
