WEBVTT

00:00:00.000 --> 00:00:03.472 align:middle line:90%


00:00:03.472 --> 00:00:06.944 align:middle line:90%
[MUSIC PLAYING]

00:00:06.944 --> 00:00:09.930 align:middle line:90%


00:00:09.930 --> 00:00:11.940 align:middle line:90%
Antivirus evasion with Shellter.

00:00:11.940 --> 00:00:15.510 align:middle line:84%
So welcome to the Antivirus
Evasion and Obfuscation section

00:00:15.510 --> 00:00:18.480 align:middle line:84%
of this course, where we
will be introducing you

00:00:18.480 --> 00:00:22.230 align:middle line:84%
to how antivirus solutions work
and how they detect malware,

00:00:22.230 --> 00:00:25.080 align:middle line:84%
as well as how
they can be evaded.

00:00:25.080 --> 00:00:27.600 align:middle line:84%
So in this specific
video, we're going

00:00:27.600 --> 00:00:31.500 align:middle line:84%
to be taking a look at a very
simple example, whereby we'll

00:00:31.500 --> 00:00:36.120 align:middle line:84%
be injecting reverse shellcode
into a legitimate Windows

00:00:36.120 --> 00:00:37.300 align:middle line:90%
executable.

00:00:37.300 --> 00:00:39.190 align:middle line:84%
And that will serve
two functions.

00:00:39.190 --> 00:00:43.620 align:middle line:84%
Number one, it will make the
actual final executable look

00:00:43.620 --> 00:00:46.860 align:middle line:84%
legitimate because, for
example, we can actually

00:00:46.860 --> 00:00:49.890 align:middle line:84%
take a look at how to
inject our reverse shell

00:00:49.890 --> 00:00:53.580 align:middle line:84%
shellcode into a program
like WinRAR or Google Chrome.

00:00:53.580 --> 00:00:56.040 align:middle line:84%
And again, as I said,
that serves two functions.

00:00:56.040 --> 00:00:57.480 align:middle line:84%
That'll make it
look legitimate so

00:00:57.480 --> 00:00:59.340 align:middle line:84%
that the end user,
or your target,

00:00:59.340 --> 00:01:01.170 align:middle line:84%
will not be able
to tell outrightly

00:01:01.170 --> 00:01:03.180 align:middle line:90%
that that program is malicious.

00:01:03.180 --> 00:01:07.080 align:middle line:84%
And secondly, this is an actual
antivirus evasion technique.

00:01:07.080 --> 00:01:09.840 align:middle line:84%
And this is pertinent to
signature-based detection.

00:01:09.840 --> 00:01:11.700 align:middle line:84%
So we are really
going to be focused

00:01:11.700 --> 00:01:14.730 align:middle line:84%
on the fundamentals within this
section and within this course,

00:01:14.730 --> 00:01:17.400 align:middle line:84%
primarily because antivirus
evasion or defense

00:01:17.400 --> 00:01:20.550 align:middle line:84%
evasion in general is a
very complex topic that

00:01:20.550 --> 00:01:24.510 align:middle line:84%
is multi-tiered and involves
multiple techniques, tools,

00:01:24.510 --> 00:01:27.030 align:middle line:84%
and, of course, you also have
to take into consideration

00:01:27.030 --> 00:01:31.900 align:middle line:84%
the vast number of EDRs or
antivirus solutions out there.

00:01:31.900 --> 00:01:34.300 align:middle line:84%
So you might be
asking yourself, well,

00:01:34.300 --> 00:01:36.120 align:middle line:90%
why does all of this matter?

00:01:36.120 --> 00:01:39.900 align:middle line:84%
Well, if we are able to generate
an executable that, when

00:01:39.900 --> 00:01:43.170 align:middle line:84%
executed, provides us
with the reverse shell,

00:01:43.170 --> 00:01:48.030 align:middle line:84%
that may evade Windows
Defender, but it might not evade

00:01:48.030 --> 00:01:49.480 align:middle line:90%
Malwarebytes, for example.

00:01:49.480 --> 00:01:53.250 align:middle line:84%
So again, given the fact
that the actual landscape

00:01:53.250 --> 00:01:57.120 align:middle line:84%
or the digital IT
industry currently

00:01:57.120 --> 00:02:00.120 align:middle line:84%
has more than 100 antivirus
solutions out there,

00:02:00.120 --> 00:02:03.100 align:middle line:84%
it can be a very,
very complex process.

00:02:03.100 --> 00:02:06.500 align:middle line:84%
So we're essentially going to
be focused on the fundamentals

00:02:06.500 --> 00:02:07.000 align:middle line:90%
here.

00:02:07.000 --> 00:02:08.910 align:middle line:84%
And, as I said, in
this example, we're

00:02:08.910 --> 00:02:11.130 align:middle line:84%
going to be taking a
look at how to evade

00:02:11.130 --> 00:02:13.980 align:middle line:84%
very basic
signature-based antivirus

00:02:13.980 --> 00:02:17.880 align:middle line:84%
solutions by injecting
our malicious shellcode,

00:02:17.880 --> 00:02:20.280 align:middle line:84%
our malicious reverse
shell shellcode

00:02:20.280 --> 00:02:23.430 align:middle line:84%
into a legitimate
executable with Shellter.

00:02:23.430 --> 00:02:25.740 align:middle line:84%
So before we actually
get started, let's

00:02:25.740 --> 00:02:28.800 align:middle line:84%
get an understanding of defense
evasion as a topic, right?

00:02:28.800 --> 00:02:30.690 align:middle line:90%
So this definition is--

00:02:30.690 --> 00:02:33.250 align:middle line:84%
I actually pulled it
from the MITRE website.

00:02:33.250 --> 00:02:36.150 align:middle line:84%
And the reason I did that
is because it perfectly

00:02:36.150 --> 00:02:39.550 align:middle line:84%
encapsulates the
complexity of this topic.

00:02:39.550 --> 00:02:42.450 align:middle line:84%
So defense evasion
consists of techniques

00:02:42.450 --> 00:02:45.090 align:middle line:84%
that adversaries use
to avoid detection

00:02:45.090 --> 00:02:46.560 align:middle line:90%
throughout their compromise.

00:02:46.560 --> 00:02:48.480 align:middle line:84%
Techniques used
for defense evasion

00:02:48.480 --> 00:02:50.490 align:middle line:84%
include uninstalling
or disabling

00:02:50.490 --> 00:02:53.580 align:middle line:84%
the security software
or the antivirus

00:02:53.580 --> 00:02:56.670 align:middle line:84%
or obfuscating or
encrypting data and scripts.

00:02:56.670 --> 00:02:58.950 align:middle line:84%
Adversaries also
leverage and abuse

00:02:58.950 --> 00:03:02.010 align:middle line:84%
trusted processes to hide
and masquerade their malware.

00:03:02.010 --> 00:03:04.320 align:middle line:84%
Now, the area that
we're focusing on here

00:03:04.320 --> 00:03:06.930 align:middle line:84%
is obfuscation and
encryption, right?

00:03:06.930 --> 00:03:08.370 align:middle line:84%
So what we are
trying to do is we

00:03:08.370 --> 00:03:10.590 align:middle line:84%
are trying to
change the signature

00:03:10.590 --> 00:03:13.530 align:middle line:84%
of the malicious executable
that we are generating.

00:03:13.530 --> 00:03:17.280 align:middle line:84%
So for example, if I generate
a Meterpreter payload

00:03:17.280 --> 00:03:21.540 align:middle line:84%
with MSFvenom, if you transfer
that onto a Windows system,

00:03:21.540 --> 00:03:23.880 align:middle line:84%
a modern Windows
system like Windows 10,

00:03:23.880 --> 00:03:25.890 align:middle line:84%
that will be
detected immediately.

00:03:25.890 --> 00:03:27.810 align:middle line:90%
Well, why is that?

00:03:27.810 --> 00:03:29.760 align:middle line:84%
How does an antivirus
solution actually

00:03:29.760 --> 00:03:31.080 align:middle line:90%
know that that is malicious?

00:03:31.080 --> 00:03:33.900 align:middle line:84%
Well, that can be
explained by getting

00:03:33.900 --> 00:03:37.350 align:middle line:84%
an understanding of the various
antivirus detection methods.

00:03:37.350 --> 00:03:39.690 align:middle line:84%
So antivirus software
will typically

00:03:39.690 --> 00:03:43.580 align:middle line:84%
utilize signature, heuristic,
and behavior-based detection.

00:03:43.580 --> 00:03:46.260 align:middle line:84%
So let's get started with
signature-based detection

00:03:46.260 --> 00:03:46.990 align:middle line:90%
first.

00:03:46.990 --> 00:03:50.670 align:middle line:84%
So this is the oldest and most
commonly used detection method,

00:03:50.670 --> 00:03:53.190 align:middle line:84%
and it's still used
by antivirus solutions

