WEBVTT - This file was automatically generated by VIMEO

0
00:00:09.400 --> 00:00:13.100
Hi and welcome back to Section 8 web application

1
00:00:12.100 --> 00:00:13.700
 attacks.

2
00:00:14.500 --> 00:00:17.700
In this video, you will learn how to automate SQL

3
00:00:17.700 --> 00:00:20.600
 injection and discover hidden databases

4
00:00:20.600 --> 00:00:21.900
 within a web application.

5
00:00:24.200 --> 00:00:26.700
I hope you excited. So let's dive on in.

6
00:00:29.900 --> 00:00:32.100
This video you will learn how to use a tool

7
00:00:32.100 --> 00:00:35.800
 called SQL map to Simply automate SQL injections as

8
00:00:35.800 --> 00:00:38.800
 an ethical hacker any painstreation tester to

9
00:00:38.800 --> 00:00:42.000
 Simply discover any sort of SQL injection

10
00:00:41.700 --> 00:00:44.300
 be security flows with any web

11
00:00:44.300 --> 00:00:44.600
 application.

12
00:00:45.500 --> 00:00:48.300
For this exercise. We are not going to use shoe shop.

13
00:00:48.300 --> 00:00:51.600
 However, our Target machine will be Kali Linux.

14
00:00:52.100 --> 00:00:55.300
But we are going to use metasploitable 2

15
00:00:55.300 --> 00:00:58.700
 virtual machine simply select it like so and

16
00:00:58.700 --> 00:01:00.100
 hit start to power it on.

17
00:01:07.100 --> 00:01:10.800
Create so no mattersploitable 2 is powered on we can

18
00:01:10.800 --> 00:01:13.400
 log in using the username msf. Admin

19
00:01:13.400 --> 00:01:16.800
 and the password is the same msf. Admin.

20
00:01:18.400 --> 00:01:21.300
Let's type ipaddr to get a

21
00:01:21.300 --> 00:01:23.300
 IP address of this server.

22
00:01:24.200 --> 00:01:27.900
And here you can see the IP address of my metasoloidable to

23
00:01:27.900 --> 00:01:32.800
 Virtual Machine. It's 172 tt1.37

24
00:01:30.800 --> 00:01:34.200
 create now,

25
00:01:33.200 --> 00:01:36.200
 let's open our web browser like

26
00:01:36.200 --> 00:01:39.500
 so let's head over to dot URL.

27
00:01:40.200 --> 00:01:41.700
This should be your welcome page.

28
00:01:42.800 --> 00:01:43.700
We are going to use.

29
00:01:44.700 --> 00:01:47.500
The DV w e web

30
00:01:47.500 --> 00:01:50.400
 application simply click it and you

31
00:01:50.400 --> 00:01:51.400
 will get a slogan page.

32
00:01:52.200 --> 00:01:54.600
If you scroll down you will see the user credential.

33
00:01:55.200 --> 00:01:58.800
The username is admin are the password is password simply log

34
00:01:58.800 --> 00:01:59.700
 in ases.

35
00:02:02.600 --> 00:02:03.700
once you're logged in

36
00:02:04.400 --> 00:02:08.100
To dvwe Simply scroll down. Let's

37
00:02:07.100 --> 00:02:09.600
 set a security level to Loop.

38
00:02:10.600 --> 00:02:11.700
Let's click submit.

39
00:02:12.900 --> 00:02:13.500
Great.

40
00:02:14.900 --> 00:02:17.500
next let's click on SQL injection like

41
00:02:17.500 --> 00:02:17.700
 so

42
00:02:18.200 --> 00:02:20.500
and here we have a user input field.

43
00:02:22.300 --> 00:02:25.200
We can simply insert a value and try to

44
00:02:25.200 --> 00:02:27.900
 retrieve the user account for that value.

45
00:02:28.600 --> 00:02:31.900
For instance. If we insert one, we

46
00:02:31.900 --> 00:02:34.300
 would like to retrieve the first account that was

47
00:02:34.300 --> 00:02:37.600
 ever created which is most likely the administrator account.

48
00:02:37.600 --> 00:02:40.300
 But before we do, so, let's click on

