WEBVTT

00:00.000 --> 00:01.540
Hey, this is Alex.

00:01.540 --> 00:02.560
This is Dan.

00:02.780 --> 00:05.040
And I got something really cool to talk about.

00:08.120 --> 00:09.680
How are you guys doing?

00:10.520 --> 00:12.000
Last talk of the day.

00:12.040 --> 00:15.180
Then you guys are going to go to bed right after this, I imagine.

00:17.060 --> 00:18.540
Thanks for coming out, guys.

00:18.540 --> 00:20.140
This is pretty exciting for us.

00:20.140 --> 00:21.400
My name is Alex Levenson.

00:21.400 --> 00:22.580
I've got Dan here.

00:22.860 --> 00:26.140
Today we're going to go through a tool that we wrote the agenda today.

00:26.260 --> 00:29.820
We're going to talk about droppers and stagers, as some of you might call them.

00:30.140 --> 00:32.760
Not really going to get pedantic about the terminology there.

00:32.980 --> 00:34.400
And how we kind of got here today.

00:34.400 --> 00:37.920
After that, we're going to go into this technology that we built and how it works.

00:37.920 --> 00:42.780
And we'll talk about some of the real world applications and then we'll give you a demo which will inevitably fail.

00:42.780 --> 00:45.080
But, you know, we'll see how that goes.

00:45.280 --> 00:47.400
First off, just an introduction for us.

00:47.400 --> 00:48.820
My name is Alex Levenson.

00:49.000 --> 00:52.640
I'm a senior security engineer at Uber.

00:52.800 --> 00:54.420
I've been there for a couple of years.

00:54.480 --> 00:57.380
My specialty is really in tool development and red teaming.

00:57.620 --> 01:04.380
I am a core red team member at the national CCDC and also the western regional CCDC as well.

01:04.680 --> 01:05.640
Thank you.

01:06.600 --> 01:07.760
Hey guys.

01:09.340 --> 01:10.520
I'm Dan Borges.

01:10.520 --> 01:12.880
I'm a senior red team operator and dev.

01:13.420 --> 01:17.200
I also partake in national CCDC on the red team.

01:17.480 --> 01:20.580
And Alex and I play a lot of cyber competitions together.

01:20.800 --> 01:23.000
So we're just here to show you some of our cool tools.

01:23.580 --> 01:25.680
So we got to go back a little bit.

01:26.600 --> 01:31.100
We are going to talk about what is a dropper, what is this classification thing we're talking about.

01:31.420 --> 01:35.780
In our little hyper local kill chain right here, we have an exploit.

01:35.780 --> 01:37.060
This is your initial vector.

01:37.060 --> 01:39.000
This is how you're getting on the server.

01:39.360 --> 01:42.040
This is usually like a memory corruption attack, something like that.

01:42.120 --> 01:44.280
Next attackers usually move to some kind of stager.

01:44.280 --> 01:46.960
This is moving from memory to their next tool.

01:47.320 --> 01:50.400
Often this can reach out and download more shell code, do something like that.

01:50.680 --> 01:53.040
And then this is really where we're going to focus on.

01:53.040 --> 01:55.040
This is your stage one.

01:55.040 --> 01:57.220
Some people call it the stage one, the stage two.

01:57.220 --> 01:58.020
This is the dropper.

01:58.020 --> 02:01.300
You're moving from your exploit to bringing over your tools.

02:01.300 --> 02:03.660
This is what's going to bring over your malware.

02:03.660 --> 02:08.020
It's going to put your persistence on the box, your deep slow stuff.

02:08.220 --> 02:09.880
And then finally you have your own malware.

02:09.880 --> 02:15.040
These are your custom applications, maybe your specific TTPs that you want to put on a box.

02:15.180 --> 02:23.540
And again, using a dropper here is important because you can protect your TTPs, your tools and tactics and procedures by using the dropper.

02:24.040 --> 02:25.540
So where are droppers used?

02:25.620 --> 02:28.380
We're trying to emulate what we see in the wild.

02:28.400 --> 02:37.400
What we see is a lot of third party crime where people use these exploit kits and then between the exploit kit and their own private malware, they'll usually lever some kind of dropper.

02:37.460 --> 02:45.740
They can do this as a form of packing to either bundle it with other executables or just as a way to get their malware on to the system.

02:46.260 --> 02:50.600
We can also use a dropper to be contextually aware and have contextually aware implants.

02:50.680 --> 02:52.080
This is kind of like Stuxnet.

02:52.140 --> 02:54.380
Do you want to land on this system?

02:54.380 --> 02:55.880
Do I want to deploy my payload?

02:55.880 --> 02:57.740
Sometimes you don't want to infect this host.

02:57.740 --> 03:02.720
That's a good thing for a dropper to say and back off and not put the malware down.

03:02.780 --> 03:05.720
We use it a lot in our red team operations for CCDC.

03:05.720 --> 03:07.200
We like to go fast and hard.

03:07.380 --> 03:10.780
This is the perfect tool for us to lay on the pain fast.

03:11.820 --> 03:14.760
So a little bit of history about how we arrived here.

03:15.560 --> 03:19.820
Back in the day on the CCDC red team, all these people would be bringing these super cool kits.

03:19.820 --> 03:21.360
We'd have really advanced techniques.

03:21.360 --> 03:25.760
And they'd be going against a single team and they'd be using this technique on this team.

03:26.240 --> 03:30.380
And what we wanted to do is we wanted to apply this pain to everybody equally.

03:30.380 --> 03:41.100
So we started wrapping it in shell scripts, in PowerShell, bash and all these great techniques to really just kind of drop six, seven implants, up to ten on a single team.

03:41.100 --> 03:44.640
So now each team is not getting just one implant made specially for them.

03:44.640 --> 03:46.960
They're getting all ten implants we made for everybody.

03:47.020 --> 03:48.180
So we can really share.

03:49.880 --> 03:54.240
And then around 2015 , 2016, we moved to these, like I said, these scripts.

03:54.240 --> 03:55.680
But they started to have drawbacks , right?

03:55.680 --> 03:59.360
They had like forensic drawbacks, right?

03:59.360 --> 04:05.260
People could find the scripts on the systems , PowerShell script lock logging and they could tell exactly what we were doing.

04:05.260 --> 04:08.600
They could get our source code, which was pretty dangerous for us as operators.

04:09.640 --> 04:15.380
So in late 2016, early 2017, we moved a lot of our tool chain to Golang.

04:15.460 --> 04:19.940
We did this for a number of reasons, mostly because you get natively compiled executables.

04:19.940 --> 04:24.060
So you can get a binary that runs specifically on an architecture.

04:24.520 --> 04:26.240
This means you have to disassemble it.

04:26.240 --> 04:29.300
It's hard to decompile, which means you can't get that source code back.

04:29.300 --> 04:31.120
It's difficult to reverse.

04:31.420 --> 04:35.440
And while we were doing this, we also started looking at what is a dropper?

04:35.460 --> 04:38.280
This had all of our tactics built into it.

04:38.280 --> 04:45.420
And we really wanted to say, let's abstract our specific techniques out and make a pure dropper that we can put any technique into.

04:46.260 --> 04:57.700
And at 2017 at a national CCDC, we had a few friends, Virus, Lucas, and they put together this thing called Genesis, where we had an SMB share, and you could just drop binaries in it.

