﻿WEBVTT

00:00:15.840 --> 00:00:18.810
[MUSIC PLAYING]

00:00:27.740 --> 00:00:30.710
Welcome to the Hacker House
Hands On Hacking mass theory

00:00:30.710 --> 00:00:31.460
module.

00:00:31.460 --> 00:00:33.350
We're now going to
walk through some

00:00:33.350 --> 00:00:35.600
of the theoretical background
necessary to complete

00:00:35.600 --> 00:00:38.630
the practical elements
of this course module.

00:00:38.630 --> 00:00:40.340
So this element of
the course, now,

00:00:40.340 --> 00:00:42.710
is the seventh
module in our course.

00:00:42.710 --> 00:00:45.350
And we're going to shift
our perspective now.

00:00:45.350 --> 00:00:47.540
Previously we've been dealing
with network perimeter

00:00:47.540 --> 00:00:48.200
technologies.

00:00:48.200 --> 00:00:52.940
We've been dealing with web
services, mail services, VPN

00:00:52.940 --> 00:00:57.560
services, DNS services, and
public internet footprints.

00:00:57.560 --> 00:00:59.870
We're now going to switch
our perspective and viewpoint

00:00:59.870 --> 00:01:02.300
from the attacker as though
we have breached a perimeter.

00:01:02.300 --> 00:01:04.819
We've either gained access
to an internal network.

00:01:04.819 --> 00:01:06.650
Perhaps we've used
a hardware implant,

00:01:06.650 --> 00:01:08.900
something like
Hostile or Pineapple

00:01:08.900 --> 00:01:11.000
to install into the environment.

00:01:11.000 --> 00:01:12.920
And we've gained some
kind of remote shell.

00:01:12.920 --> 00:01:15.530
And we're able to target
systems internally.

00:01:15.530 --> 00:01:17.900
So we're now thinking of
an internal perspective.

00:01:17.900 --> 00:01:19.650
We're plugged into a company.

00:01:19.650 --> 00:01:21.390
We've gained access to a VPN.

00:01:21.390 --> 00:01:23.355
We're somehow
inside the company.

00:01:23.355 --> 00:01:24.980
And these are the
kinds of technologies

00:01:24.980 --> 00:01:27.890
now that we will explore
that we would see more likely

00:01:27.890 --> 00:01:29.240
on an inside of a company.

00:01:29.240 --> 00:01:31.760
Not exclusively, you do
sometimes see them on the web.

00:01:31.760 --> 00:01:33.470
However, things like
network attached

00:01:33.470 --> 00:01:37.640
storage, database servers,
and Windows Enterprise

00:01:37.640 --> 00:01:40.723
architecture, Unix server
estates, and things like that.

00:01:40.723 --> 00:01:42.890
Things of that nature that
you might see more likely

00:01:42.890 --> 00:01:43.867
on an internal network.

00:01:44.367 --> 00:01:46.702
[MUSIC PLAYING]

00:01:50.440 --> 00:01:52.230
So we've got hands
on hacking NAS.

00:01:52.230 --> 00:01:54.420
So this is network
attached storage.

00:01:54.420 --> 00:01:56.820
So this module is all
about file sharing.

00:01:56.820 --> 00:01:58.800
So most companies,
most businesses,

00:01:58.800 --> 00:02:01.290
will have a way for
employees to share files.

00:02:01.290 --> 00:02:03.150
They'll share information
amongst each other

00:02:03.150 --> 00:02:04.950
either through a
network file share,

00:02:04.950 --> 00:02:08.490
or through some kind of
mapping, or some way to share

00:02:08.490 --> 00:02:09.620
information.

00:02:09.620 --> 00:02:13.350
And these network attached
storages, or those storage area

00:02:13.350 --> 00:02:16.780
networks, they can come in
all kinds of different shapes,

00:02:16.780 --> 00:02:18.780
sizes, different varieties.

00:02:18.780 --> 00:02:21.540
And they have a number of
commonly used file transfer

00:02:21.540 --> 00:02:22.380
protocols.

00:02:22.380 --> 00:02:25.740
And in fact, this lab module
is based on commonly seen NAS

00:02:25.740 --> 00:02:26.520
appliances.

00:02:26.520 --> 00:02:29.280
In fact, one such appliance
is on my desk over here,

00:02:29.280 --> 00:02:31.667
which has been found to be
vulnerable to these same kind

00:02:31.667 --> 00:02:32.500
of attacks, as well.

00:02:32.500 --> 00:02:34.625
So we're going to show you
a number of common kinds

00:02:34.625 --> 00:02:37.770
of attacks that you might try
against different file services

00:02:37.770 --> 00:02:39.528
and file storage solutions.

00:02:39.528 --> 00:02:41.070
And these kinds of
things are usually

00:02:41.070 --> 00:02:42.270
connected to fast networks.