49
00:02:40.300 --> 00:02:43.800
 foxy proxy and turn on the boob Suite

50
00:02:43.800 --> 00:02:45.100
 proxy feature like so

51
00:02:45.700 --> 00:02:48.000
And now let's execute Boop Suite.

52
00:02:53.600 --> 00:02:54.800
Let's click on proxy.

53
00:02:55.400 --> 00:02:56.600
Let's click on options.

54
00:02:57.400 --> 00:02:58.800
And let's check these boxes.

55
00:03:02.200 --> 00:03:05.800
Next let's turn on intercept create.

56
00:03:08.100 --> 00:03:10.100
Let's have a back to all web application.

57
00:03:11.500 --> 00:03:14.700
On the user input field, let's press 1 like so

58
00:03:14.700 --> 00:03:16.100
 and hit submit.

59
00:03:17.100 --> 00:03:21.500
And here you can see we were able to retrieve the first record. This indicate.

60
00:03:20.500 --> 00:03:23.700
 There is some type of security flow that

61
00:03:23.700 --> 00:03:25.800
 exists within this web application.

62
00:03:26.700 --> 00:03:28.100
Let's check boob Suite.

63
00:03:30.800 --> 00:03:33.700
Unfortunately, we did not see the request schemean.

64
00:03:33.700 --> 00:03:36.500
 So let's actually click on target.

65
00:03:37.700 --> 00:03:40.300
Let's click this first option up

66
00:03:40.300 --> 00:03:40.400
 here.

67
00:03:41.600 --> 00:03:44.500
As you can see it was able to capture all the get

68
00:03:44.500 --> 00:03:46.600
 messages. Let's filter this properly.

69
00:03:47.400 --> 00:03:49.800
So you can simply right click and add to scope.

70
00:03:50.600 --> 00:03:53.000
simply click on this row

71
00:03:53.800 --> 00:03:56.700
and show only in school items great.

72
00:03:57.400 --> 00:04:00.400
If I widen this URL just a little bit we can

73
00:04:00.400 --> 00:04:04.900
 see it's slash dvwe vulnerabilities

74
00:04:03.900 --> 00:04:06.400
 / SQL.

75
00:04:07.200 --> 00:04:10.100
followed by some additional shrinks

76
00:04:10.700 --> 00:04:13.000
But let's look at the actual request message.

77
00:04:14.400 --> 00:04:15.500
in this request message

78
00:04:16.500 --> 00:04:19.800
We sent a get requests for this particular resource,

79
00:04:19.800 --> 00:04:21.400
 and we submitted it.

80
00:04:22.400 --> 00:04:25.600
We can see this is a target. The user agenda was

81
00:04:25.600 --> 00:04:28.200
 used which is Mozilla Firefox, but most

82
00:04:28.200 --> 00:04:31.900
 importantly we have a session ID

83
00:04:31.900 --> 00:04:32.500
 value.

84
00:04:33.400 --> 00:04:35.400
together with actual requests one

85
00:04:36.100 --> 00:04:40.300
but notice the cookie information contains the

86
00:04:40.300 --> 00:04:41.500
 security level to be low.

87
00:04:42.100 --> 00:04:43.900
In addition to the session ID.

88
00:04:44.600 --> 00:04:47.700
So therefore we can use this cookie information to try

89
00:04:47.700 --> 00:04:49.500
 to extract additional details.

90
00:04:50.600 --> 00:04:53.300
As we can see this here's a requested URL.

91
00:04:54.300 --> 00:04:57.100
On this URL should be similar or the same

92
00:04:57.100 --> 00:04:58.900
 within a web browser. Let's check.

93
00:05:00.200 --> 00:05:03.400
And it is the same. So let's copy this entire

94
00:05:03.400 --> 00:05:06.800
 URL from our web browser and let's

95
00:05:06.800 --> 00:05:08.300
 open a terminal.

96
00:05:10.500 --> 00:05:13.500
In this terminal we can use the details

97
00:05:13.500 --> 00:05:16.400
 that Loop so it was able to capture such as

98
00:05:16.400 --> 00:05:18.300
 the actual cookie information.

99
00:05:19.400 --> 00:05:20.400
with a session ID

