WEBVTT - This file was automatically generated by VIMEO

0
00:00:08.430 --> 00:00:12.970
Hi, and welcome back to section four Netcat Penetration Test.

1
00:00:14.030 --> 00:00:14.863
In this video,

2
00:00:15.150 --> 00:00:19.130
we are going to talk in more details about persistence with netcat.

3
00:00:20.150 --> 00:00:20.690
For instance,

4
00:00:20.690 --> 00:00:25.370
means to use a mechanism to guarantee that one component will be always

5
00:00:25.370 --> 00:00:27.410
available. In our case,

6
00:00:27.760 --> 00:00:32.290
persistence with Net CAT means to put an instance of Net CAT that will be

7
00:00:32.290 --> 00:00:35.370
available for connection. In this scenario,

8
00:00:35.580 --> 00:00:38.850
there are some steps and options to follow and use.

9
00:00:39.500 --> 00:00:44.410
We're gonna see here how we can use some configurations to put the Netcat in

10
00:00:44.410 --> 00:00:49.400
an instance in the Microsoft Windows Register. But before this,

11
00:00:49.470 --> 00:00:52.840
some steps will be out for our scope. For example,

12
00:00:53.180 --> 00:00:56.600
to start some operations Windows has register,

13
00:00:56.980 --> 00:01:01.260
we need to scarlet our privilege and to do this,

14
00:01:01.480 --> 00:01:06.260
we need to have vulnerability in the target machine. Turn, run exploit.

15
00:01:06.390 --> 00:01:10.500
There are some tools available. For example, meta Exploit. It's uh,

16
00:01:10.500 --> 00:01:15.500
able to run our Windows user account control u i c exploit

17
00:01:16.280 --> 00:01:20.980
to gain administrator access and is execute dis operations on the

18
00:01:21.220 --> 00:01:22.380
Microsoft Windows header.

19
00:01:22.800 --> 00:01:26.380
To explore a person's net cat backdoor,

20
00:01:26.800 --> 00:01:28.660
we have some options. We,

21
00:01:28.720 --> 00:01:33.660
we need to install a net cat backdoor in the victim machine when a copy from

22
00:01:33.660 --> 00:01:36.260
a net cat available in our Linux, for example.

23
00:01:36.480 --> 00:01:41.360
So we have a Linux tool and we can use a copy

24
00:01:41.820 --> 00:01:46.720
of this net cat or we can use a net cat installer in the operations system.

25
00:01:46.740 --> 00:01:48.800
In the, in the target. In our case,

26
00:01:49.260 --> 00:01:53.680
we use a net CAT version from any map project already installer in the Microsoft

27
00:01:53.680 --> 00:01:55.520
Windows machine target.

28
00:01:55.940 --> 00:01:59.160
So we're gonna reuse this net cat there.

29
00:01:59.660 --> 00:02:03.440
To open a remote backdoor connection,

30
00:02:03.860 --> 00:02:08.720
we can use the Microsoft Windows header key to execute the net cat on

31
00:02:08.720 --> 00:02:13.360
the startup of the remote host and listen to the desire port the party

32
00:02:13.480 --> 00:02:18.480
current version and they run is the place for application that will be execute

33
00:02:18.700 --> 00:02:23.560
on the start at the Microsoft Windows, for example, on screen we have this path,

34
00:02:24.620 --> 00:02:27.720
the software Microsoft Windows current version run.

35
00:02:28.060 --> 00:02:31.670
So this is the place when we have, uh,

36
00:02:31.750 --> 00:02:35.430
programs that is running always in the startup,

37
00:02:36.090 --> 00:02:38.190
so automatically run this operation.

38
00:02:38.190 --> 00:02:43.110
So this is a good place to put our net cat instance running in

39
00:02:43.150 --> 00:02:46.590
a lesson mode. That's mean net Cat.

40
00:02:46.610 --> 00:02:48.950
We run as a server mode.

41
00:02:49.530 --> 00:02:54.390
And this is very interesting place because every time that Windows start up,