00:02:42.270 --> 00:02:45.540
They usually in an
organization, they

00:02:45.540 --> 00:02:47.220
don't want to have a
lot of bottlenecks.

00:02:47.220 --> 00:02:48.720
They're usually in
a good position.

00:02:48.720 --> 00:02:50.580
They usually have strong--

00:02:50.580 --> 00:02:53.430
they're usually well-connected,
for instance, internally.

00:02:53.430 --> 00:02:54.873
And may have some fast feed.

00:02:54.873 --> 00:02:56.790
Therefore, they're a
good target for all kinds

00:02:56.790 --> 00:02:57.960
of nefarious activities.

00:02:57.960 --> 00:03:01.860
Whether that's software
piracy, video gaming,

00:03:01.860 --> 00:03:04.790
fraudulent activity, data theft.

00:03:04.790 --> 00:03:07.200
They're generally
fairly well targeted

00:03:07.200 --> 00:03:09.660
systems, because that's
where all your data often is.

00:03:09.660 --> 00:03:11.100
So network attached
storage comes

00:03:11.100 --> 00:03:12.350
in different shapes and sizes.

00:03:12.850 --> 00:03:15.468
[MUSIC PLAYING]

00:03:18.920 --> 00:03:20.370
File transfer protocol.

00:03:20.370 --> 00:03:22.940
One of the very simplistic
ways of transferring

00:03:22.940 --> 00:03:25.880
files, operates over
TCP port number 21.

00:03:25.880 --> 00:03:28.010
Defined in RFC 959.

00:03:28.010 --> 00:03:29.880
This can be configured
for anonymous access.

00:03:29.880 --> 00:03:31.820
So you can log into an
FTP site for anonymous,

00:03:31.820 --> 00:03:34.420
and then be able to browse
through information and data.

00:03:34.420 --> 00:03:36.457
And FTP is also a
clear text protocol.

00:03:36.457 --> 00:03:38.540
So it can be subject to
man-in-the-middle attacks.

00:03:38.540 --> 00:03:42.200
If you're into man-in-the-middle
capabilities then you would be

00:03:42.200 --> 00:03:45.072
able to see user names and
passwords in clear text.

00:03:45.072 --> 00:03:46.280
It's not really a common way.

00:03:46.280 --> 00:03:47.490
It's kind of an annoying way.

00:03:47.490 --> 00:03:49.280
Your receptionist at
a company might not

00:03:49.280 --> 00:03:51.740
want to share a file with
Jim on the fifth floor

00:03:51.740 --> 00:03:53.285
by sending it to him via FTP.

00:03:53.285 --> 00:03:54.660
Seems a little
bit of a headache.

00:03:54.660 --> 00:03:56.952
So it's unlikely that this
is going to be the main way.

00:03:56.952 --> 00:03:59.080
But it is one way for
people to transfer files.

00:03:59.080 --> 00:04:01.340
A trivial file transfer
protocol typically

00:04:01.340 --> 00:04:05.390
used by network engineering
for PXE boot, or PXE boot

00:04:05.390 --> 00:04:06.470
configurations.

00:04:06.470 --> 00:04:08.420
And it can be
configured to allow

00:04:08.420 --> 00:04:10.410
files to write files, as well.

00:04:10.410 --> 00:04:12.590
However out of the
box, see TFTP doesn't

00:04:12.590 --> 00:04:14.030
support any authentication.

00:04:14.030 --> 00:04:16.910
So you can effectively try
to brute force file names.

00:04:16.910 --> 00:04:19.760
If you know that there's
a TFTP service open,

00:04:19.760 --> 00:04:21.589
you can simply try to
guess the file names.

00:04:21.589 --> 00:04:24.390
So guessing things
like configuration,

00:04:24.390 --> 00:04:28.310
rom.bin, biosstop.bin, dupe.bin.

00:04:28.310 --> 00:04:30.902
Things like that might
expose things, and config.

00:04:30.902 --> 00:04:32.360
And you often find
that maybe there

00:04:32.360 --> 00:04:34.880
might be stuff
like running-config

00:04:34.880 --> 00:04:36.890
or startup-config.

00:04:36.890 --> 00:04:40.250
Files like that which might
contain sensitive network

00:04:40.250 --> 00:04:43.659
configuration information
exposed on a TFTP service.

00:04:44.159 --> 00:04:47.093
[MUSIC PLAYING]

00:04:50.520 --> 00:04:53.118
So when we're dealing with
files and operating files

00:04:53.118 --> 00:04:55.160
on remote systems, we need
to introduce something

00:04:55.160 --> 00:04:56.660
called Remote Procedure Call.

00:04:56.660 --> 00:05:00.500
RPC is a technology that's
designed for computers

00:05:00.500 --> 00:05:01.970
to run tasks on each other.

00:05:01.970 --> 00:05:04.970
So RPC is often used for
things like setting file locks