04:57.700 --> 05:00.880
And we bundled them all into one executable and ran it on the disk.

05:00.880 --> 05:03.160
It would run everything you put into the SMB share.

05:03.160 --> 05:04.440
Just a native executable.

05:05.120 --> 05:06.180
This was really cool.

05:06.180 --> 05:07.060
This was really good.

05:07.060 --> 05:08.500
But it had a few drawbacks.

05:08.620 --> 05:14.300
Instead of just running everything together, we wanted to specifically instrument them in a certain way.

05:15.020 --> 05:25.920
So I think it was late 2017 into the 2018 CCDC season, Alex started working on this prototype of G script, the Genesis scripting engine, which we'll get to.

05:26.120 --> 05:26.840
And we used it.

05:26.840 --> 05:29.040
We used it all through this last CCDC season.

05:29.040 --> 05:30.300
It was really successful.

05:30.340 --> 05:32.700
We dropped it on every single team at nationals.

05:32.700 --> 05:33.980
Everybody felt the pain.

05:34.280 --> 05:40.740
And then between then, which was April 2018 and now, we've added a ton of cool new features.

05:40.740 --> 05:42.120
Like really sweet stuff.

05:42.120 --> 05:43.560
And that's what we're going to get into today.

05:45.140 --> 05:45.700
Woo!

05:45.700 --> 05:46.720
Thank you, Dan.

05:47.140 --> 05:56.200
Yeah, as Dan said, today we are going to show the world, you guys, the awesome information security community that we're part of.

05:56.480 --> 06:05.320
Basically what we've done cumulatively over the last several years, but also some really awesome features that even if you were at CCDC, you really didn't get a chance to play with.

06:05.320 --> 06:10.740
But from now on, I'd like to introduce the Genesis scripting engine, or as we call it, G script.

06:11.360 --> 06:12.680
What is G script?

06:12.680 --> 06:14.140
Dan covered sort of this thing.

06:14.140 --> 06:15.140
It's this dropper.

06:15.140 --> 06:19.740
It lets us take malware and bundle it together and tape it up in a big ball and throw it at somebody.

06:20.380 --> 06:21.660
Great, that's a good explanation.

06:21.660 --> 06:22.480
But how do you use it?

06:22.480 --> 06:24.840
What does it look like to you as the red teamer?

06:25.120 --> 06:26.500
It's really easy.

06:26.560 --> 06:28.020
You have your payloads.

06:28.060 --> 06:29.760
You write a script for your payload.

06:30.000 --> 06:32.900
You use the G script compiler on the command line.

06:33.000 --> 06:34.560
You get out a native binary.

06:35.120 --> 06:37.220
It couldn't be more simple than that.

06:37.560 --> 06:39.900
I use this all over our documentation.

06:39.900 --> 06:45.780
G script is a framework that allows you to rapidly implement custom droppers for all three major operating systems.

06:46.580 --> 06:51.140
So let's talk about what makes up G script, right?

06:51.140 --> 06:53.180
So first off, there's the engine.

06:53.400 --> 07:03.900
The engine is the thing that is inside of that native binary that you made that actually runs and executes the logic that you've specified in your script.

07:04.000 --> 07:05.320
There's the compiler.

07:05.320 --> 07:10.320
The compiler takes your script and turns it into that native binary.

07:10.440 --> 07:16.560
There's an obfuscator that's hooked into the compiler that we wrote to try and make it a little bit harder for you blue team folks out there.

07:16.980 --> 07:20.600
We really do like you, but, you know, we want to make you mad sometimes.

07:21.460 --> 07:22.920
We've got a standard library.

07:22.920 --> 07:25.800
These are functions that you can use inside of your Genesis scripts.

07:25.880 --> 07:27.260
We've got a command line tool.

07:27.260 --> 07:29.820
That's how you interact with the compiler and other things.

07:29.820 --> 07:38.300
And we also have an interactive debugger to help you develop these scripts in a more reliable way, let you test them out ahead of time so you're not doing stuff live.

07:38.840 --> 07:41.140
A high level walkthrough, here's what happens.

07:41.780 --> 07:56.280
When you use the compiler and that three step process we just showed, what ends up happening very first is the compiler goes and creates essentially representations of engines within memory for each of the scripts that you pass into it.

07:56.280 --> 08:11.120
The next thing it's going to do is every one of the payloads that you gave into it, we'll have an interpreter payload, we'll have some shell code, we'll have some, you know, SSH keys that we're going to drop somewhere, it encrypts and embeds them directly into that virtual machine that it's got in memory.

08:11.300 --> 08:14.720
After that, it's going to take all in number of virtual machines.

08:14.720 --> 08:17.860
Remember, it has a virtual machine isolated for each script.

08:17.960 --> 08:21.940
It's going to take all in number of those and it's going to sew it all together.

08:21.940 --> 08:27.700
It's like with needle and thread into an actual executable for whatever platform you're targeting.

08:27.940 --> 08:36.200
And then when that executable is run, that main that it sewed up together is going to launch every one of those run times in parallel.

08:36.820 --> 08:39.160
So let's do just a quick, quick walkthrough.

08:39.160 --> 08:40.940
You all know what, thank you.

08:41.360 --> 08:47.820
So a quick walkthrough of this, just to kind of hopefully illuminate you guys on how easy this is to use.

08:48.080 --> 08:49.840
So I've got a little example here.

08:50.100 --> 08:54.320
The example isn't, isn't crazy, it's really simple.

08:54.540 --> 08:56.780
So we're going to write a script, it's eight lines.

08:56.940 --> 08:59.240
There's some important things to note in this, though.

08:59.240 --> 09:09.740
It looks like JavaScript, for all intents and purposes it is JavaScript, we've sprinkled some syntactic sugar in the form of comment macros, so compiler macros that you see in the very first line there.

09:09.740 --> 09:17.520
That import statement is telling the G script compiler, I want you to import this file off my disk when we go to bundle this together.

09:17.920 --> 09:22.560
The next line, line three, is just a normal variable declaration like you would call in JavaScript.

09:23.020 --> 09:26.300
And then lines five through eight there is a function called deploy.

09:26.660 --> 09:37.960
Now when I talked before about when you run main, it launches all those virtual machines, the JavaScript VMs essentially need an entry point to launch when that happens, that's what it launches.

09:37.960 --> 09:39.740
It launches the deploy hook.

09:39.960 --> 09:46.300
So every one of your G scripts, no matter what you're doing in it, will always have a function deploy with something defined in it.

09:46.300 --> 09:48.060
What's defined in ours here?

09:48.180 --> 09:59.500
We get the payload dot text, the data that was in that file, we get it as a string called payload data, and then we write that to the destination file which we defined in line three.

09:59.900 --> 10:03.880
So very quick, very easy G script that anybody can write.

10:04.400 --> 10:07.980
But hey, this is not just for one script, this can be for multiple things, right?

10:07.980 --> 10:09.320
So let's write another one.

10:09.480 --> 10:10.500
What's this one doing?

10:10.500 --> 10:15.500
It's simply writing a file, second underscore file dot text with the string rect.

10:16.540 --> 10:17.780
So what do we do now?

10:17.980 --> 10:24.920
Step three, just use the compiler, one command, G script compile with an output file, star dot GS.