42
00:02:54.850 --> 00:02:59.480
the net cat will be available. Listen some connection,

43
00:02:59.480 --> 00:03:04.420
meaning this specific port and on screen we have the common to

44
00:03:04.820 --> 00:03:09.690
interact with the reg registry. So we have the reg query

45
00:03:11.420 --> 00:03:12.960
verify. You pass a path,

46
00:03:13.180 --> 00:03:18.080
verify a list of keys or sub folders that we have in this

47
00:03:18.080 --> 00:03:22.360
path, or we have the re add to add a new,

48
00:03:22.560 --> 00:03:27.480
a new value and a key. So we have, uh, a list of,

49
00:03:27.780 --> 00:03:30.840
uh, operations of options that we have. For example,

50
00:03:31.790 --> 00:03:36.490
on screen we have dash V to specify the name of the value dash

51
00:03:36.810 --> 00:03:41.580
D to specify its value dash t to specify the value

52
00:03:41.580 --> 00:03:46.080
data type and dash vi is used to write

53
00:03:46.710 --> 00:03:50.800
keys. The full value, for example, in the key that we have the reg add,

54
00:03:51.300 --> 00:03:56.230
we have a path to software, Microsoft Windows current version run.

55
00:03:56.330 --> 00:03:58.110
That's mean that this path,

56
00:03:59.700 --> 00:04:01.830
this key will be put in this path.

57
00:04:02.490 --> 00:04:06.870
And we have dash v netcat is is the name of the key,

58
00:04:07.420 --> 00:04:09.470
okay, dash T to

59
00:04:11.050 --> 00:04:15.900
form the type of value and dash D is

60
00:04:15.920 --> 00:04:20.580
to specify the, the value. So the, the value B, uh, there's a cushion,

61
00:04:20.730 --> 00:04:25.300
there's a path to acceptable file net cat in this case dash

62
00:04:25.760 --> 00:04:30.580
lp d the port dash e md dash

63
00:04:31.560 --> 00:04:36.220
dot exact. That's mean that the value of this key,

64
00:04:36.340 --> 00:04:38.340
I will create a key called NCA

65
00:04:39.990 --> 00:04:44.490
the ad and this value will be this path here.

66
00:04:44.680 --> 00:04:48.680
This be this exact ball. So this common here,

67
00:04:49.620 --> 00:04:53.800
netcat LP 4 4 4 4 dash a

68
00:04:54.430 --> 00:04:59.040
will be acceptable every time that that, uh, windows view start up.

69
00:04:59.580 --> 00:05:00.413
So this is a,

70
00:05:00.480 --> 00:05:04.840
a very u useful way to persistent

71
00:05:05.580 --> 00:05:08.040
net cat backdoor, for example. Okay,

72
00:05:08.970 --> 00:05:13.310
for this backdoor runs and works without problem,

73
00:05:14.640 --> 00:05:16.860
we have to interact with the firewall too.

74
00:05:17.520 --> 00:05:21.620
So a remote firewall can interrupt the net cat con connection.

75
00:05:22.080 --> 00:05:24.500
So the firewall settings can be modified.

76
00:05:25.580 --> 00:05:29.360
In onscreen we have a common net sh

77
00:05:30.610 --> 00:05:35.510
as net H is a constant utility which allows changing

78
00:05:35.710 --> 00:05:39.310
a lot of network related parameters. So for example,

79
00:05:40.320 --> 00:05:44.980
we have common to, to add a new rule,

80
00:05:45.610 --> 00:05:46.660
it's mean that onscreen,

81
00:05:46.680 --> 00:05:51.020
we have the net s h and we are putting a new

82
00:05:51.850 --> 00:05:55.220
rule. We have a name, for example, for this rule,

83
00:05:55.760 --> 00:05:57.920
the local port 4, 4, 4 4,

84
00:05:58.100 --> 00:06:02.780
and the type of protocol T C P and the action that's