00:03:53.190 --> 00:03:56.280 align:middle line:84%
out there, even extremely
powerful antivirus

00:03:56.280 --> 00:03:59.190 align:middle line:84%
solutions, one of which
is Windows Defender.

00:03:59.190 --> 00:04:03.060 align:middle line:84%
But Windows Defender and
some of the really advanced

00:04:03.060 --> 00:04:05.670 align:middle line:84%
commercial antiviruses
actually use

00:04:05.670 --> 00:04:09.480 align:middle line:84%
a combination of more than
one of these detection methods

00:04:09.480 --> 00:04:13.740 align:middle line:84%
to ensure that they're able to
uniquely or, rather, accurately

00:04:13.740 --> 00:04:17.010 align:middle line:84%
identify malware whenever it's
downloaded onto your system

00:04:17.010 --> 00:04:19.950 align:middle line:84%
or whenever an
attacker is able to get

00:04:19.950 --> 00:04:21.519 align:middle line:90%
that malware onto your system.

00:04:21.519 --> 00:04:24.450 align:middle line:84%
So the way signature-based
detection works

00:04:24.450 --> 00:04:29.250 align:middle line:84%
is the antivirus software has
a database of virus signatures

00:04:29.250 --> 00:04:30.960 align:middle line:90%
or malware signatures, right?

00:04:30.960 --> 00:04:36.180 align:middle line:84%
And so what is an antivirus or
a malware or virus signature?

00:04:36.180 --> 00:04:41.130 align:middle line:84%
A virus signature is a unique
sequence of bytes, or rather

00:04:41.130 --> 00:04:45.450 align:middle line:84%
a unique string of text, that
uniquely identifies malware

00:04:45.450 --> 00:04:48.870 align:middle line:84%
or files or executables
that are malicious.

00:04:48.870 --> 00:04:51.330 align:middle line:84%
Right, now, how is this
signature generated?

00:04:51.330 --> 00:04:54.570 align:middle line:84%
Well, again, the easiest
way that this is done

00:04:54.570 --> 00:04:57.870 align:middle line:84%
is to just generate a
hash of that executable

00:04:57.870 --> 00:05:01.170 align:middle line:84%
or to get the hash value
of that executable, right?

00:05:01.170 --> 00:05:03.680 align:middle line:84%
And I'll not dive
into that right now

00:05:03.680 --> 00:05:05.870 align:middle line:84%
because that's really
not within the scope

00:05:05.870 --> 00:05:07.640 align:middle line:90%
of this course itself.

00:05:07.640 --> 00:05:10.460 align:middle line:84%
But the way this
works is whenever

00:05:10.460 --> 00:05:12.320 align:middle line:84%
there's a new virus
that has been developed

00:05:12.320 --> 00:05:17.030 align:middle line:84%
or, for example, new ransomware,
the antivirus company will

00:05:17.030 --> 00:05:20.210 align:middle line:84%
actually have one
of their engineers

00:05:20.210 --> 00:05:22.430 align:middle line:84%
go ahead and download
that malware sample

00:05:22.430 --> 00:05:24.920 align:middle line:90%
into a secured environment.

00:05:24.920 --> 00:05:26.960 align:middle line:84%
What they will then
do is analyze it.

00:05:26.960 --> 00:05:30.620 align:middle line:84%
And part of their analysis,
and that's malware analysis,

00:05:30.620 --> 00:05:32.930 align:middle line:84%
will actually
consist of generating

00:05:32.930 --> 00:05:36.830 align:middle line:84%
a signature, a unique signature
that uniquely identifies

00:05:36.830 --> 00:05:37.760 align:middle line:90%
that malware.

00:05:37.760 --> 00:05:40.220 align:middle line:84%
That signature is
then what is included

00:05:40.220 --> 00:05:43.950 align:middle line:84%
within the antivirus
solutions signature database.

00:05:43.950 --> 00:05:47.390 align:middle line:84%
So whenever you download and
install an antivirus solution

00:05:47.390 --> 00:05:50.060 align:middle line:84%
that utilizes a
signature-based detection,

00:05:50.060 --> 00:05:53.100 align:middle line:84%
it comes with a
database of signatures.

00:05:53.100 --> 00:05:55.980 align:middle line:84%
So let's take a look
at a simple example.

00:05:55.980 --> 00:05:58.460 align:middle line:84%
If I download Google
Chrome, for example,

00:05:58.460 --> 00:06:00.770 align:middle line:84%
I download the
Google Chrome setup.

00:06:00.770 --> 00:06:03.170 align:middle line:84%
Once that file is
saved on my disk,

00:06:03.170 --> 00:06:05.270 align:middle line:84%
the antivirus
solution goes to work

00:06:05.270 --> 00:06:08.810 align:middle line:84%
and actually generates a
hash of that executable

00:06:08.810 --> 00:06:12.840 align:middle line:84%
and then compares that hash,
or that signature if you will,

00:06:12.840 --> 00:06:15.810 align:middle line:84%
to its own signatures within
the signature database.

00:06:15.810 --> 00:06:19.790 align:middle line:84%
If it matches, then that means
that executable is malware.

00:06:19.790 --> 00:06:22.490 align:middle line:84%
If it doesn't find a
match, then, again, it's

00:06:22.490 --> 00:06:25.710 align:middle line:84%
actually-- it's not flagged
as malware or as a virus.

00:06:25.710 --> 00:06:29.720 align:middle line:84%
So in terms of evading
signature-based detection,

00:06:29.720 --> 00:06:33.200 align:middle line:84%
we can do this by modifying
the malicious executable

00:06:33.200 --> 00:06:35.840 align:middle line:84%
or the malwares byte
sequence, therefore

00:06:35.840 --> 00:06:36.860 align:middle line:90%
changing the signature.

00:06:36.860 --> 00:06:40.910 align:middle line:84%
So whenever an exploit developer
creates a new piece of malware

00:06:40.910 --> 00:06:45.380 align:middle line:84%
or ransomware and a signature
is generated or made

00:06:45.380 --> 00:06:48.590 align:middle line:84%
for that particular
piece of malware,

00:06:48.590 --> 00:06:51.090 align:middle line:84%
that particular executable
will be detected.

00:06:51.090 --> 00:06:52.940 align:middle line:84%
So again, going
back to the example

00:06:52.940 --> 00:06:56.570 align:middle line:84%
of generating a Meterpreter
payload with MSFvenom, if I

00:06:56.570 --> 00:06:59.030 align:middle line:84%
generate a Meterpreter
payload with MSFvenom,

00:06:59.030 --> 00:07:02.300 align:middle line:84%
transfer it over to the
target, the antivirus solution

00:07:02.300 --> 00:07:04.070 align:middle line:84%
will pretty much
have a signature

00:07:04.070 --> 00:07:06.830 align:middle line:84%
that matches the actual
signature or hash

00:07:06.830 --> 00:07:08.870 align:middle line:90%
of the Meterpreter payload.

00:07:08.870 --> 00:07:13.010 align:middle line:84%
But if we modify the byte
sequence of that Meterpreter

00:07:13.010 --> 00:07:17.390 align:middle line:84%
payload, the actual hash of
that executable or Meterpreter

00:07:17.390 --> 00:07:19.880 align:middle line:84%
payload changes,
consequently meaning

00:07:19.880 --> 00:07:23.165 align:middle line:90%
that if that new hash is not--

00:07:23.165 --> 00:07:26.780 align:middle line:84%
if that new hash cannot
be matched to an existing

00:07:26.780 --> 00:07:29.630 align:middle line:84%
signature within the
antivirus signature database,

00:07:29.630 --> 00:07:31.610 align:middle line:84%
then it's not going to
be flagged as malware.

00:07:31.610 --> 00:07:33.650 align:middle line:84%
Now, as I said,
antivirus companies

00:07:33.650 --> 00:07:36.540 align:middle line:84%
have an extensive
database of signatures.

00:07:36.540 --> 00:07:41.690 align:middle line:84%
So you really have to be
smart about what you're doing.

00:07:41.690 --> 00:07:44.030 align:middle line:84%
And the easiest way, in
this particular case,

00:07:44.030 --> 00:07:47.330 align:middle line:84%
is to inject our shellcode
that we will generate

00:07:47.330 --> 00:07:51.200 align:middle line:84%
with Meterpreter into a
legitimate executable,

00:07:51.200 --> 00:07:56.630 align:middle line:84%
therefore masking or generating
a signature that, again,

00:07:56.630 --> 00:07:58.850 align:middle line:84%
in most cases, will
not be included,

00:07:58.850 --> 00:08:01.550 align:middle line:84%
or generating a
new signature that

00:08:01.550 --> 00:08:07.670 align:middle line:84%
is not part of an antivirus
solutions signature database.

00:08:07.670 --> 00:08:10.070 align:middle line:84%
So that's signature-based
detection.

