WEBVTT - This file was automatically generated by VIMEO

1
00:00:06.400 --> 00:00:09.700
 Connect to take a look at issues that are related to input

2
00:00:09.700 --> 00:00:12.500
 validation. So when we ever get

3
00:00:12.500 --> 00:00:15.000
 like input from a user, we should be validating that

4
00:00:15.300 --> 00:00:18.200
 in put, in whatever way that we can. So we should be

5
00:00:18.200 --> 00:00:22.000
 like a sanitizing, make sure that they don't even put anything that's vulnerable

6
00:00:21.900 --> 00:00:24.800
 or that could potentially lead

7
00:00:24.800 --> 00:00:27.500
 to an exploit essentially. So there are

8
00:00:27.500 --> 00:00:30.600
 a few different types of input validation and ruse

9
00:00:30.600 --> 00:00:33.100
 that can occur inside of Android app. So we're going

10
00:00:33.100 --> 00:00:36.700
 to take a look at a few common ones right now. So for the

11
00:00:36.700 --> 00:00:39.200
 first set of input, validations they have to

12
00:00:39.200 --> 00:00:42.200
 do with database validation. So when were

13
00:00:42.200 --> 00:00:45.500
 you putting things into this? We can see that. For instance if I put in user

14
00:00:45.500 --> 00:00:48.500
 here and press search will see user not found.

15
00:00:48.500 --> 00:00:53.000
 You can see lab coat back whatever R-value

16
00:00:51.300 --> 00:00:55.000
 that's it. Put it is and it

17
00:00:54.200 --> 00:00:57.400
 will tell us that it's not found or it will Echo back

18
00:00:57.400 --> 00:01:00.300
 the details of the user. Presumably, if we had put one that

19
00:01:00.300 --> 00:01:00.900
 is found.

20
00:01:01.300 --> 00:01:05.000
 We're looking for the code that's related to this. We can go to SQL injection

21
00:01:04.500 --> 00:01:07.300
 activity. And this will show us exactly what's going

22
00:01:07.300 --> 00:01:07.400
 on.

23
00:01:08.400 --> 00:01:11.400
 So as you can see here, it's doing the rock. We're against

24
00:01:11.400 --> 00:01:14.500
 the database. And this is the query that's actually happening.

25
00:01:14.500 --> 00:01:17.300
 And you can actually see that when it encounters an

26
00:01:17.300 --> 00:01:20.300
 exception. It's going to actually show the exception in the

27
00:01:20.300 --> 00:01:23.800
 word luck. This means that if we go into our log

28
00:01:23.800 --> 00:01:27.000
 cat, which I've got open sharing Android Studio when

29
00:01:26.100 --> 00:01:29.700
 I M put in something invalid, so,

30
00:01:29.700 --> 00:01:32.100
 for instance, some a very good example of this

31
00:01:32.100 --> 00:01:35.400
 for testing purposes would be like a single quote. A single chord

32
00:01:35.400 --> 00:01:38.300
 is a piece of SQL, syntax visitor. Like code. It

33
00:01:38.300 --> 00:01:41.300
 should cause an error and see when I searched this. We've got

34
00:01:41.300 --> 00:01:44.900
 this error here that says unrecognized token. It tells

35
00:01:44.900 --> 00:01:47.500
 us that were interpreting that token as

36
00:01:47.500 --> 00:01:50.700
 code rather than interpreting it as an input. So, this

37
00:01:50.700 --> 00:01:53.900
 means immediately to me that this is vulnerable to SQL injection.

38
00:01:53.900 --> 00:01:56.900
 So let's take a look at how we can craft SQL

39
00:01:56.900 --> 00:01:59.200
 injection with this. We have access to the query. Hear

40
00:01:59.200 --> 00:02:02.200
 it again. This isn't an uncommon thing. If we can be compiled the

41
00:02:02.200 --> 00:02:05.600
 code, we can gain access to the queries. And as you can see, or

42
00:02:05.600 --> 00:02:07.000
 input is going in right here.

43
00:02:08.600 --> 00:02:11.600
 So come to the right in the middle here, right in between two single