85
00:06:02.790 --> 00:06:06.900
allow, so this comment on screen say, hey firewall,

86
00:06:07.240 --> 00:06:12.050
you have to add a new rule. This is the name of the, of the new rule. Uh,

87
00:06:12.160 --> 00:06:16.530
this action is to allow or deny in this case is allow, have,

88
00:06:16.590 --> 00:06:20.410
be using this protocol and use this local port, okay?

89
00:06:20.410 --> 00:06:25.300
That this is a common to open a rule exception to

90
00:06:25.320 --> 00:06:26.980
add a rule in the firewall.

91
00:06:27.400 --> 00:06:30.500
So this is a way to open the path.

92
00:06:30.920 --> 00:06:35.590
The way for our net cat backdoor

93
00:06:35.700 --> 00:06:39.590
runs without problem. So let's run example here.

94
00:06:39.710 --> 00:06:44.150
I have my KA Linux environment and I have another machine running

95
00:06:44.710 --> 00:06:48.150
Microsoft Windows. So I will connect my Ka Linux environment,

96
00:06:48.420 --> 00:06:51.570
meaning this Microsoft machine, okay?

97
00:06:52.990 --> 00:06:57.310
In this example of precedence, we are putting some comments.

98
00:06:57.690 --> 00:07:02.310
We are use, uh, a comment to add a key in the register.

99
00:07:02.770 --> 00:07:06.870
And we use a command to add a new rule in the firewall.

100
00:07:07.530 --> 00:07:08.870
And for this operation,

101
00:07:09.370 --> 00:07:14.070
we have to be administrator or a hold in Microsoft to windows.

102
00:07:15.170 --> 00:07:19.740
Okay? So for this example works exactly, we have,

103
00:07:19.800 --> 00:07:22.180
for example, in the scenario of penetration test,

104
00:07:22.400 --> 00:07:25.540
we have two river run ice exploit.

105
00:07:26.340 --> 00:07:31.280
So we have a run exploit in the Microsoft to user account control,

106
00:07:31.640 --> 00:07:36.260
u a C. So for, to escalate of privilege.

107
00:07:36.560 --> 00:07:40.260
So our, with this, all the stuff that we,

108
00:07:40.280 --> 00:07:44.940
we gonna do will be in the root level. Okay? So this is our requisite,

109
00:07:45.010 --> 00:07:49.390
this is out of this course. So let's run the,

110
00:07:49.930 --> 00:07:54.060
the, the example. And now that connection is on,

111
00:07:54.280 --> 00:07:58.910
we are able to execute some comments to check if the

112
00:07:58.910 --> 00:08:01.680
connection is okay, for example, there.

113
00:08:02.220 --> 00:08:05.320
So this is a result of the version of their Microsoft windows that,

114
00:08:05.670 --> 00:08:08.800
that I'm connected. So this is example here.

115
00:08:09.800 --> 00:08:12.790
Let's take a look in the register key.

116
00:08:13.950 --> 00:08:17.970
So for this, we we gonna use the, the, the command rag

117
00:08:19.700 --> 00:08:24.470
query. So we start

118
00:08:26.160 --> 00:08:30.580
the query in the path to software

119
00:08:32.260 --> 00:08:36.700
Microsoft. So this is the, the list, what,

120
00:08:37.580 --> 00:08:38.950
what we have in the Microsoft.

121
00:08:39.210 --> 00:08:44.110
So here we are able to connect and access and get a list of the all

122
00:08:44.110 --> 00:08:46.070
the, uh, options. Okay?

123
00:08:46.500 --> 00:08:51.430
Another common to add a key is like this rag

124
00:08:52.290 --> 00:08:56.000
add. In this case, for example,

125
00:08:56.810 --> 00:08:57.643
as I said before,

126
00:08:57.810 --> 00:09:02.150
we have to scale it up our privilege to get access

127
00:09:02.970 --> 00:09:06.610
as a route. So in this example here, we,

128
00:09:06.730 --> 00:09:10.530
I will access for add a er, I will add a header,