00:08:10.070 --> 00:08:12.020 align:middle line:84%
We then have
heuristic-based detection.

00:08:12.020 --> 00:08:14.210 align:middle line:84%
This relies on
rules or decisions

00:08:14.210 --> 00:08:18.740 align:middle line:84%
to determine whether a binary
or executable is malicious.

00:08:18.740 --> 00:08:21.620 align:middle line:84%
It also looks for specific
patterns within the code

00:08:21.620 --> 00:08:23.300 align:middle line:84%
or program calls
that have been made

00:08:23.300 --> 00:08:26.150 align:middle line:90%
by a particular executable.

00:08:26.150 --> 00:08:28.280 align:middle line:84%
We then have
behavior-based detection.

00:08:28.280 --> 00:08:30.380 align:middle line:84%
This relies on
identifying malware

00:08:30.380 --> 00:08:32.419 align:middle line:90%
by monitoring its behavior.

00:08:32.419 --> 00:08:35.600 align:middle line:84%
And this is typically
used or is very effective

00:08:35.600 --> 00:08:37.760 align:middle line:90%
against new strains of malware.

00:08:37.760 --> 00:08:40.640 align:middle line:84%
And, again, the way
behavior-based detection works

00:08:40.640 --> 00:08:43.730 align:middle line:84%
is this particular
system involves

00:08:43.730 --> 00:08:47.780 align:middle line:84%
taking a look at what a program
does when it's executed.

00:08:47.780 --> 00:08:50.160 align:middle line:84%
Is it actually taking a look
at the Windows Registry?

00:08:50.160 --> 00:08:53.130 align:middle line:84%
Is it doing anything that
is considered suspicious?

00:08:53.130 --> 00:08:56.030 align:middle line:84%
And if so, then that's going
to be flagged as malicious

00:08:56.030 --> 00:08:59.600 align:middle line:84%
or it's going to be
flagged as dangerous.

00:08:59.600 --> 00:09:01.850 align:middle line:84%
So these are the antivirus
detection methods.

00:09:01.850 --> 00:09:07.080 align:middle line:84%
Now, in terms of the evasion
techniques, there really are--

00:09:07.080 --> 00:09:09.500 align:middle line:84%
you can really categorize
these into two,

00:09:09.500 --> 00:09:11.540 align:middle line:90%
or split them up into two.

00:09:11.540 --> 00:09:13.100 align:middle line:90%
So you have on-disk evasion.

00:09:13.100 --> 00:09:15.470 align:middle line:84%
And this is your
typical scenario, right?

00:09:15.470 --> 00:09:17.360 align:middle line:84%
When you generate a
Meterpreter payload,

00:09:17.360 --> 00:09:19.830 align:middle line:84%
that needs to be transferred
over to the target.

00:09:19.830 --> 00:09:24.170 align:middle line:84%
And if it's then executed,
if it's transferred over

00:09:24.170 --> 00:09:26.840 align:middle line:84%
to the target, it's going to be
stored on the target system's

00:09:26.840 --> 00:09:27.510 align:middle line:90%
disk.

00:09:27.510 --> 00:09:30.840 align:middle line:84%
So this is where on-disk evasion
techniques come into play.

00:09:30.840 --> 00:09:35.030 align:middle line:84%
So whenever an executable
or a malicious file

00:09:35.030 --> 00:09:37.730 align:middle line:84%
is saved onto the
disk, we actually

00:09:37.730 --> 00:09:41.270 align:middle line:84%
need to utilize different
evasion techniques as opposed

00:09:41.270 --> 00:09:44.540 align:middle line:90%
to in-memory evasion techniques.

00:09:44.540 --> 00:09:48.350 align:middle line:84%
So number one, in terms of
on-disk evasion techniques,

00:09:48.350 --> 00:09:49.460 align:middle line:90%
we have obfuscation.

00:09:49.460 --> 00:09:51.110 align:middle line:84%
Obfuscation refers
to the process

00:09:51.110 --> 00:09:53.420 align:middle line:84%
of concealing something
important, valuable,

00:09:53.420 --> 00:09:54.230 align:middle line:90%
or critical.

00:09:54.230 --> 00:09:57.860 align:middle line:84%
And what obfuscation does
is it reorganizes code

00:09:57.860 --> 00:10:01.220 align:middle line:84%
in order to make it harder to
analyze or to reverse engineer.

00:10:01.220 --> 00:10:02.870 align:middle line:90%
You then have encoding, right?

00:10:02.870 --> 00:10:05.470 align:middle line:84%
So encoding data
is a process that

00:10:05.470 --> 00:10:09.200 align:middle line:84%
involves the changing of
data into a new format using

00:10:09.200 --> 00:10:10.690 align:middle line:90%
an encoding scheme.

00:10:10.690 --> 00:10:13.960 align:middle line:84%
An example of encoding is
encoding a particular string

00:10:13.960 --> 00:10:15.880 align:middle line:90%
of text into Base64.

00:10:15.880 --> 00:10:17.890 align:middle line:84%
The problem with
encoding is that it

00:10:17.890 --> 00:10:22.180 align:middle line:84%
is easily reversible, which
means that if you know what

00:10:22.180 --> 00:10:26.380 align:middle line:84%
a particular-- if you actually
identify a piece of code that's

00:10:26.380 --> 00:10:28.360 align:middle line:84%
been encoded in
Base64, if you can

00:10:28.360 --> 00:10:30.760 align:middle line:84%
tell that it's been
encoded in Base64,

00:10:30.760 --> 00:10:33.460 align:middle line:84%
then you can decode
it very easily.

00:10:33.460 --> 00:10:35.080 align:middle line:90%
So that's encoding.

00:10:35.080 --> 00:10:36.100 align:middle line:90%
You then have packing.

00:10:36.100 --> 00:10:38.710 align:middle line:84%
So packing essentially
involves the process

00:10:38.710 --> 00:10:42.460 align:middle line:84%
of generating an executable
with a new binary structure,

00:10:42.460 --> 00:10:45.400 align:middle line:84%
with a smaller size and,
therefore, provides the payload

00:10:45.400 --> 00:10:46.660 align:middle line:90%
with a new signature.

00:10:46.660 --> 00:10:52.030 align:middle line:84%
This is typically used by
various malicious attackers

00:10:52.030 --> 00:10:55.600 align:middle line:84%
whenever they are trying to
generate executables that

00:10:55.600 --> 00:10:59.150 align:middle line:84%
will consequently give them
remote access to a system,

00:10:59.150 --> 00:11:00.530 align:middle line:90%
et cetera, et cetera.

00:11:00.530 --> 00:11:01.630 align:middle line:90%
You then have crypters.

00:11:01.630 --> 00:11:05.170 align:middle line:84%
Crypters essentially
encrypt code or payloads

00:11:05.170 --> 00:11:08.552 align:middle line:84%
and decrypts the
encrypted code in memory.

00:11:08.552 --> 00:11:12.800 align:middle line:84%
The decryption key or function
is usually stored in a stub.

00:11:12.800 --> 00:11:15.190 align:middle line:84%
So this is one of
the techniques that's

00:11:15.190 --> 00:11:17.950 align:middle line:84%
typically used by new
strains of ransomware,

00:11:17.950 --> 00:11:22.780 align:middle line:84%
whereby the actual
code is encrypted.

00:11:22.780 --> 00:11:26.440 align:middle line:90%
And encryption cannot be--

00:11:26.440 --> 00:11:28.820 align:middle line:84%
whenever you come
across encrypted code,

00:11:28.820 --> 00:11:31.120 align:middle line:90%
you cannot decode that.

00:11:31.120 --> 00:11:34.510 align:middle line:84%
You actually need the key,
the actual decryption key

00:11:34.510 --> 00:11:35.300 align:middle line:90%
to decode it.

00:11:35.300 --> 00:11:39.520 align:middle line:84%
And in the case of ransomware,
only the ransomware developers

00:11:39.520 --> 00:11:40.450 align:middle line:90%
have that key.

00:11:40.450 --> 00:11:44.560 align:middle line:84%
And that's why whenever a system
gets infected with ransomware,

00:11:44.560 --> 00:11:46.030 align:middle line:90%
they ask you--

00:11:46.030 --> 00:11:49.150 align:middle line:84%
they essentially ask you to
pay a specific amount of money.

00:11:49.150 --> 00:11:51.310 align:middle line:84%
They'll then send
you the decryption,

00:11:51.310 --> 00:11:55.270 align:middle line:84%
the actual decryption key
to decrypt your files.

00:11:55.270 --> 00:11:58.360 align:middle line:90%
So that's how crypters work.

00:11:58.360 --> 00:12:00.180 align:middle line:84%
So those are on-desk
evasion techniques.

00:12:00.180 --> 00:12:03.610 align:middle line:84%
We then have your in-memory
evasion techniques.