44
00:02:11.600 --> 00:02:14.300
 quotes. With that tells me is that if I can end

45
00:02:14.300 --> 00:02:17.900
 the single quote and then input something that's always true. And

46
00:02:17.900 --> 00:02:20.200
 then maybe put a comment at the end that will

47
00:02:20.200 --> 00:02:23.700
 allow me to execute where user equals blank or say,

48
00:02:23.700 --> 00:02:26.200
 1 equals 1, which is always true, which will

49
00:02:26.200 --> 00:02:29.600
 return to me the whole database back. So let's

50
00:02:29.600 --> 00:02:32.400
 take a look at exactly what that looks like. If I put the closing quote

51
00:02:32.400 --> 00:02:35.600
 here. This will cool with the users in it. And

52
00:02:35.600 --> 00:02:39.000
 then we'll say it or or 1

53
00:02:38.700 --> 00:02:41.300
 equals one. And then

54
00:02:41.300 --> 00:02:45.000
 we can put a comment to the two dashes at the end of the comment or

55
00:02:44.200 --> 00:02:47.600
 1 equals one is something that's always true and

56
00:02:47.600 --> 00:02:50.500
 the closing single quote would close off this starting quote

57
00:02:50.500 --> 00:02:53.500
 here. So be user equals blank or 1 equals one.

58
00:02:53.500 --> 00:02:56.600
 And only comments that this and briefs you

59
00:02:56.600 --> 00:02:59.500
 are the send a single quote, here is an interpreted as

60
00:02:59.500 --> 00:03:02.400
 code, and it doing this, it will give us a valid

61
00:03:02.400 --> 00:03:05.300
 query. And not valid query is going to

62
00:03:05.300 --> 00:03:08.100
 return to us all of the content inside of a

63
00:03:08.100 --> 00:03:08.300
 database.

64
00:03:08.600 --> 00:03:12.000
 When I click search hear it exposes the whole

65
00:03:11.400 --> 00:03:14.400
 database credentials, right? You can

66
00:03:14.400 --> 00:03:17.200
 see that this is an example of being able to leak information

67
00:03:17.200 --> 00:03:20.500
 from a database using an invalid input. So

68
00:03:20.500 --> 00:03:23.400
 she contractions are very common type of input

69
00:03:23.400 --> 00:03:26.600
 validation error, that happens in a lot of different instances.

70
00:03:26.600 --> 00:03:29.300
 So this would be one example, and

71
00:03:29.300 --> 00:03:32.300
 this is one thing that you're always able to start past and I

72
00:03:32.300 --> 00:03:35.300
 always, will you get the errors actually printing in the log? It's

73
00:03:35.300 --> 00:03:38.800
 actually quite rare that someone would give you that. However, again,

74
00:03:38.800 --> 00:03:42.300
 if you just sort of like search for rock, query or query

75
00:03:41.300 --> 00:03:44.600
 in general, you should be able to find instances with

76
00:03:44.600 --> 00:03:45.700
 this sort of thing happens.

77
00:03:46.600 --> 00:03:49.800
 This is what type of input validation. That's relatively common. I'm

78
00:03:49.800 --> 00:03:52.100
 going to show you another type of input validation that is

79
00:03:52.100 --> 00:03:55.900
 rather interesting in a little bit different. So

80
00:03:55.900 --> 00:03:58.400
 we just want to hear you see that we can type in the URL to

81
00:03:58.400 --> 00:04:02.200
 show up. If I put in like to Google.

82
00:04:01.200 --> 00:04:04.900
 Ca for instance, our price

83
00:04:04.900 --> 00:04:07.300
 of you, you see it brings up the web page for Google.

84
00:04:08.400 --> 00:04:11.200
 So this is just like a simple web browser. And

85
00:04:11.200 --> 00:04:14.400
 if we going to the code, if it we can get a bit of a better idea of what's actually

86
00:04:14.400 --> 00:04:17.900
 happening. So you see here, you have the input validation scheme.

87
00:04:17.900 --> 00:04:21.100
 You see that it just has a load URL. No, on