100
00:05:21.600 --> 00:05:24.400
Firstly let's type sudo. We'll type

101
00:05:24.400 --> 00:05:26.400
 SQL map like so

102
00:05:27.600 --> 00:05:29.100
dash dash URL

103
00:05:29.900 --> 00:05:32.800
followed by the actual URL. However,

104
00:05:32.800 --> 00:05:36.200
 we need to make some modifications since SQL

105
00:05:35.200 --> 00:05:38.700
 map cannot recognize these and

106
00:05:38.700 --> 00:05:39.600
 symbols.

107
00:05:40.700 --> 00:05:42.700
We need to put a slash like Zoo.

108
00:05:44.700 --> 00:05:48.700
then we'll specify dash dash cookie like

109
00:05:47.700 --> 00:05:49.000
 so

110
00:05:50.600 --> 00:05:53.300
Equals, let's have a back to both suite and

111
00:05:53.300 --> 00:05:54.400
 copy the cookie information.

112
00:06:00.400 --> 00:06:03.400
We'll specify a single open quotation marks

113
00:06:03.400 --> 00:06:03.600
 like so

114
00:06:04.700 --> 00:06:07.400
I will simply peace the cookie

115
00:06:07.400 --> 00:06:07.700
 details.

116
00:06:08.800 --> 00:06:10.500
with a close quotation mark

117
00:06:11.400 --> 00:06:14.000
and next we'll specify - DBS.

118
00:06:14.700 --> 00:06:17.400
This simply allows SQL map to

119
00:06:17.400 --> 00:06:21.100
 check for any sort of potential SQL injection vulnerabilities

120
00:06:20.100 --> 00:06:24.000
 within the web application. Simply hit

121
00:06:23.200 --> 00:06:25.200
 enter when you are ready.

122
00:06:27.200 --> 00:06:30.700
For any of these problems that appear simply enter the

123
00:06:30.700 --> 00:06:31.300
 select the default.

124
00:06:32.400 --> 00:06:35.600
On the scan is complete. I'll shown it has found

125
00:06:35.600 --> 00:06:38.400
 70 devices and these are the seven

126
00:06:38.400 --> 00:06:41.300
 databases that exists behind the web application.

127
00:06:42.100 --> 00:06:43.100
So what can we do next?

128
00:06:44.400 --> 00:06:47.100
The great thing is we can try to extract any sort of

129
00:06:47.100 --> 00:06:50.800
 sensitive details from these databases such as

130
00:06:50.800 --> 00:06:53.700
 identify what tables exists

131
00:06:53.700 --> 00:06:56.900
 any database we can first Target this

132
00:06:56.900 --> 00:06:59.700
 database Swiss, which is a d v

133
00:06:59.700 --> 00:07:02.100
 w a database now we can

134
00:07:02.100 --> 00:07:06.300
 press the up button and now we'll specify dash dash

135
00:07:06.300 --> 00:07:07.100
 tables.

136
00:07:08.200 --> 00:07:11.700
Then we'll specify Dash capital b as specified the

137
00:07:11.700 --> 00:07:12.900
 name of the d2bs.

138
00:07:13.600 --> 00:07:17.500
The name of the database is d v w

139
00:07:16.500 --> 00:07:18.100
 e

140
00:07:19.300 --> 00:07:20.300
Simply hit enter.

141
00:07:21.100 --> 00:07:24.600
And it will show us whether there are any tables under the

142
00:07:24.600 --> 00:07:26.200
 name of the tables within the database.

143
00:07:26.900 --> 00:07:29.800
As you can see there are two tables. There's a

144
00:07:29.800 --> 00:07:32.500
 table called guesswork and there's another table called

145
00:07:32.500 --> 00:07:33.200
 users.

146
00:07:34.400 --> 00:07:37.900
What if you want to see The Columns that

147
00:07:37.900 --> 00:07:39.200
 are found within the database?

148
00:07:40.100 --> 00:07:43.200
Simply press up once more and we can

149
00:07:43.200 --> 00:07:46.600
 remove tables and specify columns.

150
00:07:47.700 --> 00:07:48.400
like so