00:12:03.610 --> 00:12:08.220 align:middle line:84%
So in the context of
antivirus evasion,

00:12:08.220 --> 00:12:10.470 align:middle line:84%
in-memory evasion
techniques focuses

00:12:10.470 --> 00:12:14.940 align:middle line:84%
on manipulation of memory and
does not write files to disk.

00:12:14.940 --> 00:12:17.640 align:middle line:84%
It involves injecting
payloads into a process

00:12:17.640 --> 00:12:20.520 align:middle line:84%
by leveraging
various Windows APIs.

00:12:20.520 --> 00:12:24.300 align:middle line:84%
And again, the payload
is then executed

00:12:24.300 --> 00:12:26.080 align:middle line:90%
in memory in a separate thread.

00:12:26.080 --> 00:12:32.100 align:middle line:84%
So this involves evading
antivirus detection in memory.

00:12:32.100 --> 00:12:34.950 align:middle line:84%
So this is an advanced
technique that we will not

00:12:34.950 --> 00:12:37.380 align:middle line:84%
be covering within
this section, probably

00:12:37.380 --> 00:12:40.800 align:middle line:84%
in an advanced course
or certification.

00:12:40.800 --> 00:12:45.090 align:middle line:84%
So let's actually take a look
at how we can inject shellcode

00:12:45.090 --> 00:12:48.990 align:middle line:84%
into a legitimate
executable and how

00:12:48.990 --> 00:12:52.710 align:middle line:84%
that can be used to evade
an antivirus, a very

00:12:52.710 --> 00:12:55.590 align:middle line:90%
basic antivirus detection.

00:12:55.590 --> 00:12:57.870 align:middle line:84%
And in this case,
what we'll be doing is

00:12:57.870 --> 00:13:02.200 align:middle line:84%
we'll be trying to evade Windows
Defender on a Windows 7 system.

00:13:02.200 --> 00:13:06.300 align:middle line:84%
So this video does not have a
lab environment attached to it.

00:13:06.300 --> 00:13:09.120 align:middle line:84%
As I said, you can follow
along and take a look

00:13:09.120 --> 00:13:10.740 align:middle line:90%
at the various tools I'm using.

00:13:10.740 --> 00:13:13.140 align:middle line:84%
All of these tools can be
installed on Kali Linux

00:13:13.140 --> 00:13:14.310 align:middle line:90%
without any issue.

00:13:14.310 --> 00:13:17.640 align:middle line:84%
And you can try and replicate
this within your own lab

00:13:17.640 --> 00:13:18.280 align:middle line:90%
environment.

00:13:18.280 --> 00:13:20.250 align:middle line:84%
So I'll just switch
over to my Kali VM,

00:13:20.250 --> 00:13:21.390 align:middle line:90%
and we can get started.

00:13:21.390 --> 00:13:25.970 align:middle line:90%


00:13:25.970 --> 00:13:28.960 align:middle line:84%
All right, so I'm
back on my Kali VM,

00:13:28.960 --> 00:13:31.600 align:middle line:84%
and let's get an
introduction to Shellter

00:13:31.600 --> 00:13:34.930 align:middle line:84%
because that's the actual
tool we're going to be using.

00:13:34.930 --> 00:13:37.420 align:middle line:84%
Now, you can install
Shellter on Kali Linux,

00:13:37.420 --> 00:13:40.630 align:middle line:84%
as the package is a part
of the official Kali Linux

00:13:40.630 --> 00:13:41.380 align:middle line:90%
repositories.

00:13:41.380 --> 00:13:44.770 align:middle line:84%
But you can head over to
the shellterproject.com

00:13:44.770 --> 00:13:47.090 align:middle line:84%
to learn more about
Shellter and how it works.

00:13:47.090 --> 00:13:49.570 align:middle line:84%
So let's get an
introduction to Shellter.

00:13:49.570 --> 00:13:52.960 align:middle line:84%
So Shellter is a dynamic
shellcode injection tool

00:13:52.960 --> 00:13:57.520 align:middle line:84%
and the first truly
dynamic portable executable

00:13:57.520 --> 00:13:59.300 align:middle line:90%
infector ever created.

00:13:59.300 --> 00:14:01.420 align:middle line:84%
It can be used in order
to inject shellcode

00:14:01.420 --> 00:14:03.130 align:middle line:84%
into native Windows
applications,

00:14:03.130 --> 00:14:06.430 align:middle line:84%
currently 32-bit applications
only so keep that in mind.

00:14:06.430 --> 00:14:08.890 align:middle line:84%
The shellcode can be
something yours or something

00:14:08.890 --> 00:14:12.880 align:middle line:84%
generated through a
framework such as Metasploit.

00:14:12.880 --> 00:14:15.400 align:middle line:84%
Shellter takes advantage
of the original structure

00:14:15.400 --> 00:14:18.100 align:middle line:84%
of the portable executable
file and doesn't

00:14:18.100 --> 00:14:21.490 align:middle line:84%
apply any modification, such
as changing memory access

00:14:21.490 --> 00:14:23.830 align:middle line:84%
permissions in sections,
unless the user wants

00:14:23.830 --> 00:14:26.320 align:middle line:84%
to do so, adding
an extra section

00:14:26.320 --> 00:14:28.720 align:middle line:84%
with read, write,
and execute access,

00:14:28.720 --> 00:14:32.230 align:middle line:84%
and whatever would look dodgy
under an antivirus scan.

00:14:32.230 --> 00:14:34.850 align:middle line:84%
Shellter uses a unique
dynamic approach,

00:14:34.850 --> 00:14:38.890 align:middle line:84%
which is based on the execution
flow of the target application.

00:14:38.890 --> 00:14:42.250 align:middle line:84%
And this is just the
actual tip of the iceberg.

00:14:42.250 --> 00:14:44.860 align:middle line:84%
Shellter is not
just an EPO infector

00:14:44.860 --> 00:14:48.790 align:middle line:84%
that tries to find a
location to inject or insert

00:14:48.790 --> 00:14:52.540 align:middle line:84%
an instruction into, to redirect
execution to the payload.

00:14:52.540 --> 00:14:54.880 align:middle line:84%
Unlike any other
infector, Shellters

00:14:54.880 --> 00:14:58.270 align:middle line:84%
advanced infection engine never
transfers the execution flow

00:14:58.270 --> 00:15:01.450 align:middle line:84%
to a code cave or
to an added section

00:15:01.450 --> 00:15:04.540 align:middle line:84%
in the infected portable
executable file.

00:15:04.540 --> 00:15:07.570 align:middle line:84%
All right, so the really
cool features with Shellter

00:15:07.570 --> 00:15:13.060 align:middle line:84%
is that, again, it's compatible
with Windows x86 and x64,

00:15:13.060 --> 00:15:15.970 align:middle line:84%
and it works on Windows XP
Service Pack 3 and above,

00:15:15.970 --> 00:15:17.980 align:middle line:90%
or newer versions of Windows.

00:15:17.980 --> 00:15:22.720 align:middle line:84%
And again, it works with
Wine and, of course, Linux.

00:15:22.720 --> 00:15:24.040 align:middle line:90%
It works with Wine.

00:15:24.040 --> 00:15:27.790 align:middle line:84%
So whenever you install the
Shellter package on your Linux

00:15:27.790 --> 00:15:29.530 align:middle line:84%
system, because
it's an executable,

00:15:29.530 --> 00:15:31.270 align:middle line:90%
you actually need Wine.

00:15:31.270 --> 00:15:33.730 align:middle line:84%
Wine is a compatibility
layer for Linux

00:15:33.730 --> 00:15:37.930 align:middle line:84%
that allows users on Linux
or Unix operating systems

00:15:37.930 --> 00:15:40.707 align:middle line:90%
to execute EXE files.

00:15:40.707 --> 00:15:42.290 align:middle line:84%
The great thing is
that it's portable,

00:15:42.290 --> 00:15:43.510 align:middle line:90%
so no setup is required.

00:15:43.510 --> 00:15:44.920 align:middle line:90%
It doesn't require dependencies.

00:15:44.920 --> 00:15:46.090 align:middle line:90%
That's fantastic.

00:15:46.090 --> 00:15:49.480 align:middle line:84%
It doesn't have any static
PE, or Portable Executable

00:15:49.480 --> 00:15:50.740 align:middle line:90%
templates.

00:15:50.740 --> 00:15:53.980 align:middle line:84%
It supports any 32-bit
payload, and it's

00:15:53.980 --> 00:15:56.050 align:middle line:84%
compatible with all
types of encoding

00:15:56.050 --> 00:15:59.740 align:middle line:84%
by Metasploit, compatible
with custom encoding created

00:15:59.740 --> 00:16:01.840 align:middle line:84%
by the user, so you
can specify whether you

00:16:01.840 --> 00:16:03.880 align:middle line:84%
want to go through
additional encoding.