129
00:09:10.690 --> 00:09:14.070
a key header value in another path,

130
00:09:14.250 --> 00:09:17.660
in another version of the register.

131
00:09:18.570 --> 00:09:23.480
So the register that that I use will be each

132
00:09:23.700 --> 00:09:28.680
key cu for example, dash, dash software,

133
00:09:29.930 --> 00:09:33.980
and I will create a new folder. So,

134
00:09:34.240 --> 00:09:36.500
and this folder will be, for example,

135
00:09:38.110 --> 00:09:42.150
test zero one. So look at,

136
00:09:42.370 --> 00:09:45.790
I'm able to create folders, okay? So re query.

137
00:09:47.780 --> 00:09:51.360
Now I'll verify for example,

138
00:09:53.750 --> 00:09:58.530
so this is, okay, my folder exists in the, the default value, for example,

139
00:09:58.870 --> 00:10:03.850
and I'll put a key in this folder, in this heer. Okay?

140
00:10:03.870 --> 00:10:08.310
So I use egged HK c u

141
00:10:09.980 --> 00:10:12.770
software SS zero one.

142
00:10:13.940 --> 00:10:17.580
I put a key in this heer, I'll use

143
00:10:19.320 --> 00:10:23.540
the options that we saw in the, in the previous slide presentation.

144
00:10:23.600 --> 00:10:27.160
So we'll be dash v slash V. Okay?

145
00:10:28.410 --> 00:10:32.910
My key, for example, I would specify the type of the register. So will be

146
00:10:34.730 --> 00:10:39.640
like this and the value there will be dash

147
00:10:40.290 --> 00:10:44.100
slash D 25, for example.

148
00:10:46.090 --> 00:10:50.630
So I was able to put value there and I use acute, again,

149
00:10:51.210 --> 00:10:53.770
the reg query,

150
00:10:55.490 --> 00:10:57.140
each kcu

151
00:10:59.110 --> 00:11:03.960
slash software slash zero one.

152
00:11:05.200 --> 00:11:06.820
So this is my, my key.

153
00:11:07.280 --> 00:11:11.370
So I'm able to get access to

154
00:11:12.040 --> 00:11:15.450
make a kiri to execute the common, for example.

155
00:11:15.630 --> 00:11:18.810
So I have access to the head stream.

156
00:11:20.510 --> 00:11:23.080
Okay? So now let's try to put, uh,

157
00:11:23.320 --> 00:11:26.160
a value in another region of the register.

158
00:11:26.820 --> 00:11:30.600
So let's put a comma, for example, a key in the reg l

159
00:11:32.840 --> 00:11:36.160
h key at m software,

160
00:11:37.980 --> 00:11:39.430
Microsoft Windows.

161
00:11:42.420 --> 00:11:46.560
Use this here. For example, I would like to add a new,

162
00:11:47.850 --> 00:11:51.980
in this example here we have folder and

163
00:11:52.930 --> 00:11:55.830
there was not any result.

164
00:11:56.410 --> 00:12:00.900
But if I use my terminal here in Windows, look,

165
00:12:01.120 --> 00:12:04.860
access is denied. That's mean that the, this connection here,

166
00:12:06.230 --> 00:12:07.063
the user,

167
00:12:07.250 --> 00:12:11.540
I don't have the connect privilege to access this version,

168
00:12:11.650 --> 00:12:14.620
this specific version here of the register.

169
00:12:15.370 --> 00:12:19.750
So this is the privilege that I told before, before this,

170
00:12:19.770 --> 00:12:24.230
we have to run some exploit to escalate all our privilege,

171
00:12:26.130 --> 00:12:30.680
okay? To have access in the privilege mode.

172
00:12:31.380 --> 00:12:34.960
For, for, for our example here. Example. Now, the,

173
00:12:35.220 --> 00:12:38.040
the last phase is to, for example,

174
00:12:38.820 --> 00:12:43.760
to get a list of information of firewall and to put a rule