00:05:04.970 --> 00:05:07.880
and providing information
to network file services.

00:05:07.880 --> 00:05:11.810
So for instance, if you're
the receptionist, and you open

00:05:11.810 --> 00:05:14.690
you know Claire's document
from accounting on number two,

00:05:14.690 --> 00:05:15.620
on the floor two.

00:05:15.620 --> 00:05:17.780
You open her
document, and Claire

00:05:17.780 --> 00:05:20.030
goes to open the same
document from the network,

00:05:20.030 --> 00:05:23.640
and Claire gets the message,
"Your document is locked.

00:05:23.640 --> 00:05:25.760
It's currently in use by Sara."

00:05:25.760 --> 00:05:27.620
Or Jennifer, whoever.

00:05:27.620 --> 00:05:29.720
So this kind of thing
is done via RPC.

00:05:29.720 --> 00:05:32.180
So the RPC, when you've
opened that document,

00:05:32.180 --> 00:05:35.330
has sent a remote procedure
call to say lock this document.

00:05:35.330 --> 00:05:36.213
It's in use by you.

00:05:36.213 --> 00:05:37.880
And the remote servers
lock the document

00:05:37.880 --> 00:05:39.290
so nobody else can do it.

00:05:39.290 --> 00:05:43.207
So RPC is a way for computers
to run task on other computers.

00:05:43.207 --> 00:05:44.540
And those tasks can be anything.

00:05:44.540 --> 00:05:46.910
They can be things like check
the permissions of a file,

00:05:46.910 --> 00:05:50.000
or lock a file, open a file,
delete a file, mount a file.

00:05:50.000 --> 00:05:51.910
So that these kind of
remote procedure calls

00:05:51.910 --> 00:05:53.702
are obviously an
interesting attack vector.

00:05:53.702 --> 00:05:56.360
As attackers, we have
a way to run procedures

00:05:56.360 --> 00:05:57.260
on remote computers.

00:05:57.260 --> 00:05:58.843
So we're interested
in those services.

00:05:59.343 --> 00:06:01.880
[MUSIC PLAYING]

00:06:04.873 --> 00:06:07.290
Another set of services is
something called Server Message

00:06:07.290 --> 00:06:07.830
Block.

00:06:07.830 --> 00:06:09.090
And inside a Service
Message Block

00:06:09.090 --> 00:06:11.132
you can use something
called Common Internet File

00:06:11.132 --> 00:06:11.940
System or CIFS.

00:06:11.940 --> 00:06:13.960
Common Internet File
System operates over TCP

00:06:13.960 --> 00:06:17.400
and UDP ports 445,
137, 138, and 139.

00:06:17.400 --> 00:06:19.840
Widely used by Microsoft.

00:06:19.840 --> 00:06:21.870
There's a commonly used
Server Message Block

00:06:21.870 --> 00:06:23.610
technology worked by Microsoft.

00:06:23.610 --> 00:06:26.250
And because of Microsoft's
dominance in the marketplace,

00:06:26.250 --> 00:06:28.230
it has been adopted
now by Apple.

00:06:28.230 --> 00:06:32.640
And is also increasingly used
by Samba open-source packages.

00:06:32.640 --> 00:06:35.700
And various operating systems
will build Server Message Block

00:06:35.700 --> 00:06:39.210
and Common Internet File
System into their OS's now

00:06:39.210 --> 00:06:42.540
to be compatible with the
market leader, Microsoft.

00:06:42.540 --> 00:06:44.070
So you'll see these
kinds of things.

00:06:44.070 --> 00:06:45.820
And often these service
ports are commonly

00:06:45.820 --> 00:06:48.270
referred to as the Microsoft
Windows service ports.

00:06:48.270 --> 00:06:50.790
When in fact, they can also
be related to other things.

00:06:50.790 --> 00:06:54.035
But we're talking about Common
Internet File System access

00:06:54.035 --> 00:06:55.410
through the Server
Message Block.

00:06:55.410 --> 00:06:57.990
It's important to remember CIFS,
Common Internet File System.

00:06:57.990 --> 00:07:01.170
And that's how network shares
are often mapped and supplied.

00:07:01.170 --> 00:07:04.200
When you map a D drive,
net use, whatever.

00:07:04.200 --> 00:07:06.877
It's most likely using this
Common Internet File System.

00:07:07.377 --> 00:07:10.239
[MUSIC PLAYING]

00:07:13.590 --> 00:07:17.150
So Simple Network Management
Protocol is another technology.

00:07:17.150 --> 00:07:19.740
SNMP is designed for
probing a server,

00:07:19.740 --> 00:07:22.080
and enumerating
from a mid-table,

00:07:22.080 --> 00:07:24.870
from a table, a tree that can
give you some information.

00:07:24.870 --> 00:07:27.780
Allows you to do diagnostics
and do some remote maintenance.