10:25.000 --> 10:29.280
GS is our file extension for G script.

10:30.640 --> 10:31.540
That's it.

10:31.540 --> 10:32.620
And what did we get?

10:33.220 --> 10:35.860
At the top, we got dropper dot bin.

10:36.040 --> 10:37.480
What is dropper dot bin?

10:37.480 --> 10:41.140
It's a 64 bit Mocko executable, I'm doing this on OSX.

10:41.900 --> 10:46.200
What else is in ‑‑ I run it on the bottom of the first box there.

10:46.440 --> 10:47.720
And then what happens?

10:47.720 --> 10:52.360
All of a sudden you see desk dot text and second file dot text in that directory.

10:52.420 --> 10:53.220
What's in those?

10:53.220 --> 10:56.520
Exactly the contents that we had placed in them initially.

10:58.100 --> 11:00.200
All of you guys seem pretty quiet.

11:00.200 --> 11:01.360
Was that too easy?

11:02.080 --> 11:03.140
Thank you.

11:03.900 --> 11:04.540
All right.

11:04.540 --> 11:05.860
So let's just talk about that.

11:05.860 --> 11:09.980
That seemed, you know, why couldn't you do that with PowerShell or shell script or something like that?

11:10.160 --> 11:12.660
Well, first off, you're getting a native binary.

11:12.900 --> 11:17.620
You're getting a native binary that I could have written the first script, Dan could have written the next one.

11:17.700 --> 11:22.100
And if Dan messed his up or I messed mine up, it's not going to take down the entire binary.

11:22.100 --> 11:23.440
It's going to keep executing.

11:23.440 --> 11:27.560
That's the whole point of this is to be robust and resilient in the case of failure.

11:27.560 --> 11:39.840
When you do these large scale red team ops and you have many people contributing code, you don't necessarily have the luxury of constantly testing to make sure that somebody's payload isn't going to mess up something in your process.

11:39.840 --> 11:48.780
So we really wanted to give the people writing the payloads the ability to come up with their logic on how they wanted this to be bundled in to the actual final binary.

11:48.780 --> 12:00.420
So you've got your native binary, you've got your isolated G script engines, you've got the user defined logic in those scripts that is actually encrypted and embedded just like the assets are into the binary.

12:00.800 --> 12:03.620
And then you've got the embedded assets in their payloads.

12:03.700 --> 12:08.460
Those all get bundled together into one container inside of your native binary.

12:09.120 --> 12:11.260
So let's talk about some of the features here, right?

12:11.460 --> 12:16.000
So first off, number one feature we saw was that you get to do this in JavaScript.

12:16.260 --> 12:26.120
Now, I'm not a JavaScript developer, but I think that we need to be making tools that are as easy for the broadest selection of us to use, right?

12:26.120 --> 12:31.460
So I know a lot of people in here probably see programmers, a lot of people in here do a lot of low level stuff.

12:31.460 --> 12:34.280
I wanted to make something common that people were familiar with.

12:34.280 --> 12:36.360
There's a lot of people that do web pin testing.

12:36.460 --> 12:40.860
JavaScript seems pretty familiar right now to a lot of people, so let's just go ahead and go with that.

12:40.940 --> 12:45.840
So it's easy to write, it's easy to learn, there's good documentation on how to write JavaScript well.

12:45.920 --> 12:47.820
Next thing is it's resilient to failure.

12:47.820 --> 12:51.920
As we talked about, if script 2 failed, script 1 would have kept on going.

12:52.540 --> 12:54.740
Third, it's highly customizable.

12:55.140 --> 13:03.660
So things like order of operations of your script, timeouts, all of the stuff you can customize with those compiler macros that we showed you, right?

13:03.660 --> 13:06.220
We showed you one, but there's many more you can go with.

13:06.380 --> 13:07.800
So how is this cross-platform?

13:07.800 --> 13:09.020
It's written in Go.

13:09.700 --> 13:19.420
Essentially, this whole thing is sort of leveraging the power of the Go compiler to make cross-platform malware for anybody to be using here.

13:19.720 --> 13:21.380
Number 5, it's secure.

13:21.500 --> 13:28.660
We ran into this at CCDC where we had our droppers essentially be reverse engineered very easily by just looking at the PowerShell logs.

13:29.080 --> 13:35.380
I'm excited to release this today because I'm excited to see how hard it is for somebody to actually reverse engineer one of these binaries.

13:35.380 --> 13:36.340
That is a challenge.

13:36.340 --> 13:36.980
Let me know if you do.

13:36.980 --> 13:38.100
I'd love to see it.

13:39.000 --> 13:47.020
And the number one thing that is new to anybody who has seen Genesys in the past is now you can actually call native Go from within your JavaScript.

13:47.360 --> 13:48.280
We'll get into that.

13:48.280 --> 13:49.960
I know that sounds kind of wacky.

13:51.160 --> 13:57.020
So we talked about this initially, but this diagram kind of gives you a little bit more context as to what happens.

13:57.400 --> 14:00.080
You've got your main of your final binary.

14:00.080 --> 14:07.240
And when that gets run, you have all of these engines that are in their own isolated namespace essentially get created.

14:07.240 --> 14:10.060
They initialize the JavaScript virtual machine within them.

14:10.060 --> 14:16.040
They inject the scripts, all the assets and any libraries, native Go libraries that you've called into it.

14:16.040 --> 14:20.680
And then it calls that deploy function, that entry point, if you will, on each of those.

14:20.680 --> 14:25.200
And that happens pending any custom order of operations with your macros.

14:25.200 --> 14:27.000
That happens all concurrently.

14:27.200 --> 14:29.480
So what does Gscript really let you do?

14:29.480 --> 14:38.360
It lets you focus on what your stager is doing, not how am I going to implement this for OSX even though I don't really know OSX or Windows or Linux.

14:39.480 --> 14:42.240
So this has been a process for us, right?

14:42.240 --> 14:50.480
I'm not a computer science, you know, master's student who's studied the deep internals of how software is made.

14:50.480 --> 14:52.760
I would like to say I was, but I definitely wasn't.

14:52.760 --> 14:56.580
I started to take an operating systems class in college and I was way over my head.

14:56.980 --> 14:59.100
So this has been a learning experience for me.

14:59.440 --> 15:03.960
And this is sort of some of the technology that I've figured out and implemented here within Gscript.

15:03.960 --> 15:07.260
So when you go to do a compile, what happens?

15:08.140 --> 15:14.440
Straightforward, the first thing that happens is it looks through all your scripts and gets a essentially a mapping of all the macros that you've defined.

15:14.660 --> 15:26.980
The next thing it's going to do is it's going to walk the abstract syntax tree of your JavaScript, notating things like, oh, you imported a Go library with this macro and then you called it down here.

15:27.120 --> 15:30.600
And registers, you know, things like how many arguments are you calling with it?

15:30.600 --> 15:32.440
What might the type be?

15:32.440 --> 15:34.640
What can I infer the type might be of that argument?

15:34.880 --> 15:39.880
It then goes through all the Go packages that you've included in that as well and does the same thing.

15:39.880 --> 15:45.200
Walks all the AST there looking for places where functions are defined that you've called from your JavaScript.

15:45.920 --> 15:48.740
Next, it's going to start marrying those together.