88
00:04:20.100 --> 00:04:23.500
 the surface. This probably looks quite innocent because

89
00:04:23.500 --> 00:04:26.400
 load URL would imply to us that were just loading, any

90
00:04:26.400 --> 00:04:29.900
 sort of get a webpage. You were out. However, it be

91
00:04:29.900 --> 00:04:33.600
 interesting point here is that in Android files. As

92
00:04:33.600 --> 00:04:36.400
 you are always. Well, you can actually access files

93
00:04:36.400 --> 00:04:39.400
 on the system using the URL path of them.

94
00:04:39.400 --> 00:04:42.200
 So for instance, you can do something like this.

95
00:04:42.200 --> 00:04:46.200
 You could save file, you go colon and then you put three backslashes

96
00:04:45.200 --> 00:04:48.500
 and then you put it in the deposit of

97
00:04:48.500 --> 00:04:51.800
 files will save data data. For instance,

98
00:04:51.800 --> 00:04:54.700
 some I'm going to pick a file that I know exist.

99
00:04:54.700 --> 00:04:57.300
 This isn't part of the deal falls through looking at

100
00:04:57.300 --> 00:05:01.400
 we were taking a look at some and Secure Storage and

101
00:05:00.400 --> 00:05:03.200
 we know that there's one here called.

102
00:05:04.100 --> 00:05:08.000
 Car. Seem. Diva underscore

103
00:05:07.700 --> 00:05:10.200
 preferences. Eczema.

104
00:05:11.300 --> 00:05:15.000
 You can see our just put in the whole path of the of the

105
00:05:14.400 --> 00:05:15.500
 file itself.

106
00:05:17.700 --> 00:05:18.600
 And dumb.

107
00:05:28.400 --> 00:05:31.700
 At the other, some instances where this Alchemy crush on

108
00:05:31.700 --> 00:05:34.800
 you, it's not overly common, but it

109
00:05:34.800 --> 00:05:37.200
 could be from some other testing that I was doing

110
00:05:37.200 --> 00:05:41.500
 a related to this out for input validation. But let's

111
00:05:41.500 --> 00:05:46.300
 try this Diva references. XML.

112
00:05:45.300 --> 00:05:48.200
 You see, when I click on view,

113
00:05:48.200 --> 00:05:51.400
 hear it actually displays the file below here.

114
00:05:51.400 --> 00:05:54.700
 So have you remember, this is the file that we are created in

115
00:05:54.700 --> 00:05:57.900
 the end of the improper storage. So this

116
00:05:57.900 --> 00:06:00.200
 shows us how we can actually access that storage without

117
00:06:00.200 --> 00:06:03.100
 necessarily even having root permission. If we happened to

118
00:06:03.100 --> 00:06:06.100
 notice path, which they wouldn't be unreasonable for us to

119
00:06:06.100 --> 00:06:09.500
 know it. If we have it read a device, we can find it through easily or we

120
00:06:09.500 --> 00:06:12.300
 can find it to the code. We can actually access it.

121
00:06:12.300 --> 00:06:17.300
 If there's ever like a browser that happens to take in these file. So

122
00:06:15.300 --> 00:06:18.100
 this is a

123
00:06:18.100 --> 00:06:21.700
 very critical vulnerability to the laws for information leaks

124
00:06:21.700 --> 00:06:24.800
 and we can get to really any sort of file on the system utilizing

125
00:06:24.800 --> 00:06:27.400
 this and we might even be able to access this from other

126
00:06:27.400 --> 00:06:28.300
 applications.

127
00:06:28.400 --> 00:06:31.500
 House, like a provider that allows us to launch this activity may

128
00:06:31.500 --> 00:06:34.700
 be, right. So this is a very common and

129
00:06:34.700 --> 00:06:37.300
 critical vulnerability. So this is another type

130
00:06:37.300 --> 00:06:40.600
 of input validation that you can look out for something is parsley with

131
00:06:40.600 --> 00:06:43.500
 peach. Utilizing this whole on this load

132
00:06:43.500 --> 00:06:46.300
 URL. It's very possible that we'll