00:07:27.780 --> 00:07:29.640
Simple Network
Management Protocol.

00:07:29.640 --> 00:07:30.930
It's implied in the name.

00:07:30.930 --> 00:07:32.400
Exists in three main versions.

00:07:32.400 --> 00:07:34.410
SNMP version 1,
version 2, version 3.

00:07:34.410 --> 00:07:36.450
Newer versions start to
add additional security.

00:07:36.450 --> 00:07:39.120
The old Legacy Version
1 supports what's

00:07:39.120 --> 00:07:40.242
known as a community name.

00:07:40.242 --> 00:07:41.700
And community names
are effectively

00:07:41.700 --> 00:07:43.740
like a preseed here,
or password that

00:07:43.740 --> 00:07:46.530
needs to be specified
to get information

00:07:46.530 --> 00:07:48.237
from a tree for
reading purposes.

00:07:48.237 --> 00:07:50.070
And also, there might
be a separate password

00:07:50.070 --> 00:07:51.570
for writing purposes.

00:07:51.570 --> 00:07:54.150
Typically common ones
are public and private.

00:07:54.150 --> 00:07:55.770
Also you might find
the company name.

00:07:55.770 --> 00:07:57.990
Or variations of the
company name are used.

00:07:57.990 --> 00:08:01.020
But there's a limit of seven
characters on Legacy Version 1.

00:08:01.020 --> 00:08:03.150
Newer versions of
the protocols support

00:08:03.150 --> 00:08:06.540
authentication, HMAC message
integrity, and encryption.

00:08:06.540 --> 00:08:09.390
Unfortunately, practically
nobody uses them anywhere.

00:08:09.390 --> 00:08:11.100
And if I was a
betting man, I'd say

00:08:11.100 --> 00:08:13.710
that SNMP is a lingering
threat in many networks.

00:08:13.710 --> 00:08:16.680
So SNMP can be used to
configure remote hosts, as well.

00:08:16.680 --> 00:08:19.770
So you can often overwrite
things like ARP table entries,

00:08:19.770 --> 00:08:22.977
and maybe tell important hosts
that one server they think

00:08:22.977 --> 00:08:24.810
should be over there
is actually over there.

00:08:24.810 --> 00:08:26.352
And do some nefarious
tasks that way.

00:08:26.852 --> 00:08:29.728
[MUSIC PLAYING]

00:08:32.700 --> 00:08:35.799
The NSA kind of realized that
SNMP is a good thing, as well.

00:08:35.799 --> 00:08:37.390
So they made a tool called EWOK.

00:08:37.390 --> 00:08:39.728
EWOK is a little
SNMP probing utility.

00:08:39.728 --> 00:08:41.770
I like it because it's
got a cool Star Wars name.

00:08:41.770 --> 00:08:43.270
But I also like
the fact that it's

00:08:43.270 --> 00:08:46.485
a little bit more detail than a
standard SNMP probing utility.

00:08:46.485 --> 00:08:48.360
It can be used to do
some kind of cool stuff.

00:08:48.360 --> 00:08:50.710
You can get process counts
out of various Unix's.

00:08:50.710 --> 00:08:52.540
You can dump the
ARP cache, review

00:08:52.540 --> 00:08:54.170
other bits of information.

00:08:54.170 --> 00:08:57.640
There's another tool called
ri, which is an RPC information

00:08:57.640 --> 00:08:59.472
tool on steroids, effectively.

00:08:59.472 --> 00:09:01.180
It does a lot more
information gathering.

00:09:01.180 --> 00:09:02.830
It will go on and
access the calendar,

00:09:02.830 --> 00:09:05.770
or pull out information, or
look at the RPC services.

00:09:05.770 --> 00:09:09.470
It's just a little bit more of
a powerful RPC information tool,

00:09:09.470 --> 00:09:10.720
that can gather a lot of data.

00:09:10.720 --> 00:09:12.970
So EWOK and ri's,
a couple of tools

00:09:12.970 --> 00:09:14.530
from the National
Security Agency

00:09:14.530 --> 00:09:16.158
that we're going
to borrow and use.

00:09:16.158 --> 00:09:17.450
Because they're kind of useful.

00:09:17.450 --> 00:09:18.850
We've done some
reverse engineering.

00:09:18.850 --> 00:09:20.767
And they're fairly OK,
and fairly good to use.

00:09:21.267 --> 00:09:24.003
[MUSIC PLAYING]

00:09:26.880 --> 00:09:28.860
Common Unix Printing System.

00:09:28.860 --> 00:09:31.720
It's used for sharing printer
resources across the network.

00:09:31.720 --> 00:09:33.750
So people will connect
CUPS environments

00:09:33.750 --> 00:09:35.970
in that has a little
built in web server.

00:09:35.970 --> 00:09:39.345
And it's quite tricky to get
printing working with CUPS.