15:48.840 --> 16:03.040
It's going to essentially create foreign function interface wrappers in Go on the fly for all of the functions that you've called in JavaScript that are instrumented in native Go so that you're, and then inject those into the VM that we're bundling itself together.

16:04.300 --> 16:11.360
That's a probably another three talks worth of material to get into, but if you'd like to, it's definitely on GitHub, you can go check it out.

16:11.800 --> 16:15.240
After that, we embed all the assets, we encrypt them.

16:15.240 --> 16:20.360
Each VM has its own encryption key that all the assets get embedded with.

16:20.540 --> 16:25.800
And the assets themselves don't actually get decrypted until you call them within your script.

16:25.800 --> 16:30.940
So until you retrieve the asset, the asset isn't sitting in memory unencrypted.

16:31.440 --> 16:36.160
And then the final step, optional, but we do enjoy it, is the obfuscation step.

16:36.160 --> 16:40.640
So we do the obfuscation both before and after native compilation.

16:41.120 --> 16:45.240
And we've got some interesting stuff we'll kind of cover as to how that works there.

16:45.500 --> 16:48.340
So creating these standalone executables, right?

16:48.600 --> 16:49.940
How do we go about doing that?

16:49.940 --> 16:52.500
Well, I said we leverage the Go compiler to do that.

16:52.600 --> 17:09.720
Now, what's interesting about this is, if you can kind of see up here on this, on the picture, we take your scripts and payload, and we actually write out an entire Go program that contains the logic and everything needed that we just covered it into this Go program.

17:09.720 --> 17:11.340
Now, there's flags in our compiler.

17:11.340 --> 17:14.000
You can go look at that code and see what that looks like.

17:14.000 --> 17:15.740
It's incredibly unreadable.

17:16.180 --> 17:19.300
We needed to make it that way for security, right?

17:19.900 --> 17:28.120
But it's been a really interesting thing to consider that, you know, we're in a place in time where it's no longer enough to just write malware.

17:28.120 --> 17:32.120
You have to write code that writes code that writes your malware, right?

17:32.960 --> 17:36.320
So we talked about this before, too, and now I want to dive into this.

17:36.320 --> 17:38.420
Linking JavaScript and native Go.

17:39.260 --> 17:43.020
I was called crazy a couple times in the process of this.

17:43.020 --> 17:44.680
This was definitely one of those.

17:45.000 --> 17:46.580
And I still think it might be crazy.

17:46.580 --> 17:52.260
It's probably not the safest thing you can be doing in the world, but it is crazy.

17:52.260 --> 17:52.960
Thank you.

17:55.380 --> 17:56.980
It's an interesting thing, right?

17:56.980 --> 18:01.980
You've got two languages on completely opposite ends of the spectrum in terms of how they work.

18:02.240 --> 18:13.540
And figuring out a way for a user to almost not know the difference between them is a fascinating endeavor for me and Dan for us to kind of implement this and somebody in the back who shall remain nameless.

18:15.220 --> 18:17.020
So here I've got a little example, right?

18:17.020 --> 18:20.420
So we use the Go import macro, the compiler macro we talked about.

18:20.800 --> 18:22.320
We're going to import Redis.

18:22.580 --> 18:30.000
We're going to import Redis because as far as I know, other than Node.js, there's really just not an easy Redis library for JavaScript.

18:30.000 --> 18:31.440
There certainly isn't one for G script.

18:31.440 --> 18:33.720
You can't import Node.js modules into this.

18:33.780 --> 18:37.140
So how are we going to interact with Redis and G script?

18:37.140 --> 18:40.160
We're going to import the Go package for Redis.

18:40.160 --> 18:41.700
So we import that.

18:42.660 --> 18:45.980
And from there, you import it, as you see there, as Redis.

18:45.980 --> 18:53.080
That as blank, blank is equal to the namespace within the JavaScript program that you're defining here in your G script.

18:53.340 --> 18:56.040
So on the next one, I call the functions directly.

18:56.040 --> 19:02.540
So Redis.parseURL is actually a exported function within that Go package.

19:02.560 --> 19:04.920
And I can call it just like I would in Go.

19:05.640 --> 19:10.840
Now, one thing to note, there's no multiple assignment in JavaScript.

19:12.080 --> 19:14.900
We're in ES5, not ES6.

19:14.900 --> 19:17.880
So in this version, there's no multiple assignments.

19:17.880 --> 19:21.580
So if you look on line 5, you'll see R0.

19:21.820 --> 19:38.360
R0 is because in our linker that we do, when we see that you're calling a Go function that's returning multiple assignment, we actually make a dynamic array of that and give you back the return of that inside a single object that is an array of various types.

19:38.360 --> 19:44.200
So R0 in that is going to actually be the Redis client, the Redis connection URL.

19:44.720 --> 19:47.040
So line 5, we create a Redis client.

19:47.040 --> 19:52.380
And line 6, we simply interact with it as we would any Go program, right?

19:52.380 --> 19:57.600
And then down there, you look at the script, we compiled it normally and ran it and boom.

19:57.940 --> 20:03.580
Got the, was able to interact with Redis right from G script using this native bridge.

20:04.140 --> 20:14.620
So I wouldn't give you something incredibly, incredibly unsafe without some way to at least play around with it and see how it worked and test your stuff, right?

20:14.620 --> 20:17.780
So we spent a lot of time on an interactive debugger.

20:18.480 --> 20:20.080
It's pretty nice and easy to use.

20:20.080 --> 20:27.460
So at any time after you've installed G script, you can simply do G script shell and it will drop you into a REPL right there.

20:27.580 --> 20:31.420
The REPL has the entire standard library which we'll get into bundled into it.

20:31.660 --> 20:33.720
And you can do kind of some various things.

20:33.720 --> 20:35.840
So for example, we talked about macros.

20:35.840 --> 20:39.500
How do you get a macro into the shell when it's something the compiler knows?

20:39.500 --> 20:44.060
Well, in G script shell, you can just pass the dash into it with macros.

20:44.060 --> 20:46.700
You can pass multiple as many as you'd like into it .

20:46.700 --> 20:54.100
And then when it drops into that shell, it says if you've dropped into the deploy function with that VM instrument.

20:55.000 --> 20:58.160
Other things you can do is you can step through your code.

20:58.160 --> 21:10.940
So in this, you can see that I'm essentially doing the exact same thing that we were in the previous demonstration of the native linking except now I've got some functions that as I'm stepping through help me understand a little bit more about what's going on.

21:10.940 --> 21:16.400
So the function type of, you can see is the third function I'm calling there.

21:16.400 --> 21:23.600
It's actually showing me that under the hood in JavaScript, this is actually a pointer to a Redis client object in Go's namespace.

21:25.060 --> 21:29.520
And that's a pretty nice thing to have to be able to use here as well.

21:29.520 --> 21:44.900
Also, any time you're in a script, if you want to compile your binary for yourself but then be able to drop into a debugger, we have a compiler flag enable debugging and you can just use the function debug console just like you would debugger in Chrome or anything like that.

21:44.900 --> 21:50.200
And when you run your binary, it will drop you into the same console right where you're at in the context of your script.

21:51.060 --> 21:57.280
Outside of that, as I mentioned before, type of, we have a bunch of specialty functions that are only available from within the debugger.