00:16:03.880 --> 00:16:06.430 align:middle line:84%
And I've already covered,
within the Metasploit framework

00:16:06.430 --> 00:16:10.390 align:middle line:84%
course, how to encode
a payload with MSFvenom

00:16:10.390 --> 00:16:15.370 align:middle line:84%
and how that can also be used
to evade very basic antivirus

00:16:15.370 --> 00:16:18.610 align:middle line:84%
solutions that utilize
signature-based detection.

00:16:18.610 --> 00:16:21.550 align:middle line:84%
All right, so in order
to install Shellter,

00:16:21.550 --> 00:16:26.560 align:middle line:84%
you can simply type in sudo
apt-get install shellter here,

00:16:26.560 --> 00:16:28.970 align:middle line:84%
and that should install the
Shellter package for you.

00:16:28.970 --> 00:16:31.570 align:middle line:84%
However, there's a
very important aspect

00:16:31.570 --> 00:16:33.910 align:middle line:84%
that you need to take
into consideration here.

00:16:33.910 --> 00:16:37.910 align:middle line:84%
The Shellter package is
really a Windows executable.

00:16:37.910 --> 00:16:41.650 align:middle line:84%
Now, how will you run a
Windows executable on Linux?

00:16:41.650 --> 00:16:44.050 align:middle line:84%
Well, that can be
facilitated through the use

00:16:44.050 --> 00:16:46.378 align:middle line:90%
of a tool called Wine.

00:16:46.378 --> 00:16:47.920 align:middle line:84%
So you may have
heard of Wine before.

00:16:47.920 --> 00:16:50.890 align:middle line:84%
Wine is a compatibility
layer for Linux

00:16:50.890 --> 00:16:55.090 align:middle line:84%
that allows you to execute
Windows executables on a Linux

00:16:55.090 --> 00:16:57.910 align:middle line:84%
system or on a Unix
system like Mac.

00:16:57.910 --> 00:17:01.840 align:middle line:84%
So after installing the
actual Shellter package,

00:17:01.840 --> 00:17:03.970 align:middle line:90%
you then need to install Wine.

00:17:03.970 --> 00:17:07.089 align:middle line:84%
Now, the specific
architecture or the package

00:17:07.089 --> 00:17:09.849 align:middle line:84%
that we'll be installing
in regards to Wine

00:17:09.849 --> 00:17:12.220 align:middle line:90%
is the Wine 32-bit package.

00:17:12.220 --> 00:17:15.490 align:middle line:84%
And this is primarily because
Shellter only supports

00:17:15.490 --> 00:17:18.040 align:middle line:84%
32-bit payloads,
or rather supports

00:17:18.040 --> 00:17:21.760 align:middle line:84%
the generation of shellcode
of 32-bit shellcode.

00:17:21.760 --> 00:17:25.780 align:middle line:84%
So we actually need to configure
the Debian package management

00:17:25.780 --> 00:17:29.680 align:middle line:84%
utility to essentially
allow for--

00:17:29.680 --> 00:17:32.380 align:middle line:84%
allow us to install
32-bit packages.

00:17:32.380 --> 00:17:35.860 align:middle line:84%
Because right now, the
current Kali Linux VM

00:17:35.860 --> 00:17:37.870 align:middle line:90%
that I'm utilizing is 64-bit.

00:17:37.870 --> 00:17:40.630 align:middle line:84%
And the Debian package
management utility

00:17:40.630 --> 00:17:44.110 align:middle line:84%
has, of course, been already
configured to only install

00:17:44.110 --> 00:17:45.370 align:middle line:90%
64-bit packages.

00:17:45.370 --> 00:17:47.920 align:middle line:84%
So to install
32-bit packages, we

00:17:47.920 --> 00:17:50.180 align:middle line:84%
will need to run the
following command.

00:17:50.180 --> 00:17:52.690 align:middle line:90%
So we can say dpkg.

00:17:52.690 --> 00:17:55.240 align:middle line:84%
So that's the Debian
package management utility.

00:17:55.240 --> 00:17:58.550 align:middle line:90%
So dpkg, and we say add.

00:17:58.550 --> 00:18:02.335 align:middle line:90%
And we can say architecture.

00:18:02.335 --> 00:18:03.960 align:middle line:84%
Oh, let me just type
that in correctly.

00:18:03.960 --> 00:18:05.790 align:middle line:90%
So that's architecture.

00:18:05.790 --> 00:18:08.310 align:middle line:90%
And we then specify i386.

00:18:08.310 --> 00:18:11.940 align:middle line:90%
That's for 32 bits, so i386.

00:18:11.940 --> 00:18:14.800 align:middle line:90%
And we can then hit Enter.

00:18:14.800 --> 00:18:17.930 align:middle line:84%
And in some cases, it may
ask you for root permissions.

00:18:17.930 --> 00:18:20.650 align:middle line:84%
So I'll say sudo dpkg
--add-architecture.

00:18:20.650 --> 00:18:21.770 align:middle line:90%
And that's done.

00:18:21.770 --> 00:18:24.640 align:middle line:90%
I can now install wine32.

00:18:24.640 --> 00:18:31.810 align:middle line:84%
So I can say sudo
apt-get install wine32,

00:18:31.810 --> 00:18:34.120 align:middle line:84%
which I currently already
have, as you can see.

00:18:34.120 --> 00:18:36.250 align:middle line:84%
And I'm currently using
the latest version.

00:18:36.250 --> 00:18:38.420 align:middle line:84%
And that has been
installed successfully.

00:18:38.420 --> 00:18:42.280 align:middle line:84%
So at this point, you can now
execute the Shellter executable

00:18:42.280 --> 00:18:45.470 align:middle line:84%
with Wine, or with
wine32 in this case.

00:18:45.470 --> 00:18:49.565 align:middle line:84%
So let's take a look
at how we can do that.

00:18:49.565 --> 00:18:55.040 align:middle line:84%
You can head over into
/usr/share/windows-resources/,

00:18:55.040 --> 00:18:57.470 align:middle line:84%
not windows-binaries,
but windows-resources.

00:18:57.470 --> 00:18:59.870 align:middle line:84%
And you'll have a
folder called Shellter.

00:18:59.870 --> 00:19:02.280 align:middle line:84%
So within the
Shellter directory,

00:19:02.280 --> 00:19:05.330 align:middle line:84%
you can see that you'll pretty
much only have the Shellter

00:19:05.330 --> 00:19:06.080 align:middle line:90%
executable.

00:19:06.080 --> 00:19:08.690 align:middle line:84%
Disregard these two
folders as these folders

00:19:08.690 --> 00:19:10.910 align:middle line:84%
will be created
once you actually

00:19:10.910 --> 00:19:13.160 align:middle line:90%
execute Shellter itself.

00:19:13.160 --> 00:19:14.690 align:middle line:90%
So we have shellter.exe.

00:19:14.690 --> 00:19:17.630 align:middle line:84%
So how do you execute
an EXE file on Linux?

00:19:17.630 --> 00:19:20.330 align:middle line:90%
Well, we can do that with Wine.

00:19:20.330 --> 00:19:24.260 align:middle line:84%
So in order to execute, we
would say, sudo wine, and then

00:19:24.260 --> 00:19:29.118 align:middle line:90%
the actual EXE, so shellter.exe.

00:19:29.118 --> 00:19:29.660 align:middle line:90%
There we are.

00:19:29.660 --> 00:19:33.030 align:middle line:84%
I'll hit Enter, and that's
going to start up Shellter.

00:19:33.030 --> 00:19:36.000 align:middle line:84%
So we don't have any issues
there, and we can get started.

00:19:36.000 --> 00:19:41.040 align:middle line:84%
So let's get started with
the actual injection process.

00:19:41.040 --> 00:19:42.530 align:middle line:84%
However, before we
do that, we need

00:19:42.530 --> 00:19:46.370 align:middle line:84%
to identify a legitimate
executable that we can actually

00:19:46.370 --> 00:19:48.170 align:middle line:90%
inject our shellcode into.

00:19:48.170 --> 00:19:51.620 align:middle line:84%
So this is where the whole
social engineering aspect

00:19:51.620 --> 00:19:53.550 align:middle line:90%
of things comes into play.

00:19:53.550 --> 00:19:55.820 align:middle line:84%
So you can download
an executable.

00:19:55.820 --> 00:19:57.560 align:middle line:84%
I would recommend
that the executable

00:19:57.560 --> 00:20:00.860 align:middle line:84%
is very small and
very simplistic

00:20:00.860 --> 00:20:02.930 align:middle line:90%
in terms of its functionality.

00:20:02.930 --> 00:20:04.640 align:middle line:84%
This will probably
not work if you try

00:20:04.640 --> 00:20:09.110 align:middle line:84%
and inject your shellcode into
an executable like the Chrome

00:20:09.110 --> 00:20:12.690 align:middle line:84%
installer or VLC or
anything like that.