00:09:39.345 --> 00:09:41.970
It's quite tricky to get network
printing working with anything

00:09:41.970 --> 00:09:43.730
Unix-like in general.

00:09:43.730 --> 00:09:45.930
And often, network
printer appliances

00:09:45.930 --> 00:09:47.820
will be using this
technology, as well.

00:09:47.820 --> 00:09:50.190
And it can often be found
on the network servers that

00:09:50.190 --> 00:09:51.660
supply printing resources.

00:09:51.660 --> 00:09:53.283
Problem with it is,
printing onto Unix

00:09:53.283 --> 00:09:55.200
is just so damn difficult,
that it's even more

00:09:55.200 --> 00:09:56.250
difficult to secure it.

00:09:56.250 --> 00:09:58.350
So people often leave
these things unsecure.

00:09:58.350 --> 00:09:59.892
If they get it
working, they probably

00:09:59.892 --> 00:10:01.600
don't want to change
any passwords on it.

00:10:01.600 --> 00:10:03.750
Because they're just happy
that the printer prints.

00:10:03.750 --> 00:10:06.600
So we can often misuse
this misguided trust

00:10:06.600 --> 00:10:07.965
in their printing devices.

00:10:07.965 --> 00:10:09.340
As printers are
effectively often

00:10:09.340 --> 00:10:11.790
little computers with
storage processors

00:10:11.790 --> 00:10:12.810
and network connection.

00:10:12.810 --> 00:10:14.890
So we want to be able
to hack those, as well.

00:10:14.890 --> 00:10:17.100
So looking at things like
Common Unix Printing System

00:10:17.100 --> 00:10:18.000
is a good way.

00:10:18.000 --> 00:10:20.520
If you're familiar with
the team Phenoelit,

00:10:20.520 --> 00:10:22.570
by an excellent computer
hacker named FX.

00:10:22.570 --> 00:10:24.570
If you look at his tools,
you can see some tools

00:10:24.570 --> 00:10:29.490
like Hijetter which can be used
for interacting with printers

00:10:29.490 --> 00:10:30.530
on their IPL port.

00:10:30.530 --> 00:10:32.428
You can send printing
related jobs.

00:10:32.428 --> 00:10:34.720
We're not going to cover
printer hacking, specifically.

00:10:34.720 --> 00:10:36.053
But if you are interested in it.

00:10:36.053 --> 00:10:39.510
I'd recommend taking a look
at Hijetter by Phenoelit.

00:10:39.510 --> 00:10:41.310
So history of command
injection, as well.

00:10:41.310 --> 00:10:43.890
So things like CUPS have been
vulnerable to the same kinds

00:10:43.890 --> 00:10:44.820
of injection attacks.

00:10:44.820 --> 00:10:47.292
Similar kind of stuff that we
saw in the previous modules.

00:10:47.292 --> 00:10:48.750
There's a lot of
command injection.

00:10:48.750 --> 00:10:50.167
You should be
getting a theme now.

00:10:50.167 --> 00:10:52.170
The number one ways that
websites are breached

00:10:52.170 --> 00:10:53.290
are injection attacks.

00:10:53.290 --> 00:10:55.590
And the ways companies are
breached, injection attacks.

00:10:55.590 --> 00:10:58.080
This course has a lot of
injection command, injection

00:10:58.080 --> 00:10:58.800
attacks.

00:10:58.800 --> 00:11:01.230
Which is some of the basic
premises for how injection

00:11:01.230 --> 00:11:02.557
vulnerabilities come to light.

00:11:03.057 --> 00:11:05.919
[MUSIC PLAYING]

00:11:09.270 --> 00:11:12.460
So RSYNC is another technology.

00:11:12.460 --> 00:11:14.460
RSYNC can be used often
for package management.

00:11:14.460 --> 00:11:16.620
It's a way of synchronizing
files and folders

00:11:16.620 --> 00:11:18.060
between different servers.

00:11:18.060 --> 00:11:20.190
And it stores configuration
files and data.

00:11:20.190 --> 00:11:22.770
And in fact, in 2003, it's
a very fascinating case,

00:11:22.770 --> 00:11:25.200
2003 a completely
unknown computer hacker

00:11:25.200 --> 00:11:30.300
used a 0day heap overflow
against the Gen2 RSYNC

00:11:30.300 --> 00:11:31.050
services.

00:11:31.050 --> 00:11:32.760
Compromised the
package management,

00:11:32.760 --> 00:11:34.560
and was in the process
of back-dooring

00:11:34.560 --> 00:11:36.250
all of the Gen2 services.

00:11:36.250 --> 00:11:39.660
And was actually caught by
a very, very, very paranoid

00:11:39.660 --> 00:11:43.230
system administrator who was
running multiple integrity

00:11:43.230 --> 00:11:44.630
checkers on the server.