21:57.820 --> 22:06.380
That's been something we've expanded on in the last several weeks to try and make the native linking a lot more easy for people to do.

22:06.760 --> 22:08.280
Another one is symbol table.

22:08.280 --> 22:17.180
So you can call the symbol table function in the interactive debugger and that's actually going to go through and show you all the functions within Go's namespace that you've imported in there.

22:17.180 --> 22:19.900
Our standard library is actually instrumented in Go.

22:19.900 --> 22:21.820
You don't have to import it as a Go module.

22:21.820 --> 22:25.120
The compiler is smart enough to know, oh, you're calling a standard library function.

22:25.120 --> 22:26.540
I need to link against that.

22:27.280 --> 22:29.700
So we talked about how cool it is.

22:29.780 --> 22:33.240
There are some limitations and we'll just get these out of the way real quick.

22:33.480 --> 22:35.860
First thing, no free VSD support.

22:36.100 --> 22:42.820
I know that some of you neck beards in the crowd, I'm looking front row here, are going to be real upset about that.

22:43.460 --> 22:46.500
But I don't think it's impossible.

22:46.500 --> 22:51.520
It's just something where it was on a medium priority list for us to go and get done.

22:51.520 --> 22:58.800
I think as Go becomes more free VSD compliant in things like its OS and user lib, we'll be able to extend support to this as well.

22:59.040 --> 23:04.640
One of the other limitations that kind of people I've seen have issues with is these are large binaries.

23:04.640 --> 23:11.920
If you've ever worked with Go before, you know that Go binaries are never known to be the smallest, tiniest payloads in the world.

23:12.460 --> 23:15.020
Another limitation is the regular expressions.

23:15.020 --> 23:23.240
If you're going to do any regular expressions in JavaScript, they need to be essentially compliant with the RE2 library that Go uses.

23:23.320 --> 23:28.100
So things like look ahead and stuff like that, you're not going to have compatibility in that.

23:28.100 --> 23:29.100
So you've got to be careful.

23:29.100 --> 23:31.840
You can't use crazy complex regular expressions in it.

23:32.800 --> 23:35.840
Another thing that's been kind of difficult for us has been versioning.

23:36.340 --> 23:42.540
Go's versioning story has not been the greatest part of the language as it's evolved over the years.

23:42.700 --> 23:46.760
And that made it hard for us to do things like lock you into a specific version of it.

23:46.760 --> 23:56.880
So as Dan and I have done this, Dan will go write a bunch of G scripts and I'll come around and make a compiler change that will break all his scripts and he'll be like, oh, why can't I still stick with the old version?

23:57.220 --> 24:00.700
Well, a lot of that has been tied to this Go versioning problem.

24:00.760 --> 24:06.060
In the future, Go is releasing in 1.11 their new Go mod support.

24:06.260 --> 24:16.120
I think in the next major version of G script will actually release with an ability to lock your engines to a specific version of G script and be able to have backwards compatibility.

24:16.520 --> 24:20.240
As we said before, ES5 is the only thing we support right now.

24:20.240 --> 24:25.380
Working on ES6 support, there's complicated reasons why that's difficult for us.

24:25.380 --> 24:31.260
But something we'd like to do as we talk to people that write a lot of JavaScript, they seem to think that would have been a really nice feature for us.

24:31.260 --> 24:32.480
So we're working on that.

24:33.020 --> 24:38.060
Also something that we don't have is a lot of the JavaScript concurrency primitives that you guys might be used to.

24:38.420 --> 24:40.680
Just like in ES6 you have async.

24:40.680 --> 24:42.380
We don't have that stuff right now.

24:42.380 --> 24:50.640
Because our virtual machine is actually instrumented in native Go, we have to do all of this concurrency actually outside of that virtual machine's namespace.

24:51.320 --> 24:54.320
But as I mentioned before, we have the standard library.

24:54.320 --> 24:59.020
You don't need to be a Go programmer to know how to use this on a basic level.

24:59.400 --> 25:04.980
We've got libraries that cover almost every type of basic OS functionality you'll need.

25:04.980 --> 25:06.840
They're entirely cross platform.

25:07.020 --> 25:08.320
They're supported by us.

25:08.320 --> 25:11.320
If there's ever a bug in one of these that you find, please file it against us.

25:11.320 --> 25:12.860
We will fix it immediately.

25:13.260 --> 25:28.600
It is exactly the type of stuff where as we sat down and used G script in our jobs and at CCDC, we were able to say, there's some parts of Go that are just complicated and maybe not straightforward for the normal person.

25:28.600 --> 25:35.140
So let's just go kind of wrap that basic functionality in our standard library and present that to users for ease.

25:35.880 --> 25:37.560
So with that, I'm going to hand it back to Dan.

25:37.560 --> 25:43.400
Dan's going to talk about some of the ways that we've used this in the real world and why it just has really been powerful for us.

25:46.390 --> 25:53.110
So like Alex was saying, one of the number one reasons we use it is because we encounter a wide array of systems.

25:53.270 --> 25:55.090
Windows, Linux and Mac.

25:55.090 --> 25:59.430
And we didn't want to keep rewriting our techniques for these different operating systems.

25:59.430 --> 26:00.710
It was really kind of a pain.

26:00.890 --> 26:03.210
So we really like the cross platform features of it.

26:03.210 --> 26:15.530
You can actually write G scripts completely system, you can write them completely cross platform where the binary itself will determine which operating system it's on using Go and then execute according to that.

26:15.530 --> 26:18.850
Obviously you have to compile it to a specific architecture.

26:19.010 --> 26:21.190
So at the compilation time, there's always that.

26:21.190 --> 26:25.270
And when you're embedding assets, you still need to embed assets that can run on that specific architecture.

26:25.450 --> 26:27.370
But the platform itself is cross platform.

26:27.370 --> 26:28.290
So I love that.

26:29.190 --> 26:31.070
It's also really easy to use.

26:31.150 --> 26:38.930
Originally we were considering like having people write the Golang for that original Genesis dropper and then use that to embed their stuff.

26:38.930 --> 26:42.750
And it was a really hard kind of ask for people to learn Golang.

26:42.750 --> 26:46.690
So instead we decided to roll this out because now all they have to do is learn JavaScript.

26:46.770 --> 26:48.490
And JavaScript is really forgiving.

26:48.770 --> 26:52.250
Unlike Golang where it's really opinionated and you have to handle all your errors.

26:52.250 --> 26:55.690
So we think the barrier to entry with JavaScript is a lot lower than Golang.

26:55.790 --> 27:04.550
Another neat feature of that is when we added the Golang native linking, now it's also a good like gateway to learn Golang, right?

27:04.550 --> 27:13.730
You can start with JavaScript, you can play around in the debugger and eventually you can just start writing your own Golang native libs and then call them from G script, which is pretty cool.

27:14.610 --> 27:20.490
Just like I was saying, where you can call any Golang native library like off of GitHub, which is really freaking sweet.

27:20.490 --> 27:22.830
You can also wrap your existing tools.

27:22.830 --> 27:27.250
So you don't really have to change any of your existing tactics or any of your existing methodology.

27:27.330 --> 27:29.690
You can just instrument them now with G script.

27:30.050 --> 27:35.290
Which leads me to my next point, which is this is now like persistence and techniques as code.