00:20:12.690 --> 00:20:17.390 align:middle line:84%
So on the Kali Linux system,
if I head over into the file

00:20:17.390 --> 00:20:23.500 align:middle line:84%
system here under
usr and under share

00:20:23.500 --> 00:20:25.810 align:middle line:84%
we have a directory
called windows-binaries

00:20:25.810 --> 00:20:29.470 align:middle line:84%
that contains a list
of executables that,

00:20:29.470 --> 00:20:31.390 align:middle line:84%
again, are used
during a pen test

00:20:31.390 --> 00:20:34.040 align:middle line:90%
or during a security assessment.

00:20:34.040 --> 00:20:36.320 align:middle line:90%
And one of them is VNC Viewer.

00:20:36.320 --> 00:20:38.510 align:middle line:84%
So if you're not
familiar with VNC Viewer,

00:20:38.510 --> 00:20:40.390 align:middle line:84%
this is a very simple
Windows program.

00:20:40.390 --> 00:20:41.690 align:middle line:90%
It's not malicious at all.

00:20:41.690 --> 00:20:44.800 align:middle line:84%
It's completely legitimate,
and it's essentially

00:20:44.800 --> 00:20:48.430 align:middle line:84%
used to connect to a VNC
session or to essentially

00:20:48.430 --> 00:20:50.350 align:middle line:90%
establish a VNC session.

00:20:50.350 --> 00:20:52.180 align:middle line:84%
So it's just a
utility that allows

00:20:52.180 --> 00:20:56.110 align:middle line:84%
you to essentially connect to
a server or to a target system

00:20:56.110 --> 00:20:58.100 align:middle line:90%
and establish a VNC session.

00:20:58.100 --> 00:21:01.180 align:middle line:84%
So we can inject our shellcode
into this executable.

00:21:01.180 --> 00:21:04.360 align:middle line:84%
So I'll just make a copy, and
I'll head over into my desktop,

00:21:04.360 --> 00:21:08.500 align:middle line:84%
and I'll go into a folder called
AVBypass, which I created.

00:21:08.500 --> 00:21:10.490 align:middle line:84%
And I recommend that
you do the same.

00:21:10.490 --> 00:21:12.873 align:middle line:84%
So this is the
original executable.

00:21:12.873 --> 00:21:14.290 align:middle line:84%
Now, the great
thing with Shellter

00:21:14.290 --> 00:21:17.170 align:middle line:84%
is that whenever you perform
the injection, a copy of this

00:21:17.170 --> 00:21:18.200 align:middle line:90%
will be made.

00:21:18.200 --> 00:21:20.500 align:middle line:84%
So a backup of the
original will be made,

00:21:20.500 --> 00:21:24.040 align:middle line:84%
and it will actually be stored
under the /usr/share/windows

00:21:24.040 --> 00:21:28.090 align:middle line:84%
resources/shellter directory,
within Shellter_Backups.

00:21:28.090 --> 00:21:30.640 align:middle line:84%
So you can always get
the original back.

00:21:30.640 --> 00:21:33.760 align:middle line:84%
But now that we've identified
the actual legitimate

00:21:33.760 --> 00:21:37.300 align:middle line:84%
executable that we would like
to inject our shellcode into,

00:21:37.300 --> 00:21:39.160 align:middle line:84%
and we have saved it
within a directory

00:21:39.160 --> 00:21:40.930 align:middle line:84%
that we are familiar
with, we can actually

00:21:40.930 --> 00:21:43.070 align:middle line:90%
begin the injection process.

00:21:43.070 --> 00:21:46.620 align:middle line:84%
So I'll just launch
Shellter again.

00:21:46.620 --> 00:21:49.440 align:middle line:84%
And it's going to ask you to
choose your operation mode.

00:21:49.440 --> 00:21:51.490 align:middle line:84%
For the purpose of
this demonstration,

00:21:51.490 --> 00:21:53.220 align:middle line:90%
I'm going to say auto.

00:21:53.220 --> 00:21:55.180 align:middle line:90%
We then have the PE target.

00:21:55.180 --> 00:21:57.270 align:middle line:84%
This is the Portable
Executable target,

00:21:57.270 --> 00:21:59.460 align:middle line:84%
or the legitimate executable
that you would like

00:21:59.460 --> 00:22:01.530 align:middle line:90%
to inject your shellcode into.

00:22:01.530 --> 00:22:04.920 align:middle line:84%
You need to specify the path
to the actual executable.

00:22:04.920 --> 00:22:08.370 align:middle line:84%
In this case, mine is
being stored under Home,

00:22:08.370 --> 00:22:12.400 align:middle line:84%
under the Kali
directory on my desktop,

00:22:12.400 --> 00:22:13.795 align:middle line:90%
in a folder called AVBypass.

00:22:13.795 --> 00:22:17.420 align:middle line:90%


00:22:17.420 --> 00:22:22.490 align:middle line:84%
And the name of the
executable is vncviewer.exe.

00:22:22.490 --> 00:22:23.583 align:middle line:90%
So I'll hit Enter.

00:22:23.583 --> 00:22:25.250 align:middle line:84%
You can see it's going
to make a backup,

00:22:25.250 --> 00:22:29.630 align:middle line:84%
and it will store it under
Shellter_Backupsvncviewer.exe.

00:22:29.630 --> 00:22:32.630 align:middle line:84%
It's then going to, again,
take a look at whether or not

00:22:32.630 --> 00:22:34.550 align:middle line:90%
the executable has been packed.

00:22:34.550 --> 00:22:36.770 align:middle line:84%
You can see that
it's not packed.

00:22:36.770 --> 00:22:39.890 align:middle line:84%
It'll then move on to
PE Info Elimination.

00:22:39.890 --> 00:22:43.160 align:middle line:84%
It'll take a look at
the Dll characteristics,

00:22:43.160 --> 00:22:45.600 align:middle line:84%
and it'll provide
you the status here.

00:22:45.600 --> 00:22:48.230 align:middle line:84%
So all related information
has been eliminated.

00:22:48.230 --> 00:22:50.960 align:middle line:84%
So that's changing the
signature as much as possible.

00:22:50.960 --> 00:22:52.440 align:middle line:90%
You then have your Tracing Mode.

00:22:52.440 --> 00:22:55.155 align:middle line:84%
So again, if you take a
look at the note here,

00:22:55.155 --> 00:22:56.780 align:middle line:84%
you can see that in
Auto Mode, Shellter

00:22:56.780 --> 00:22:58.940 align:middle line:84%
will trace a random
number of instructions

00:22:58.940 --> 00:23:02.300 align:middle line:84%
for a maximum time of
approximately 30 seconds

00:23:02.300 --> 00:23:06.080 align:middle line:84%
in native Windows hosts and for
60 seconds when used in Wine.

00:23:06.080 --> 00:23:08.960 align:middle line:84%
So it's essentially
tracing and identifying

00:23:08.960 --> 00:23:12.350 align:middle line:84%
instructions where the
shellcode can be injected into.

00:23:12.350 --> 00:23:17.280 align:middle line:84%
So I'll give this, as it
says, up to 60 seconds.

00:23:17.280 --> 00:23:19.030 align:middle line:84%
All right, so as you
can see, that's done.

00:23:19.030 --> 00:23:21.960 align:middle line:84%
And it's going to tell
you Instructions Traced--

00:23:21.960 --> 00:23:25.200 align:middle line:90%
18,574.

00:23:25.200 --> 00:23:27.540 align:middle line:84%
It's then going to start
the first stage filtering.

00:23:27.540 --> 00:23:29.040 align:middle line:84%
So it's going to
ask you whether you

00:23:29.040 --> 00:23:30.810 align:middle line:90%
want to enable Stealth Mode.

00:23:30.810 --> 00:23:33.120 align:middle line:84%
Stealth Mode-- this is
a very important step

00:23:33.120 --> 00:23:37.470 align:middle line:84%
because what it's asking you is
whether you want the executable

00:23:37.470 --> 00:23:39.550 align:middle line:90%
to function as intended.

00:23:39.550 --> 00:23:42.450 align:middle line:84%
So for example, in this case,
we are injecting the shellcode

00:23:42.450 --> 00:23:44.370 align:middle line:90%
into vncviewer.exe.

00:23:44.370 --> 00:23:48.450 align:middle line:84%
So it's asking us whether or not
we want VNC Viewer to actually

00:23:48.450 --> 00:23:51.750 align:middle line:84%
function as normal, or to
actually function normally

00:23:51.750 --> 00:23:52.960 align:middle line:90%
when executed.

00:23:52.960 --> 00:23:57.042 align:middle line:84%
So if we want that to happen,
which I recommend that you do,

00:23:57.042 --> 00:23:59.190 align:middle line:90%
I would enable Stealth Mode.

00:23:59.190 --> 00:24:02.190 align:middle line:84%
So what that means is that
whenever the target will click