00:11:44.630 --> 00:11:48.030
And they almost, almost, very,
very nearly got away with it.

00:11:48.030 --> 00:11:49.020
They were never caught.

00:11:49.020 --> 00:11:51.450
But in 2003 there was
a security advisory

00:11:51.450 --> 00:11:55.050
for a 0day heap overflow
in an RSYNC service,

00:11:55.050 --> 00:11:56.820
which is a fascinating
read through

00:11:56.820 --> 00:12:00.300
on how a vendor was getting
hacked in 2003 in a very

00:12:00.300 --> 00:12:03.300
prominent Linux distribution.

00:12:03.300 --> 00:12:05.280
It stores configuration
files and data.

00:12:05.280 --> 00:12:07.780
And if you set up RSYNC
in an insecure way,

00:12:07.780 --> 00:12:09.030
it can expose sensitive files.

00:12:09.030 --> 00:12:11.520
And people often use it for
either backing up servers

00:12:11.520 --> 00:12:13.320
and inadvertently
expose files on it.

00:12:13.320 --> 00:12:15.960
Or they're using it for package
management, internal package

00:12:15.960 --> 00:12:18.750
management, pushing patches
to their Unix estates or Linux

00:12:18.750 --> 00:12:19.650
estates.

00:12:19.650 --> 00:12:21.056
Because Linux is not Unix.

00:12:21.556 --> 00:12:24.532
[MUSIC PLAYING]

00:12:27.510 --> 00:12:30.780
Network File Service, originally
developed by Sun Microsystems.

00:12:30.780 --> 00:12:33.355
Sun Microsystems have been
really at the forefront

00:12:33.355 --> 00:12:35.730
of a lot of innovation of
different kinds of technologies

00:12:35.730 --> 00:12:36.810
that we use.

00:12:36.810 --> 00:12:40.560
So NFS version 2, 3, and 4,
was a widely supported way

00:12:40.560 --> 00:12:42.720
of sharing files between
computers on the network.

00:12:42.720 --> 00:12:46.110
So it's a way of sending
information, files, sharing

00:12:46.110 --> 00:12:48.600
them between different
servers, NFS systems.

00:12:48.600 --> 00:12:50.685
And in an insecure
configuration,

00:12:50.685 --> 00:12:52.560
it can be susceptible
to a number of attacks.

00:12:52.560 --> 00:12:56.020
And the reason was nearly days
of networking, and network

00:12:56.020 --> 00:12:58.860
technology, and network
file services often

00:12:58.860 --> 00:13:00.300
made an implicit mistake.

00:13:00.300 --> 00:13:01.710
They did some client-side trust.

00:13:01.710 --> 00:13:02.880
They believed the client.

00:13:02.880 --> 00:13:04.440
They didn't trust the server.

00:13:04.440 --> 00:13:06.180
So the permissions and things
were coming from the client.

00:13:06.180 --> 00:13:07.138
And we'll look at that.

00:13:07.638 --> 00:13:10.544
[MUSIC PLAYING]

00:13:12.990 --> 00:13:14.160
Coming to permissions.

00:13:14.160 --> 00:13:18.200
Now, this is the Unix permission
model, or the Unix file system

00:13:18.200 --> 00:13:19.818
permission model, generally.

00:13:19.818 --> 00:13:22.110
If you look at Mac OS X,
there'll be a different model.

00:13:22.110 --> 00:13:23.550
If you look at Windows,
there'll be different model.

00:13:23.550 --> 00:13:25.120
So we're talking
about Linux, Unix,

00:13:25.120 --> 00:13:27.870
and general Unix-like
operating systems.

00:13:27.870 --> 00:13:31.100
You'll have seen in the
previous module, we did CHMOD.

00:13:31.100 --> 00:13:32.640
We changed some
permissions around.

00:13:32.640 --> 00:13:34.320
But this here is
actually the tree

00:13:34.320 --> 00:13:36.450
that explains the Unix
permission models.

00:13:36.450 --> 00:13:39.150
So these octal
representations here actually

00:13:39.150 --> 00:13:40.360
add up to some numbers.

00:13:40.360 --> 00:13:41.490
So you've got three values.

00:13:41.490 --> 00:13:42.510
You've got the user.

00:13:42.510 --> 00:13:44.310
That is the user
who owns the file.

00:13:44.310 --> 00:13:45.300
You've got the group.

00:13:45.300 --> 00:13:47.670
That is the group of the
user who owns the file.

00:13:47.670 --> 00:13:48.930
And then you have other.

00:13:48.930 --> 00:13:51.300
Which is everybody
else on the computer.

00:13:51.300 --> 00:13:54.250
So if you are the user,
let's say you create a file,

00:13:54.250 --> 00:13:56.220
you would do read,
write and execute.

00:13:56.220 --> 00:13:59.160
You want to be able to read,
write, and execute to the file.