27:35.290 --> 27:36.590
It's very auditable.

27:36.610 --> 27:41.410
We can give somebody this script that says this is exactly what it's going to do when it hits disk.

27:41.730 --> 27:53.450
Which is really nice because as you'll see, we've been building a community around documenting all of these different G scripts or I'm sorry, documenting miter attack techniques in G script.

27:53.510 --> 27:57.370
So now if you're familiar with miter attack, we have these small little atomic techniques.

27:57.390 --> 28:03.050
We've been writing G scripts such that you can compile native unsigned binaries with these techniques.

28:03.050 --> 28:15.190
It's kind of neat because this way you can see can I detect an unsigned binary doing this from a blue team perspective as opposed to like a script doing this, which might be easier or harder depending on your instrumentation.

28:16.310 --> 28:21.970
So like I was saying, we've been writing a ton of G scripts and we've been writing them to the miter attack framework.

28:22.130 --> 28:24.830
I try to make them as atomic as possible.

28:24.830 --> 28:30.670
So I try to keep the techniques as small as I can because you can compile N number of G scripts into a single binary.

28:31.050 --> 28:35.730
So the idea is you have a bunch of little techniques that all play well together .

28:36.270 --> 28:39.190
And again, we really want people to contribute stuff.

28:39.190 --> 28:45.950
We want to continue to catalog that miter attack framework such that we can compile it to these native binaries.

28:47.290 --> 28:50.710
So again, this tool was really built with a community in mind.

28:50.710 --> 28:56.170
This tool was built with multiple red teamers contributing payloads to build a single binary.

28:56.170 --> 29:01.770
It's really collaborative post exploitation is the idea.

29:01.770 --> 29:08.650
We want everybody to contribute a G script and we're going to run them all on the victim because we're a team.

29:11.290 --> 29:14.850
So here's a quick little example just showing some stuff.

29:15.610 --> 29:19.630
Up here we have a go import of a native package which is OS.

29:19.630 --> 29:22.510
We're going to use this to create a temp directory later.

29:22.790 --> 29:27.390
But we also import a special library we made called the X library.

29:27.710 --> 29:30.650
We had a lot of help with an unnamed person in the back.

29:31.010 --> 29:38.250
And this is an amazing library because these are the functions that yes, they're platform specific, but we would be remiss to leave them out.

29:38.250 --> 29:40.050
This is Windows registry editing.

29:40.050 --> 29:41.510
This is process injection.

29:41.510 --> 29:44.490
This is kind of that fancy stuff that is platform specific.

29:44.890 --> 29:49.090
And again, we move that into the X library because the core of G script is supposed to be cross platform.

29:49.630 --> 29:52.850
And below that, we're embedding this croissant.xc.

29:59.530 --> 30:06.430
This is so first thing we're doing is in this first block, this is just prepping the asset.

30:06.430 --> 30:16.470
This is just saying we have an embedded asset from compile time and we're just going to create this random temp directory string and that's where we're going to write this asset at execution.

30:16.690 --> 30:21.590
Here we're actually using the standard library just to write that file to a path.

30:21.730 --> 30:22.710
We're dropping a file.

30:22.710 --> 30:25.270
This is a great detection exercise.

30:25.630 --> 30:32.490
And then here is a run once key and we're just adding this to show this persistence method.

30:32.490 --> 30:39.210
So the idea here is we're creating persistence as code and we're abstracting the implant from it, right?

30:39.210 --> 30:45.830
So now you have this arbitrary persistence technique and you can just persist any old implant.

30:45.870 --> 30:49.610
And it's great for detection ops because do we detect persistence technique?

30:51.070 --> 30:53.330
It's also really cool for hunting ops.

30:53.330 --> 31:05.910
One thing that I really like is this idea of compiling a G script with multiple techniques in it like a technique A and a technique B and we can run this and then later a blue team can find this, they can dissect this and they can understand the techniques in it.

31:05.910 --> 31:07.370
Then they can hunt on those techniques.

31:07.370 --> 31:14.450
Let's say they had an alert for technique A, they reverse it and they learn about technique B, then they can hunt their data for technique B.

31:14.470 --> 31:20.490
Then we can play these games where we also compile a binary with technique B and technique C and do they find that, right?

31:20.490 --> 31:22.370
Something they may not have the alert for.

31:22.390 --> 31:27.610
So it's kind of cool for these like advanced hunt operations if you can get there in your organization.

31:28.750 --> 31:31.730
So kind of just like why do we really love this?

31:31.730 --> 31:38.190
If I could give you one line, N number of techniques, we keep the techniques really small and auditable.

31:38.190 --> 31:40.990
We wrap our existing tools so nothing really changes.

31:40.990 --> 31:45.910
We still use our C2s, we still use all of our favorite tools on disk or in memory.

31:46.510 --> 31:51.510
But we can codify the techniques of how we're instrumenting them and run them with a single click.

31:51.530 --> 31:53.370
So like what's not to love?

31:54.690 --> 31:56.590
So this always works, right?

31:58.790 --> 32:09.990
One really cool part about CCDC, Dave Cohen is like the grand master and he has this great strategic vision and at the end of day two at some point he really like, he unleashes the hounds.

32:09.990 --> 32:11.530
He kind of like lets us go, right?

32:11.530 --> 32:13.410
And we get to burn things down.

32:14.190 --> 32:17.230
So like taking down services is pretty straightforward, right?

32:17.230 --> 32:19.670
Like service, whatever, stop.

32:19.670 --> 32:21.150
Pretty basic and boring.

32:21.210 --> 32:23.590
So you want to get creative with it and have some fun.

32:23.970 --> 32:29.010
So one thing we like to do is make these troll payloads or trollware, if you will.

32:30.930 --> 32:36.090
So here we've bundled a ton of different trollware and we're just executing on a Windows machine.

32:36.090 --> 32:41.950
The idea here is you just see how much stuff can happen at once and what you can really do with it.

32:41.950 --> 32:47.090
It's a little overwhelming when it will execute and then it blue screens the box.

32:48.810 --> 32:50.310
But it's cool.

32:51.550 --> 32:54.150
So I'm just stepping into the directory where it is.

32:54.150 --> 32:57.770
I'm making the screen bigger so you can kind of see stuff as it happens.

32:57.910 --> 33:02.470
But once we execute this, the whole machine just goes to, you know, goes to hell.

33:09.280 --> 33:11.260
So this is going to run multiple payloads.

33:11.260 --> 33:16.540
This runs the mems which was made by Leoric, popularized by Dan cute.

33:18.000 --> 33:23.680
We had a good friend reverse a bunch of malware on the internet and we instrumented that.

33:24.200 --> 33:27.300
So that's just some of the trollware we like to throw around.

33:32.500 --> 33:33.500
All right.

33:33.500 --> 33:34.240
One demo down.

33:34.240 --> 33:35.200
One more to go.

33:37.080 --> 33:38.860
Yeah, the next one is actually live.

33:38.860 --> 33:39.660
That was just a video.

33:39.660 --> 33:41.200
But we're going to do this one live, too.

33:42.680 --> 33:44.920
We had another demo as well planned.

33:44.920 --> 33:46.580
RIP in the back there.

33:47.240 --> 33:51.480
But we'll save that for next year, right?