00:24:02.190 --> 00:24:05.940 align:middle line:84%
on the new VNC Viewer that
we are going to be generating

00:24:05.940 --> 00:24:08.640 align:middle line:84%
or that contains the
injected shellcode,

00:24:08.640 --> 00:24:10.620 align:middle line:84%
VNC viewer will
function as normal,

00:24:10.620 --> 00:24:13.830 align:middle line:84%
but the shellcode will be
executed in the background.

00:24:13.830 --> 00:24:16.170 align:middle line:90%
So we'll say Yes.

00:24:16.170 --> 00:24:19.590 align:middle line:84%
It's then going to ask
you for the payload

00:24:19.590 --> 00:24:20.680 align:middle line:90%
that you'd like to use.

00:24:20.680 --> 00:24:22.470 align:middle line:84%
So this is where the
shellcode injection

00:24:22.470 --> 00:24:24.100 align:middle line:90%
process comes into play.

00:24:24.100 --> 00:24:27.360 align:middle line:84%
So again, you can obtain
a Meterpreter session

00:24:27.360 --> 00:24:28.060 align:middle line:90%
on the target.

00:24:28.060 --> 00:24:30.330 align:middle line:84%
And you can, again,
identify which

00:24:30.330 --> 00:24:32.910 align:middle line:84%
of these stages or payloads
you would like to use.

00:24:32.910 --> 00:24:35.640 align:middle line:84%
And based on your
option, it's then

00:24:35.640 --> 00:24:37.990 align:middle line:84%
going to generate the
shellcode appropriately.

00:24:37.990 --> 00:24:40.770 align:middle line:84%
So for example, if I wanted to
obtain a Meterpreter session,

00:24:40.770 --> 00:24:42.420 align:middle line:90%
I could use option 1.

00:24:42.420 --> 00:24:44.460 align:middle line:84%
So it's going to ask you
whether you want to use

00:24:44.460 --> 00:24:46.380 align:middle line:90%
a listed payload or custom.

00:24:46.380 --> 00:24:51.780 align:middle line:84%
Now, if you want to go ahead and
encode a payload with MSFvenom

00:24:51.780 --> 00:24:54.510 align:middle line:84%
firstly, or you want to
generate a Meterpreter payload

00:24:54.510 --> 00:24:56.190 align:middle line:84%
and then encode
it with MSFvenom,

00:24:56.190 --> 00:25:00.540 align:middle line:84%
you can do that and then specify
a custom, a [? DDC ?] option

00:25:00.540 --> 00:25:03.815 align:middle line:84%
here, and then use that
actual payload itself.

00:25:03.815 --> 00:25:06.190 align:middle line:84%
However, in this case, we are
not going to be doing that.

00:25:06.190 --> 00:25:07.830 align:middle line:90%
So I'll just say option 1.

00:25:07.830 --> 00:25:10.920 align:middle line:84%
Or I'll say L first to
use a listed payload.

00:25:10.920 --> 00:25:12.810 align:middle line:84%
And then I'll say--
it's going to ask you

00:25:12.810 --> 00:25:14.500 align:middle line:90%
to select the payload by index.

00:25:14.500 --> 00:25:15.960 align:middle line:90%
So I'll say option 1.

00:25:15.960 --> 00:25:18.280 align:middle line:84%
It's going to ask me for
my L host information.

00:25:18.280 --> 00:25:20.700 align:middle line:84%
So this is going to be
the attacker's IP address.

00:25:20.700 --> 00:25:25.920 align:middle line:84%
And in my case, my Kali
Linux IP is 10.10.10.10.

00:25:25.920 --> 00:25:28.590 align:middle line:90%
The port is 1234.

00:25:28.590 --> 00:25:30.620 align:middle line:90%
I'll hit Enter.

00:25:30.620 --> 00:25:34.580 align:middle line:84%
And it's now going to begin
the basic obfuscation.

00:25:34.580 --> 00:25:38.570 align:middle line:84%
And we can see it right over
here, PolyMorphic Junk Code.

00:25:38.570 --> 00:25:42.160 align:middle line:84%
It's going to generate
some junk code there.

00:25:42.160 --> 00:25:45.460 align:middle line:84%
And the most important
stage is right over here.

00:25:45.460 --> 00:25:47.620 align:middle line:84%
So Injection Stage,
it's going to tell you

00:25:47.620 --> 00:25:49.960 align:middle line:84%
where the shellcode
has been injected.

00:25:49.960 --> 00:25:55.300 align:middle line:84%
And you can see right over
here, under PE Checksum Fix,

00:25:55.300 --> 00:25:58.330 align:middle line:84%
the valid PE checksum
has been set.

00:25:58.330 --> 00:26:01.660 align:middle line:84%
And under Verification,
you can see that that--

00:26:01.660 --> 00:26:03.340 align:middle line:84%
right over here,
injection verified,

00:26:03.340 --> 00:26:05.660 align:middle line:84%
and we can hit
Enter to continue.

00:26:05.660 --> 00:26:10.840 align:middle line:84%
So we now have VNC Viewer,
but the new executable

00:26:10.840 --> 00:26:12.370 align:middle line:90%
has the injected shellcode.

00:26:12.370 --> 00:26:15.400 align:middle line:84%
So remember, when I said
that Shellter actually

00:26:15.400 --> 00:26:17.410 align:middle line:84%
takes a backup, it
does that for a reason.

00:26:17.410 --> 00:26:21.370 align:middle line:84%
Because the new executable
is going to replace the one

00:26:21.370 --> 00:26:24.130 align:middle line:84%
that was stored
within the directory,

00:26:24.130 --> 00:26:26.030 align:middle line:84%
so within this
particular directory.

00:26:26.030 --> 00:26:30.070 align:middle line:84%
So remember, I copied over
the legitimate vncviewer.exe

00:26:30.070 --> 00:26:32.080 align:middle line:90%
to the AVBypass folder.

00:26:32.080 --> 00:26:34.540 align:middle line:84%
And this is now the
malicious executable.

00:26:34.540 --> 00:26:36.250 align:middle line:90%
So it will take a backup first.

00:26:36.250 --> 00:26:37.930 align:middle line:84%
It'll then perform
the injection.

00:26:37.930 --> 00:26:40.000 align:middle line:84%
And it's going to
replace the older

00:26:40.000 --> 00:26:42.010 align:middle line:90%
one with the new malicious one.

00:26:42.010 --> 00:26:44.980 align:middle line:84%
So I can now copy this
over to the target system,

00:26:44.980 --> 00:26:47.740 align:middle line:84%
and you'll see that it looks
exactly like VNC Viewer.

00:26:47.740 --> 00:26:50.050 align:middle line:84%
It'll function exactly
like VNC Viewer.

00:26:50.050 --> 00:26:52.690 align:middle line:84%
The only difference is that
when it will be executed,

00:26:52.690 --> 00:26:55.660 align:middle line:84%
it will execute the
shellcode, our Meterpreter

00:26:55.660 --> 00:26:57.460 align:middle line:84%
payload shellcode,
and it'll then

00:26:57.460 --> 00:27:00.010 align:middle line:84%
connect back to our
reverse tcp handler

00:27:00.010 --> 00:27:02.810 align:middle line:84%
that we will set up in the
Metasploit framework right now.

00:27:02.810 --> 00:27:05.020 align:middle line:84%
So the first thing
I want to do is

00:27:05.020 --> 00:27:07.720 align:middle line:84%
I'm just going to set
up, or launch msfconsole

00:27:07.720 --> 00:27:09.880 align:middle line:84%
to set up the handler to
receive the connection

00:27:09.880 --> 00:27:12.950 align:middle line:84%
once the shellcode is
executed on the target.

00:27:12.950 --> 00:27:14.890 align:middle line:84%
So I'll give this a
couple of seconds.

00:27:14.890 --> 00:27:18.500 align:middle line:84%
And I'll split my
terminal vertically here

00:27:18.500 --> 00:27:20.030 align:middle line:84%
because we actually
need to transfer

00:27:20.030 --> 00:27:21.540 align:middle line:90%
that executable to the target.

00:27:21.540 --> 00:27:23.180 align:middle line:84%
So I'll navigate
to the directory

00:27:23.180 --> 00:27:26.490 align:middle line:84%
where the malicious VNC
Viewer executable is stored.

00:27:26.490 --> 00:27:28.730 align:middle line:90%
So that's under AVBypass.

00:27:28.730 --> 00:27:31.380 align:middle line:84%
And I can start a
simple web server.

00:27:31.380 --> 00:27:34.410 align:middle line:90%
So I can use the Python module.

00:27:34.410 --> 00:27:37.640 align:middle line:90%
So I'll say sudo python.

00:27:37.640 --> 00:27:40.610 align:middle line:90%
I can say python3 -m.

00:27:40.610 --> 00:27:42.680 align:middle line:90%
We can say http.server.