00:13:59.160 --> 00:14:00.390
So you would turn read on.

00:14:00.390 --> 00:14:01.530
So you give it a 1.

00:14:01.530 --> 00:14:02.580
You give write on.

00:14:02.580 --> 00:14:03.750
So you give that a 1.

00:14:03.750 --> 00:14:05.803
And you give x on, so
you'd give that a 1.

00:14:05.803 --> 00:14:07.470
And then what you'd
do is you'd say, OK.

00:14:07.470 --> 00:14:09.780
Take the numbers 4, 2,
and 1, add them together,

00:14:09.780 --> 00:14:10.950
and you've got 7.

00:14:10.950 --> 00:14:15.090
So your flag, your mask, your
optal values here, will be 7.

00:14:15.090 --> 00:14:17.010
So that you will get
read, write, and execute

00:14:17.010 --> 00:14:18.340
bits enabled.

00:14:18.340 --> 00:14:20.190
And group, you
perhaps want everyone

00:14:20.190 --> 00:14:22.260
in the group to read
your file and execute it.

00:14:22.260 --> 00:14:23.760
But you perhaps
don't want everybody

00:14:23.760 --> 00:14:25.860
in your support or
staff group to be

00:14:25.860 --> 00:14:27.123
able to write to your file.

00:14:27.123 --> 00:14:28.290
So you would turn off write.

00:14:28.290 --> 00:14:30.960
So you'd put read 1,
write off with a 0,

00:14:30.960 --> 00:14:33.660
x for on to execute the file.

00:14:33.660 --> 00:14:35.430
So you'd then end
up with 4 and a 1,

00:14:35.430 --> 00:14:36.930
and you'd get the number 5.

00:14:36.930 --> 00:14:40.050
And then that would enable
read and execute permissions

00:14:40.050 --> 00:14:41.650
for people in the group.

00:14:41.650 --> 00:14:44.080
Other you would have
read, write, and execute.

00:14:44.080 --> 00:14:45.960
And here we can see
we've got 4, 2, and 1.

00:14:45.960 --> 00:14:48.270
And we just want, we don't want
everyone else to run our files,

00:14:48.270 --> 00:14:49.880
we just want them to
be able to read them.

00:14:49.880 --> 00:14:51.900
At which, in fact, they could
then just copy, and read them,

00:14:51.900 --> 00:14:52.442
and run them.

00:14:52.442 --> 00:14:56.018
But you could then
do 4, 1, and 4.

00:14:56.018 --> 00:14:58.060
And that would give you
the permission mask of 4.

00:14:58.060 --> 00:15:00.440
So you would have read on,
and all of these other bits

00:15:00.440 --> 00:15:01.200
set to off.

00:15:01.200 --> 00:15:03.190
So you'd have a 4 here.

00:15:03.190 --> 00:15:05.450
So that's how you build up
the combination of flags,

00:15:05.450 --> 00:15:07.530
or users, group and other.

00:15:07.530 --> 00:15:10.780
And it's important, other means
anything else on the system.

00:15:10.780 --> 00:15:14.220
So if it's a process coming
from a network, other applies.

00:15:14.220 --> 00:15:17.070
If it is a group, it's
anyone in that group ID

00:15:17.070 --> 00:15:18.870
that you belong to,
who owns the file.

00:15:18.870 --> 00:15:22.530
And you can change those
files with CHOWN and CHMOD.

00:15:22.530 --> 00:15:25.300
There is also an
imaginary number here,

00:15:25.300 --> 00:15:26.610
which is a special bit.

00:15:26.610 --> 00:15:29.010
And this special bit
denotes to the same things

00:15:29.010 --> 00:15:33.240
it has a sticky bit for user
group and then truncate bits.

00:15:33.240 --> 00:15:38.190
So those same values, but sticky
user, sticky group truncate.

00:15:38.190 --> 00:15:40.180
Which means prevent
anyone from writing.

00:15:40.180 --> 00:15:42.660
So if you were to
put a 4 in here.

00:15:42.660 --> 00:15:45.450
And turn this sticky
user imaginary bit on.

00:15:45.450 --> 00:15:46.620
You would have a 4 in here.

00:15:46.620 --> 00:15:49.860
And what that would do
is give you 4, 7, 5, 4.

00:15:49.860 --> 00:15:53.430
And the sticky bit means
when you execute this binary,

00:15:53.430 --> 00:15:56.680
it will execute with the
permissions of the user.

00:15:56.680 --> 00:15:58.530
Which is why we search
for those binaries

00:15:58.530 --> 00:16:00.780
in the previous
module, to try to find

00:16:00.780 --> 00:16:02.970
permission binaries that
run with another user's

00:16:02.970 --> 00:16:03.850
permissions.

00:16:03.850 --> 00:16:06.060
So the sticky bit
runs the binary