33:51.760 --> 33:59.340
So I'm going to boot up a virtual machine here called DEF CON 26 demo.

33:59.720 --> 34:02.500
This is just a standard OSX virtual machine.

34:02.800 --> 34:06.260
I'll make it full screen in a minute here.

34:06.560 --> 34:11.800
But first thing I want to do is I'm going to let's go through and make one of these together, right?

34:11.800 --> 34:13.780
So I've got my terminal up here.

34:13.780 --> 34:14.860
You guys can read that.

34:14.860 --> 34:19.460
I'll make it a little bit bigger for you guys.

34:20.520 --> 34:21.000
Cool.

34:21.000 --> 34:22.180
So I've got my terminal.

34:22.620 --> 34:24.280
I'm going to do an LS.

34:24.300 --> 34:29.200
I've got in here, we'll just go ahead and remove my test one so we can actually do it live.

34:29.400 --> 34:35.820
In it I've got a folder with a bunch of G scripts, right?

34:35.820 --> 34:44.060
This is all just Mac persistence technique, doing things like disabling the firewall and enabling guests and doing some SSH key persistence, right?

34:44.060 --> 34:49.060
And all of these, I'll show you one, like a service installer.

34:49.060 --> 34:54.200
It goes through and uses a library that we wrote called X service.

34:54.200 --> 34:58.400
So this is an experimental library, but it actually is a cross platform service installer.

34:58.400 --> 35:05.120
So it doesn't matter if there's a NITD or system D or it's a Windows box.

35:05.120 --> 35:10.420
You can very easily in one unified library install a system service, which is always fun.

35:10.420 --> 35:12.380
We love to do that when we're red teaming.

35:12.440 --> 35:14.080
So I've got all these scripts.

35:14.140 --> 35:16.860
I'm going to just go through and make one now live here with you.

35:16.860 --> 35:29.540
So I'm going to do G script, compile, dash, dash, output file, users, demo, OSX, live.bin.

35:30.000 --> 35:34.460
And then I'm going to say G scripts star.GS.

35:34.820 --> 35:36.780
And we're going to run this.

35:36.980 --> 35:42.800
It's going to take a minute , but relatively fast for considering what it's doing.

35:43.020 --> 35:52.360
Most of the time it's spending right now on this, it's spending actually embedding and encrypting all of the payloads that we're putting into this into the binary itself.

35:52.600 --> 35:56.760
So I think this takes about 20, 30 seconds right now.

35:56.760 --> 36:02.820
But as you see here, it does tell you all the scripts that it's essentially bundling into this executable.

36:02.820 --> 36:06.200
It lets you see some information that we're doing this for Darwin.

36:06.360 --> 36:08.040
Here's the output file.

36:08.120 --> 36:10.780
And some of those compiler flags, which I talked about before.

36:10.780 --> 36:15.740
So being able to keep the build directory, which will show you the source code that was used to make this.

36:15.740 --> 36:18.540
Enabling UPX compression disabled by default.

36:19.020 --> 36:21.120
A lot of different options we'll give you.

36:21.120 --> 36:23.640
And boom, scroll down, it's done.

36:23.680 --> 36:25.120
I'm going to look in there.

36:26.280 --> 36:28.920
It is a 26 megabyte binary.

36:28.920 --> 36:30.760
What payloads are you putting in here?

36:30.760 --> 36:31.780
Lord.

36:32.380 --> 36:34.480
Thank God that's local.

36:34.540 --> 36:35.900
And we have internet.

36:35.900 --> 36:36.780
Cool.

36:36.860 --> 36:43.040
I'm going to, while I'm here, SSH into our Merlin server.

36:45.500 --> 36:49.080
There we go.

36:49.160 --> 36:53.120
We've got some old dummy agents, but it's fine.

36:53.120 --> 36:55.260
They're not connected yet.

36:55.480 --> 37:03.460
Let's go into our VM now and take the executable that we just built, OSX live, copy it over.

37:08.810 --> 37:10.110
There we go.

37:10.110 --> 37:11.390
I don't have logging enabled.

37:11.390 --> 37:12.590
I didn't enable any of that.

37:12.590 --> 37:14.070
So it's going to be silent.

37:14.150 --> 37:20.030
So we're going to say sudo dot slash desktop OSX live, enter.

37:22.870 --> 37:25.030
And a bunch of stuff is happening.

37:25.130 --> 37:29.210
And then enter my password.

37:29.210 --> 37:31.250
That's not phishing at all.

37:32.910 --> 37:33.790
Boom.

37:33.890 --> 37:34.930
So something happened.

37:34.930 --> 37:36.350
I don't really know what.

37:36.450 --> 37:40.070
If I look back at my Merlin, I've now received a new agent check in.

37:40.890 --> 37:41.610
Live demo.

37:41.610 --> 37:42.390
Thank you.

37:47.820 --> 37:50.720
And we'll just come in here and look and see some things.

37:50.760 --> 37:54.680
So file sharing, remote log in, remote management, all this stuff was turned on.

37:54.680 --> 37:59.340
So all of the attack techniques that we just bundled into this were actually run on this machine.

37:59.420 --> 38:07.480
So if you're a red teamer, I think you can extrapolate why this is so valuable tool to use in your tool chain.

38:07.480 --> 38:19.360
If you're a blue teamer, if you work at a company that has a bunch of detection systems, man, how many of you guys have always wanted to know whether your vendor was actually telling the truth that they detect this thing or not?

38:19.660 --> 38:23.060
You can write the G script and I promise you they're not going to detect the binary.

38:23.160 --> 38:26.160
If they detect the actual activity, then you can validate that.

38:26.160 --> 38:36.340
And that's really the fundamental problem right now in the blue team space is how do I trust that when a vendor sells me something that says it does X that I actually know it can actually do that.

38:36.360 --> 38:52.100
What we're trying to do here is provide blue and red teams alike the ability to codify these techniques in a way where basic signature detection on a file is not going to just cheat the actual result of saying, yeah, I detect when something does shell code injection.

38:52.100 --> 38:58.800
Do you actually detect that or do you just detect that a file has a string in it that matches a certain thing?

38:59.140 --> 39:04.420
This is the type of evolution in security that we're trying to present to the world.

39:04.560 --> 39:13.900
So I will come back to our talk here and that's it.

39:13.980 --> 39:16.460
Version 1 is live right now on GitHub.

39:16.460 --> 39:18.580
I've written some documentations out.

39:18.580 --> 39:26.120
I've got some shoutouts for some awesome people who helped us with this on the side as well as somebody totally unnamed who didn't help at all with this project.

39:26.260 --> 39:27.540
He's not here.

39:27.540 --> 39:28.940
He didn't help us.

39:28.940 --> 39:32.240
His name is not at the bottom of that list of authors there.

39:33.020 --> 39:37.560
With that, I'd like to open it up to you guys for questions, comments, anything.

39:37.560 --> 39:38.360
Thank you.

39:48.270 --> 39:48.950
Anybody?

39:48.950 --> 39:49.730
Questions?

39:49.750 --> 39:50.730
You can just raise your hand.

39:50.730 --> 39:51.970
Yes, right there.

39:59.480 --> 40:01.480
Say that one more time.

40:09.130 --> 40:11.810
You probably could.