133
00:06:46.300 --> 00:06:49.600
 be able to load internal URLs which

134
00:06:49.600 --> 00:06:50.800
 are actually cost to file.

135
00:06:51.600 --> 00:06:54.500
 This is another type of common input, validation not again.

136
00:06:54.500 --> 00:06:57.700
 So we have databases and behavioral loading is

137
00:06:57.700 --> 00:07:00.100
 there type of input validation is a little bit

138
00:07:00.100 --> 00:07:03.400
 different and the way that it essentially works is by calling

139
00:07:03.400 --> 00:07:04.600
 external libraries.

140
00:07:05.400 --> 00:07:08.800
 So we'll see here is this uses the DJ and

141
00:07:08.800 --> 00:07:11.300
 I Funk. Function, but

142
00:07:11.300 --> 00:07:14.400
 class rather and you see that it uses them, a

143
00:07:14.400 --> 00:07:18.200
 very specific Pisa initiate, launch sequence. So

144
00:07:17.200 --> 00:07:20.200
 it was interesting about this is that if we

145
00:07:20.200 --> 00:07:23.600
 go to this son to this input validation 3,

146
00:07:24.500 --> 00:07:27.200
 More able to use real to put in some input that attempted to

147
00:07:27.200 --> 00:07:30.400
 get it to watch and you'll see a gives us access denied in

148
00:07:30.400 --> 00:07:33.200
 these cases, what were actually able

149
00:07:33.200 --> 00:07:36.400
 to do it. This is since it's loading a shirt object wiper it

150
00:07:36.400 --> 00:07:39.700
 mean. If it's probably written in C or C, + + C +

151
00:07:39.700 --> 00:07:42.700
 C + + a relatively Infamous for a buffer overflows

152
00:07:42.700 --> 00:07:45.500
 and you can put something we to dig into this input. We

153
00:07:45.500 --> 00:07:48.600
 may be able to get it to overflow. So for instance,

154
00:07:48.600 --> 00:07:51.600
 if I just type in like a whole bunch of ace and I

155
00:07:51.600 --> 00:07:55.100
 push the red button, you'll see the application crashes in

156
00:07:54.100 --> 00:07:57.200
 an application crushes like that. It tells

157
00:07:57.200 --> 00:08:00.400
 us that they could potentially be a problem and

158
00:08:00.400 --> 00:08:03.200
 it might be related to a buffer overflow if you

159
00:08:03.200 --> 00:08:06.400
 want to get a bit more detail. We can actually go back into the log logs

160
00:08:06.400 --> 00:08:09.200
 and I'm assuming it's probably going to give us some

161
00:08:09.200 --> 00:08:12.300
 information inside of here when we try to crash this. So let's

162
00:08:12.300 --> 00:08:12.800
 try this again.

163
00:08:14.500 --> 00:08:17.400
 Yeah, you'll see there. We got the whole like sort

164
00:08:17.400 --> 00:08:17.900
 of dumped.

165
00:08:18.700 --> 00:08:21.900
 This right here is what we would call a

166
00:08:21.900 --> 00:08:24.600
 stock Trace essentially. So you

167
00:08:24.600 --> 00:08:27.100
 can see it gives us a lot of information here at

168
00:08:27.100 --> 00:08:30.100
 the main things that you want to get here, is that you see the parts of

169
00:08:30.100 --> 00:08:33.900
 the stock that would actually accessed. So we can see, they were actually overflowing

170
00:08:33.900 --> 00:08:36.200
 the stock here and you can see that it's giving us

171
00:08:36.200 --> 00:08:39.700
 some errors related to that. Now, what happens

172
00:08:39.700 --> 00:08:42.400
 here is if we can actually specially crafted or

173
00:08:42.400 --> 00:08:45.500
 we may be able to get the device to

174
00:08:45.500 --> 00:08:48.200
 execute code which may be able to get

175
00:08:48.200 --> 00:08:51.300
 us access to on execute code under the permission of

176
00:08:51.300 --> 00:08:54.500
 the application itself. In this would be an extremely