00:16:06.060 --> 00:16:07.630
with other user's permissions.

00:16:07.630 --> 00:16:09.630
So we want to stick
the user or the group.

00:16:09.630 --> 00:16:13.080
If we were to stick the group,
it would be a 4 and a 2.

00:16:13.080 --> 00:16:15.060
So we could put 2, 7,
5, 4, and it would just

00:16:15.060 --> 00:16:16.360
give us group permissions.

00:16:16.360 --> 00:16:21.000
If we did 6, 7, 5, 4, it would
be group and user permissions.

00:16:21.000 --> 00:16:24.150
And if we did 7, 7, 5, 4,
it would be group and user

00:16:24.150 --> 00:16:24.660
permissions.

00:16:24.660 --> 00:16:26.550
Plus nobody on the
file system would

00:16:26.550 --> 00:16:28.210
be able to write to that file.

00:16:28.210 --> 00:16:31.337
The other x field is a field
that you probably don't want.

00:16:31.337 --> 00:16:32.670
And doesn't really care for you.

00:16:32.670 --> 00:16:34.620
You're probably
just 1, 4, and 2.

00:16:34.620 --> 00:16:37.890
So anything with a
4, a 2, a 6, or a 7

00:16:37.890 --> 00:16:40.260
is probably of
something of interest.

00:16:40.260 --> 00:16:43.890
So this becomes very important
when networks are using files.

00:16:43.890 --> 00:16:46.310
Because if you have a file
you created on your computer,

00:16:46.310 --> 00:16:48.810
and you have your permissions
and you set those permissions.

00:16:48.810 --> 00:16:51.072
And then you're sharing
that file across a network,

00:16:51.072 --> 00:16:52.530
where do the
permissions come from?

00:16:52.530 --> 00:16:54.000
Does your computer
give the permissions?

00:16:54.000 --> 00:16:55.792
Or does it come from
the connecting client?

00:16:55.792 --> 00:16:58.500
So it's important to understand
where the permissions model sit

00:16:58.500 --> 00:16:59.917
and where they
exist in a network.

00:17:00.417 --> 00:17:03.048
[MUSIC PLAYING]

00:17:06.849 --> 00:17:08.322
So you also have
vulnerabilities.

00:17:08.322 --> 00:17:10.530
There's been a number of
vulnerabilities in different

00:17:10.530 --> 00:17:11.030
OS's.

00:17:11.030 --> 00:17:13.650
In particular in Samba, there's
a particular vulnerability,

00:17:13.650 --> 00:17:17.290
CVE-2017-7494, called SAMBA CRY.

00:17:17.290 --> 00:17:19.810
This is a vulnerability that
allows users to execute code

00:17:19.810 --> 00:17:20.685
on some of the hosts.

00:17:20.685 --> 00:17:22.810
And the attacker just simply
needs write permission

00:17:22.810 --> 00:17:23.530
to the share.

00:17:23.530 --> 00:17:25.072
So what you'd have
to do, is you have

00:17:25.072 --> 00:17:27.760
to have the ability to upload
a file to a Samba host.

00:17:27.760 --> 00:17:30.070
And then you can upload
a shared object file.

00:17:30.070 --> 00:17:31.510
And inside that
shared object file

00:17:31.510 --> 00:17:34.180
can contain your commands to
execute some other kind of code

00:17:34.180 --> 00:17:37.120
injection command execution
type vulnerability that can be

00:17:37.120 --> 00:17:39.850
leveraged through metasploits.

00:17:39.850 --> 00:17:42.680
Or indeed any other exploit
that you might have.

00:17:42.680 --> 00:17:44.872
So that concludes the
theory for this module.

00:17:44.872 --> 00:17:46.330
What we're going
to do now is we're

00:17:46.330 --> 00:17:49.750
going to demonstrate hacking
into a commonly seen NAS type

00:17:49.750 --> 00:17:50.750
environment.

00:17:50.750 --> 00:17:52.667
So I want you to download
the file server ISO.

00:17:52.667 --> 00:17:54.417
Make sure you've got
your reference guides

00:17:54.417 --> 00:17:55.310
and your tools ready.

00:17:55.310 --> 00:17:56.810
Perhaps re-watch
through this video.

00:17:56.810 --> 00:17:58.720
Make sure you're comfortable
with that Unix permissions

00:17:58.720 --> 00:17:59.250
model.

00:17:59.250 --> 00:18:01.420
We're then going to do a lot
of different practical elements

00:18:01.420 --> 00:18:03.970
where we demonstrate some of
these theoretical concepts

00:18:03.970 --> 00:18:05.890
so that we can
solidify that knowledge

00:18:05.890 --> 00:18:08.540
and demonstrate how these
present risks to the network.

00:18:08.540 --> 00:18:10.790
So I'll look forward to
seeing you in the next module.

00:18:10.790 --> 00:18:12.450
Thank you.