40:12.190 --> 40:17.510
I've not ‑‑ so the big problem with it has been the regular expression compatibility.

40:17.510 --> 40:23.090
So the question was, could you run a normal JavaScript application within G scripts?

40:23.290 --> 40:30.230
Yes, as long as it didn't break the regular expression or the asynchronous incompatibilities right now, it should be fine.

40:30.230 --> 40:33.290
So something like underscore, for example, does work within it.

40:33.290 --> 40:38.150
You can load an underscore library into that and it would work just fine.

40:38.210 --> 40:52.830
The ES6 compatibility is something where I think if we can get that actually implemented, it will give us a lot more flexibility in being able to allow more current JavaScript tools to be able to be run inside of it.

40:53.810 --> 40:55.290
Yes, right here.

41:01.300 --> 41:01.820
Okay.

41:02.720 --> 41:03.800
Yes.

41:07.550 --> 41:13.510
No, no, everything is ‑‑ so the question was, does the dropper fetch things from the GitHub URL?

41:13.510 --> 41:14.310
It doesn't.

41:14.310 --> 41:20.610
When you run G script compile, it contains everything you need right then and there into the binary.

41:20.650 --> 41:23.490
So everything happens at compile time, all the embedding does.

41:23.490 --> 41:33.570
It was one thing we were kind of on the fence about of saying, okay, should our droppers reach out and get stuff or should we just really try and pack them tightly and safely internally?

41:33.570 --> 41:38.930
One of the ideas there is when you're in a high security context solution, you may only have one or two ways out.

41:38.930 --> 41:44.110
You want to do things locally and use that existing C2 channel to shuttle stuff over.

41:44.350 --> 41:54.670
We have a request library and you can pull stuff down, but personally I like to kind of do stuff and go out of existing C2 channels and just operate through those channels.

41:56.070 --> 41:57.850
I think we had a question over here.

41:57.850 --> 41:58.510
Yes.

42:01.150 --> 42:07.610
Yeah, so the encryption of the assets is just AES 256.

42:08.090 --> 42:13.350
I'm not going to claim to be a crypto expert, but I try and just follow best practices on that.

42:13.470 --> 42:21.610
It is isolated per VM and it's unique every time you compile, so it's not generated in any sort of deterministic way.

42:21.610 --> 42:31.670
Now the obfuscation, I'm glad you asked, the obfuscation I would say is implemented in a way that assures zero reproducibility of builds.

42:31.710 --> 42:40.050
So if you're trying to reproduce an MD5 hash of two exact same inputs and outputs of a G script binary, I doubt that would actually ever happen.

42:40.270 --> 42:46.190
The obfuscator is meant to try and remove the ability to find static strings within it.

42:46.190 --> 42:51.710
It's meant to randomize things like function names and address space within the binary itself.

42:51.830 --> 42:58.390
And then we also have a post obfuscator that is not turned on by default, but you can play with it.

42:58.390 --> 43:00.570
It works really well on Windows and OSX.

43:00.570 --> 43:03.410
Windows, or excuse me, it works really well on Linux and OSX.

43:03.410 --> 43:08.670
Windows it kind of has some problems with sometimes.

43:09.270 --> 43:16.030
It basically after Go compiles your native binary, just goes through and starts patching stuff out of like the native executable.

43:16.050 --> 43:18.690
It's really dirty, but it does actually work.

43:18.690 --> 43:20.310
It does a great job sometimes.

43:21.750 --> 43:23.050
Yeah, sometimes.

43:23.210 --> 43:24.710
That's why we test, right?

43:24.770 --> 43:26.330
Anybody else have a question?

43:26.330 --> 43:28.070
We got about five minutes left.

43:28.330 --> 43:31.010
Maybe over here, I haven't... no?

43:31.530 --> 43:32.650
Come on.

43:33.490 --> 43:35.790
Everybody just wants to go to sleep, right?

43:35.790 --> 43:37.230
Yeah, we got a question in the back there.

43:39.470 --> 43:41.450
What if you want to write your own compiler?

43:41.450 --> 43:42.630
That's a great question.

43:43.550 --> 43:54.210
So we've implemented G script basically as in everything you've seen here, from the obfuscator to the compiler to the engine itself, it's all implemented itself as a library.

43:54.250 --> 44:09.290
So if you wanted to implement your own compiler, you could actually take the engine library, figure out how to translate whatever it is you wanted as your input into an engine itself, bundle that together in whatever way you want, and then boom, you've implemented your own essentially G script compiler.

44:09.790 --> 44:11.190
We've got some stuff on the works.

44:11.190 --> 44:29.190
If you're going to be at our workshop tomorrow, we'll touch on that a little bit of how we're actually looking at implementing a C2 in G script so that the C2 itself can supply the binary with G scripts at execution time so there's not actually something bundled into it or it can say,

44:29.190 --> 44:32.730
hey, switch up the C2 channel, talk to me now on this other channel.

44:33.190 --> 44:38.590
Interesting stuff like that is, I think, what you'd probably see from us next year in another follow-up talk.

44:38.770 --> 44:39.490
Yes, right here.

44:43.780 --> 44:45.840
Yeah, so we don't have a slack.

44:45.840 --> 44:47.360
We probably should have a slack.

44:47.360 --> 44:48.580
That's probably a good idea.

44:49.480 --> 44:51.480
At this point, it's just been on GitHub.

44:52.260 --> 44:55.280
If you send me a pull request, I would love it.

44:55.580 --> 44:57.220
We put a lot of effort into this.

44:57.220 --> 45:02.440
It's taken a lot of engineering hours and we're excited to kind of share it with the community.

45:03.720 --> 45:11.600
A lot of times we don't necessarily always release, so this has been something where we're excited to say, look, here, it can be good for the greater community at large.

45:11.600 --> 45:15.380
We have a few contributor guidelines, too, and then there's a lot of ways to get involved.

45:15.420 --> 45:25.700
You can write G scripts, you can help write different native libraries, you can help add to the compiler itself, and you can even just help with the documentation, right?

45:25.700 --> 45:29.340
Like anybody that wants to get involved, we're really receptive to people helping.

45:31.000 --> 45:33.620
I think we're... oh, one more?

45:33.620 --> 45:34.100
Where are we?

45:34.100 --> 45:34.760
Yes.

45:41.560 --> 45:42.140
Yes.

45:42.140 --> 45:53.340
So inside the documentation, if you go to this GitHub, there will be a link to Dan's repo where he is actually doing all of that miter mapping in a separate repo.

45:53.740 --> 45:55.660
I'm open to suggestions.

45:55.660 --> 46:05.080
So when you check it out, if you think there's a better folder structure, right now I was just doing it based on platforms and then I have each of the techniques linked in like the meta information in the top.

46:05.080 --> 46:08.200
But if there's a better way to organize it, I'm all ears.

46:09.500 --> 46:10.380
Cool.

46:10.900 --> 46:12.980
I think two minutes left.

46:12.980 --> 46:14.020
Anything else?

46:14.840 --> 46:17.760
Anybody raise your hand if you think you might use this at some point?

46:18.820 --> 46:19.700
Sweet.

46:19.980 --> 46:20.480
Awesome.

46:20.480 --> 46:22.760
Maybe we'll have a little G script con sometime.

46:23.900 --> 46:25.040
Thanks, guys.