00:27:42.680 --> 00:27:44.250 align:middle line:90%
And on port 80.

00:27:44.250 --> 00:27:48.980 align:middle line:84%
So I'll host all the files
within the AVBypass directory

00:27:48.980 --> 00:27:52.680 align:middle line:90%
on the Kali Linux IP on port 80.

00:27:52.680 --> 00:27:53.370 align:middle line:90%
So there we are.

00:27:53.370 --> 00:27:55.190 align:middle line:84%
That's serving all
of those files.

00:27:55.190 --> 00:27:57.140 align:middle line:84%
Now in the Metasploit
window here, I'll

00:27:57.140 --> 00:28:00.650 align:middle line:84%
say, use multi/handler to set
up the handler or the listener.

00:28:00.650 --> 00:28:04.460 align:middle line:84%
And then I'll specify the
payload that I used when I was

00:28:04.460 --> 00:28:07.310 align:middle line:84%
essentially generating the
shellcode within Shellter,

00:28:07.310 --> 00:28:09.620 align:middle line:84%
which, in this case,
in the case of Windows,

00:28:09.620 --> 00:28:11.750 align:middle line:84%
if you selected the
Meterpreter option,

00:28:11.750 --> 00:28:16.280 align:middle line:84%
is always going to be the actual
32-bit Meterpreter payload,

00:28:16.280 --> 00:28:18.560 align:middle line:84%
so
windows/meterpreter/reverse_tcp.

00:28:18.560 --> 00:28:22.460 align:middle line:90%


00:28:22.460 --> 00:28:24.590 align:middle line:84%
All right, I then need to
set up my LHOST option.

00:28:24.590 --> 00:28:26.382 align:middle line:84%
And of course, these
have to match the ones

00:28:26.382 --> 00:28:29.480 align:middle line:84%
that you had set when
generating the actual shellcode

00:28:29.480 --> 00:28:32.210 align:middle line:84%
within Shellter, so
my Kali Linux IP.

00:28:32.210 --> 00:28:36.650 align:middle line:84%
And then LPORT, we
had specified as 1234.

00:28:36.650 --> 00:28:39.820 align:middle line:90%
And I can hit run.

00:28:39.820 --> 00:28:43.750 align:middle line:84%
And we can now, again,
transfer over that executable.

00:28:43.750 --> 00:28:45.890 align:middle line:84%
So I'll switch over to
the Windows 7 system.

00:28:45.890 --> 00:28:48.970 align:middle line:84%
Now the Windows 7 system has
Windows Defender enabled,

00:28:48.970 --> 00:28:51.100 align:middle line:84%
but it's an older
version of Windows 7.

00:28:51.100 --> 00:28:56.080 align:middle line:90%
It's Windows 7 build 7600, or--

00:28:56.080 --> 00:28:58.030 align:middle line:90%
and build 7601.

00:28:58.030 --> 00:29:02.200 align:middle line:84%
And it has-- it's actually a
Service Pack 1 installation.

00:29:02.200 --> 00:29:06.820 align:middle line:84%
So let's actually see if we are
able to bypass basic Windows

00:29:06.820 --> 00:29:07.540 align:middle line:90%
Defender.

00:29:07.540 --> 00:29:10.870 align:middle line:84%
So let me just switch over
to the Windows system.

00:29:10.870 --> 00:29:13.510 align:middle line:84%
All right, so I'm back
on the Windows system.

00:29:13.510 --> 00:29:16.780 align:middle line:84%
And again, now, the
method of delivering

00:29:16.780 --> 00:29:20.857 align:middle line:84%
the actual malicious executable
is entirely up to you.

00:29:20.857 --> 00:29:23.440 align:middle line:84%
I'm just going to be downloading
it from the web server that I

00:29:23.440 --> 00:29:26.038 align:middle line:90%
set up, so 10.10.10.

00:29:26.038 --> 00:29:27.793 align:middle line:90%
And we have VNC Viewer there.

00:29:27.793 --> 00:29:28.960 align:middle line:90%
So I'll click on that there.

00:29:28.960 --> 00:29:32.170 align:middle line:84%
Save-- I'll save
it in downloads.

00:29:32.170 --> 00:29:35.590 align:middle line:84%
And it looks like we haven't
had any detection yet.

00:29:35.590 --> 00:29:38.470 align:middle line:84%
So it's been saved
on disk there.

00:29:38.470 --> 00:29:40.220 align:middle line:84%
If we take a look at
the Downloads folder,

00:29:40.220 --> 00:29:43.580 align:middle line:84%
you can see that it looks
exactly like VNC Viewer here.

00:29:43.580 --> 00:29:45.220 align:middle line:84%
So I can also move
it to the desktop

00:29:45.220 --> 00:29:48.160 align:middle line:84%
just so that you can see
the icon even more clearly.

00:29:48.160 --> 00:29:53.060 align:middle line:84%
I think I've zoomed in too much
there so let me just zoom out.

00:29:53.060 --> 00:29:55.140 align:middle line:90%
And let me refresh that there.

00:29:55.140 --> 00:29:58.040 align:middle line:84%
And we can see the
VNC Viewer icon here.

00:29:58.040 --> 00:29:59.760 align:middle line:84%
And let me just get
rid of that there.

00:29:59.760 --> 00:30:03.440 align:middle line:84%
So again, if I click on it,
it should work exactly the way

00:30:03.440 --> 00:30:05.280 align:middle line:90%
VNC Viewer should work.

00:30:05.280 --> 00:30:07.490 align:middle line:84%
However, in the background,
what's going to happen

00:30:07.490 --> 00:30:10.970 align:middle line:84%
is it's going to execute
the actual shellcode that we

00:30:10.970 --> 00:30:12.060 align:middle line:90%
injected into it.

00:30:12.060 --> 00:30:16.430 align:middle line:84%
So I'll double click on it,
Run, and you can see it works.

00:30:16.430 --> 00:30:18.680 align:middle line:84%
It works as intended,
and a person can actually

00:30:18.680 --> 00:30:21.050 align:middle line:84%
use this for
legitimate purposes,

00:30:21.050 --> 00:30:25.080 align:middle line:84%
but it had malicious
shellcode injected into it.

00:30:25.080 --> 00:30:28.550 align:middle line:84%
So this particular
executable has not

00:30:28.550 --> 00:30:30.200 align:middle line:84%
been detected by
Windows Defender.

00:30:30.200 --> 00:30:32.960 align:middle line:84%
So if I switch back
over to Kali Linux,

00:30:32.960 --> 00:30:37.211 align:middle line:84%
you should see that I have
received a Meterpreter session

00:30:37.211 --> 00:30:40.520 align:middle line:90%
on my multi/handler listener.

00:30:40.520 --> 00:30:42.060 align:middle line:90%
So I'm back on Kali Linux.

00:30:42.060 --> 00:30:43.970 align:middle line:84%
And as you can see,
we made a GET request,

00:30:43.970 --> 00:30:47.010 align:middle line:84%
where we downloaded VNC
Viewer on the target system.

00:30:47.010 --> 00:30:50.840 align:middle line:84%
And once it was executed, we
obtained a Meterpreter session

00:30:50.840 --> 00:30:52.200 align:middle line:90%
on the target system.

00:30:52.200 --> 00:30:54.050 align:middle line:90%
So I can say sysinfo.

00:30:54.050 --> 00:30:58.370 align:middle line:84%
And you can see Windows 7
Build 7601 Service Pack 1.

00:30:58.370 --> 00:31:00.680 align:middle line:84%
And I can say get
user ID, for example.

00:31:00.680 --> 00:31:03.180 align:middle line:84%
And we're currently
as the Windows 7 user.

00:31:03.180 --> 00:31:05.780 align:middle line:84%
So that is how to
inject shellcode

00:31:05.780 --> 00:31:09.410 align:middle line:84%
into a legitimate executable
for the purpose of evading

00:31:09.410 --> 00:31:12.350 align:middle line:84%
signature-based
antivirus solutions.

00:31:12.350 --> 00:31:15.590 align:middle line:84%
And that is going to conclude
the practical demonstration

00:31:15.590 --> 00:31:17.550 align:middle line:90%
side of this video.

00:31:17.550 --> 00:31:21.320 align:middle line:84%
All right, so that
concludes the first video

00:31:21.320 --> 00:31:22.580 align:middle line:90%
within this section.

00:31:22.580 --> 00:31:24.980 align:middle line:84%
In the next video, we're going
to be taking a look at how

00:31:24.980 --> 00:31:30.500 align:middle line:84%
we can obfuscate PowerShell code
in order to evade antivirus--

00:31:30.500 --> 00:31:33.610 align:middle line:84%
in order to evade detection
by antivirus solutions.

00:31:33.610 --> 00:31:37.510 align:middle line:84%
So I'll be seeing you
in the next video.

00:31:37.510 --> 00:31:38.116 align:middle line:90%