177
00:08:54.500 --> 00:08:58.400
 critical vulnerability. This is like a CVS 10.0 but

178
00:08:57.400 --> 00:09:00.400
 even just getting DM, the stack Overflow to

179
00:09:00.400 --> 00:09:03.900
 happen, create a very critical vulnerability as well. So

180
00:09:03.900 --> 00:09:06.300
 often times like with jabu, he's

181
00:09:06.300 --> 00:09:09.100
 not coming to see a stock overflow. But if you're using C, C

182
00:09:09.100 --> 00:09:12.100
 plus plus libraries or language, is similar to that where you have to

183
00:09:12.100 --> 00:09:15.600
 do memory management. This is definitely something that's in the possibilities. So

184
00:09:15.600 --> 00:09:18.300
 if you're able to find something like this, if an extremely

185
00:09:18.600 --> 00:09:21.100
 Durability. And again, the things that you want to look

186
00:09:21.100 --> 00:09:24.300
 out for for this is any sort of class that is loading a

187
00:09:24.300 --> 00:09:28.200
 shared object. So, this is DJ. And I class, we

188
00:09:27.200 --> 00:09:30.800
 talked about this earlier in the series, but

189
00:09:30.800 --> 00:09:35.100
 you see that has exploded library, right Library,

190
00:09:33.100 --> 00:09:36.200
 you might be

191
00:09:36.200 --> 00:09:39.300
 loading, ISO files, which are typically C C plus plus.

192
00:09:39.300 --> 00:09:42.300
 Now one other thing that I will note about this

193
00:09:42.300 --> 00:09:45.900
 is that we Red Wing Ranch strings against this Library. What

194
00:09:45.900 --> 00:09:48.900
 are the strings that came up with strcpy their

195
00:09:48.900 --> 00:09:51.300
 string? Copy screen? Copy is one

196
00:09:51.300 --> 00:09:54.400
 of those. See functions is Infamous for buffer overflows if

197
00:09:54.400 --> 00:09:57.200
 things are allocated properly. So those are the sort

198
00:09:57.200 --> 00:10:00.300
 of instances where we can actually you do. I stream to

199
00:10:00.300 --> 00:10:03.300
 see what kind of functions might be getting called that reveals to

200
00:10:03.300 --> 00:10:06.400
 a scene of the function of getting called witches, strcpy our strength,

201
00:10:06.400 --> 00:10:09.000
 be right. So we can see that when that

202
00:10:09.200 --> 00:10:12.400
 is used. It seems like it's causing the buffer overflow.

203
00:10:12.400 --> 00:10:15.200
 So it seems like that, string, copy is, what's causing that sort of

204
00:10:15.200 --> 00:10:18.500
 problem to actually get remote. Code, execution is,

205
00:10:18.600 --> 00:10:21.000
 Barely more complex. Top make it won't be one that

206
00:10:21.200 --> 00:10:24.200
 will talk about in this, but I wanted to demonstrate how you might be able

207
00:10:24.200 --> 00:10:27.400
 to identify those that are problems in an Android application, to be

208
00:10:27.400 --> 00:10:30.300
 able to report them cuz he can even just finding a buffer overflow.

209
00:10:30.300 --> 00:10:34.100
 Like that is a critical vulnerability. So it

210
00:10:33.100 --> 00:10:36.300
 gives you an idea of a few different types of input validation.

211
00:10:36.300 --> 00:10:39.400
 So that might commonly be found in Android application. So

212
00:10:39.400 --> 00:10:42.400
 many of the issues in general are very critical because

213
00:10:42.400 --> 00:10:45.600
 they mostly allow you to access things. You shouldn't be able to or

214
00:10:45.600 --> 00:10:48.600
 potentially do remote code execution. So they're all

215
00:10:48.600 --> 00:10:51.100
 very critical vulnerabilities and old ones that you should be

216
00:10:51.100 --> 00:10:54.200
 able to relatively easily find if they do exist in

217
00:10:54.200 --> 00:10:57.400
 an application. So just give you certain some of the fundamentals to

218
00:10:57.400 --> 00:10:58.400
 be able to locate those