151
00:07:48.900 --> 00:07:49.700
simply enter

152
00:07:50.600 --> 00:07:53.900
and great. We have found various columns.

153
00:07:53.900 --> 00:07:57.700
 There's a column called user Avatar this

154
00:07:56.700 --> 00:08:00.500
 name last name password and

155
00:07:59.500 --> 00:08:02.900
 even the user ID and for

156
00:08:02.900 --> 00:08:03.400
 the guest book.

157
00:08:03.900 --> 00:08:06.800
There's comment comment ID under the

158
00:08:06.800 --> 00:08:06.900
 name.

159
00:08:07.400 --> 00:08:11.500
Between these tables the users table seems

160
00:08:10.500 --> 00:08:12.400
 to be more interesting.

161
00:08:13.200 --> 00:08:15.300
Simply because most likely.

162
00:08:16.100 --> 00:08:19.800
We can extract the passwords and perhaps the curb

163
00:08:19.800 --> 00:08:22.600
 them or even use a password hashes to gain

164
00:08:22.600 --> 00:08:25.300
 access into user's accounts. Let's try

165
00:08:25.300 --> 00:08:28.400
 to extract this information. Let's press up

166
00:08:28.400 --> 00:08:31.800
 one more time and this time and this

167
00:08:31.800 --> 00:08:34.600
 time let's delete columns and actually

168
00:08:34.600 --> 00:08:37.400
 dump the actual results like so

169
00:08:37.400 --> 00:08:40.000
 so what we're doing is that we are dumping the

170
00:08:40.400 --> 00:08:44.800
 details from the users table from the dvw80 to

171
00:08:44.800 --> 00:08:44.900
 be

172
00:08:46.100 --> 00:08:49.600
Simply hit enter and notice asking do you

173
00:08:49.600 --> 00:08:53.100
 want to store the hashes to a temporary file? We

174
00:08:52.100 --> 00:08:55.700
 can simply type enter for now and just

175
00:08:55.700 --> 00:08:57.000
 use the default settings.

176
00:08:59.400 --> 00:09:02.600
Let's see whether or not SQL map is able to crack those

177
00:09:02.600 --> 00:09:03.400
 password hashes.

178
00:09:04.500 --> 00:09:07.600
As you can see it is actually cracking some

179
00:09:07.600 --> 00:09:09.200
 of the hashes one by one.

180
00:09:10.300 --> 00:09:14.300
So from the password hashes, we are able to crack users passwords.

181
00:09:15.600 --> 00:09:18.400
We can see the first User it's called admin.

182
00:09:19.200 --> 00:09:21.000
We have the Avatar file.

183
00:09:22.100 --> 00:09:23.400
There's a password hash.

184
00:09:24.200 --> 00:09:25.400
and actual password

185
00:09:26.800 --> 00:09:27.700
for the second user

186
00:09:29.400 --> 00:09:31.600
We have the two user the fourth.

187
00:09:32.900 --> 00:09:33.600
And so on.

188
00:09:34.700 --> 00:09:37.300
So now that we have the users username.

189
00:09:37.900 --> 00:09:39.400
and their password hashes

190
00:09:40.200 --> 00:09:41.400
We can simply log in.

191
00:09:42.200 --> 00:09:45.500
To the web application while pretending to be these users.

192
00:09:46.600 --> 00:09:49.100
As you have seen SQL map is

193
00:09:49.100 --> 00:09:52.300
 a very valuable tool as it allows us to check

194
00:09:52.300 --> 00:09:55.600
 fatals D2 pieces and even extract

195
00:09:55.600 --> 00:09:58.400
 the records and even perform password cracking.

196
00:09:59.400 --> 00:10:02.100
During the course of this video you have learned how to use

197
00:10:02.100 --> 00:10:05.400
 SQL map to automate SQL injection

198
00:10:05.400 --> 00:10:08.900
 attacks against a vulnerable web application server.

199
00:10:10.100 --> 00:10:13.700
In the next video, we'll be starting section 9. I hope

200
00:10:13.700 --> 00:10:16.500
 this section on this video has been informative for

201
00:10:16.500 --> 00:10:18.100
 you and I will see you in the next one.