175
00:12:44.070 --> 00:12:48.940
over there, okay? So for, for check out the,

176
00:12:48.940 --> 00:12:53.760
the options that we have in a firewall, we have a common neth

177
00:12:55.380 --> 00:12:58.350
firewall show up mode

178
00:12:59.910 --> 00:13:03.450
was a, a typo here, firewall

179
00:13:05.100 --> 00:13:08.310
show up mode. Okay?

180
00:13:08.850 --> 00:13:10.830
So this is the result, okay?

181
00:13:11.010 --> 00:13:15.940
We are seeing that we have some options and some modes

182
00:13:15.940 --> 00:13:19.650
enabled here. So the firewall is,

183
00:13:19.760 --> 00:13:24.420
it's on and we have to put a new rule over there. Okay?

184
00:13:24.600 --> 00:13:29.600
So let me open the clear the terminal and

185
00:13:29.850 --> 00:13:34.800
let's add a rule in this firewall. So the command would be

186
00:13:37.660 --> 00:13:41.400
neth a v firewall

187
00:13:43.060 --> 00:13:45.830
firewall. Again, add rule.

188
00:13:46.950 --> 00:13:50.410
We have to put a name for this new rule.

189
00:13:50.750 --> 00:13:54.980
So we'll be DCP or for four.

190
00:13:55.320 --> 00:13:59.850
For four we have specify a deer in,

191
00:14:00.070 --> 00:14:02.650
in the action to be allow,

192
00:14:03.270 --> 00:14:08.130
we have to specify a protocol that will be P C P

193
00:14:09.220 --> 00:14:12.480
and we help specify a port that will be a local port.

194
00:14:13.750 --> 00:14:18.640
4, 4 4. Okay? So this is the comment to add any new rule and open,

195
00:14:18.780 --> 00:14:23.400
uh, a specific port, meaning a specific protocol. And our connection,

196
00:14:24.220 --> 00:14:27.640
our remote desktop, uh, will be persistent.

197
00:14:28.260 --> 00:14:29.240
So as I said before,

198
00:14:30.730 --> 00:14:34.540
this operation request elevation run as administrator.

199
00:14:34.540 --> 00:14:39.510
That's mean that we have before run exploit to bypass

200
00:14:41.370 --> 00:14:43.540
this verification of authority.

201
00:14:44.890 --> 00:14:49.480
The Microsoft user account control, UAC C. Okay?

202
00:14:49.860 --> 00:14:54.520
But these are the steps that we have to

203
00:14:55.900 --> 00:15:00.600
as execute a persistent net CAT backdoor. Okay?

204
00:15:00.770 --> 00:15:01.603
First of all,

205
00:15:02.430 --> 00:15:07.410
we have to run and exploit to bypass these U A C,

206
00:15:08.190 --> 00:15:10.570
the user control, the user account control,

207
00:15:11.680 --> 00:15:15.200
the user account control.

208
00:15:15.580 --> 00:15:19.640
And then when this connection we use execute a remote connection,

209
00:15:20.790 --> 00:15:24.920
then we add this common to always

210
00:15:26.530 --> 00:15:31.290
run a net cat with this specific port in the register.

211
00:15:31.590 --> 00:15:36.560
And then open a rule in the firewall in the machine that will

212
00:15:36.660 --> 00:15:38.920
run. So in this case,

213
00:15:40.170 --> 00:15:44.890
every time that by the Microsoft windows, you start up, we have

214
00:15:46.400 --> 00:15:49.040
a net CAT distance running in the register.

215
00:15:49.220 --> 00:15:53.920
The register have a ference there that will be able to run

216
00:15:54.540 --> 00:15:58.320
and the firewall will not block the connection because we, uh,

217
00:15:58.770 --> 00:16:02.420
added a rule over there.

218
00:16:03.610 --> 00:16:08.490
In this video we saw about precedence in net cat. In next session,

219
00:16:09.020 --> 00:16:13.570
we'll take a look about blackhead tricks with cat. I hope.
