WEBVTT - This file was automatically generated by VIMEO

1
00:00:06.500 --> 00:00:09.600
 So this video, we're going to take a look at it and secure data

2
00:00:09.600 --> 00:00:12.300
 storage. So there's a lot of different ways to try to

3
00:00:12.300 --> 00:00:15.100
 store data in Android applications. And a lot of the

4
00:00:15.100 --> 00:00:18.300
 may appear secure on the surface. However, with the proper

5
00:00:18.300 --> 00:00:21.400
 permissions in setups, you will be able to gain access to them,

6
00:00:21.400 --> 00:00:24.200
 as someone who is not supposed to gain access to them

7
00:00:24.200 --> 00:00:27.800
 which in turn can mean that you can compromise sensitive data

8
00:00:27.800 --> 00:00:30.100
 either from the user or from the

9
00:00:30.100 --> 00:00:33.500
 developers themselves. So this is horrific a two-sided. Vondra

10
00:00:33.500 --> 00:00:36.500
 bility. Incense of like, getting use

11
00:00:36.500 --> 00:00:40.000
 your data. It's a bit of a week or vulnerability because it

12
00:00:39.400 --> 00:00:42.400
 requires root access to be able to access mostly

13
00:00:42.400 --> 00:00:45.400
 files. There may be ways however, to get access

14
00:00:45.400 --> 00:00:48.700
 these files without Root permissions and that would be an indication

15
00:00:48.700 --> 00:00:51.400
 of a vulnerability. However, if there's specific like

16
00:00:51.400 --> 00:00:54.600
 developer secret data inside of these files and

17
00:00:54.600 --> 00:00:57.600
 were able to access them. Then this would be a vulnerability whether

18
00:00:57.600 --> 00:01:00.300
 or not we have root access because we shouldn't be able to get access

19
00:01:00.300 --> 00:01:03.900
 to those sort of secret data pieces, such as API keys,

20
00:01:03.900 --> 00:01:05.700
 in password, it sent that certificates.

21
00:01:06.500 --> 00:01:09.300
 So in this video will take a look at a few different types of up

22
00:01:09.300 --> 00:01:10.400
 on her abilities like this.

23
00:01:11.200 --> 00:01:14.400
 So the first one is at the investiture data storage part

24
00:01:14.400 --> 00:01:17.200
 1 with this, we can enter in say a

25
00:01:17.200 --> 00:01:20.100
 username and a password, and we

26
00:01:20.100 --> 00:01:23.500
 can save it onto our device. So we enter the username and password and

27
00:01:23.500 --> 00:01:26.900
 then we hit save that. It was a third-party credentials. Safe. Successfully.

28
00:01:26.900 --> 00:01:29.200
 We take a look at the code for this.

29
00:01:29.200 --> 00:01:32.300
 We can see that we received the credentials. It's using would call

30
00:01:32.300 --> 00:01:35.800
 the shirt preference that was shirt preferences. They're

31
00:01:35.800 --> 00:01:38.700
 sexually specific types of the files that exists

32
00:01:38.700 --> 00:01:41.900
 in a like in a standard directory and

33
00:01:41.900 --> 00:01:44.500
 these files will be able to store different pieces of information in

34
00:01:44.500 --> 00:01:47.300
 them. And the idea is that when we're trying to access, I

35
00:01:47.300 --> 00:01:50.500
 think that we can access it from an unknown location. That is

36
00:01:50.500 --> 00:01:53.300
 a certificate to the application and not accessible. Unless

37
00:01:53.300 --> 00:01:56.400
 you have root permissions. This works very well for

38
00:01:56.400 --> 00:01:59.200
 trying to store data, that isn't sensitive. So I don't

39
00:01:59.200 --> 00:02:02.300
 generally used by the application may be like location to

40
00:02:02.300 --> 00:02:05.500
 images or like a set of questions like a survey or

41
00:02:05.500 --> 00:02:08.300
 something like that. These are the things wouldn't be sensitive because

42
00:02:08.300 --> 00:02:10.700
 they're accessible by the user through the application.

43
00:02:11.200 --> 00:02:14.400
 If we can go to the user to

44
00:02:14.400 --> 00:02:17.600
 the application, this would be an instance of information

45
00:02:17.600 --> 00:02:20.200
 disclosure. So how do we gain access to

46
00:02:20.200 --> 00:02:23.200
 the shared preferences folder? What I'm going to do

47
00:02:23.200 --> 00:02:26.200
 is I'm going to go ahead and she'll into my

48
00:02:26.200 --> 00:02:26.400
 device.

49
00:02:28.400 --> 00:02:31.200
 Am I showing for my device? I'm going to go ahead and make myself a

50
00:02:31.200 --> 00:02:34.200
 Superuser using the Su command. And then

51
00:02:34.200 --> 00:02:37.600
 what we're going to do is we're going to CD into the data folder and then

52
00:02:37.600 --> 00:02:40.300
 it's tied up here. There's another beautiful there. So we're

53
00:02:40.300 --> 00:02:43.800
 Jada slashed data and it said, if you're go see data for

54
00:02:43.800 --> 00:02:46.700
 all of the applications that are on your device, to

55
00:02:46.700 --> 00:02:49.400
 all of these applications have data associated with them.

56
00:02:49.400 --> 00:02:52.200
 This one right here is the folder associated with

57
00:02:52.200 --> 00:02:56.000
 Diva. The name will always match the name of the application itself. So

58
00:02:55.500 --> 00:02:58.400
 we can CD into that folder.

59
00:02:58.400 --> 00:03:01.200
 You see, inside of here. We have a few different

60
00:03:01.200 --> 00:03:04.600
 options. Are the cast will be cold cash. We have databases to be

61
00:03:04.600 --> 00:03:08.200
 at the library, is ending ever shared preferences. The should

62
00:03:07.200 --> 00:03:10.400
 preferences is where we see Wild the data.

63
00:03:10.400 --> 00:03:14.500
 That's written using this shirt preferences objects, right?

64
00:03:14.500 --> 00:03:17.500
 So any time that we were going to be sleeping and sweatshirt

65
00:03:17.500 --> 00:03:20.500
 preferences folder. So now I buy CD into

66
00:03:20.500 --> 00:03:23.700
 shared preferences, you'll see that we have this single XML

67
00:03:23.700 --> 00:03:24.100
 file.

68
00:03:24.600 --> 00:03:27.500
 And if I use the cat command, I can see what's

69
00:03:27.500 --> 00:03:30.200
 inside of that file. I mean, alternatively, you could also

70
00:03:30.200 --> 00:03:33.500
 pull it off the device and read it, but on the cat command allows

71
00:03:33.500 --> 00:03:36.300
 you to see it quickly. And as you can see, it's toward the

72
00:03:36.300 --> 00:03:39.300
 username and password that we types it. So, whatever

73
00:03:39.300 --> 00:03:42.800
 we type in inside of there, will be with storage here. So for

74
00:03:42.800 --> 00:03:45.500
 instance, if I change this to password one for instance and

75
00:03:45.500 --> 00:03:48.400
 save it, then we should see that this will change

76
00:03:48.400 --> 00:03:51.200
 the password one, but you can see right

77
00:03:51.200 --> 00:03:51.400
 here.

78
00:03:52.400 --> 00:03:55.500
 So you can see that this would be considered insecure data storage because

79
00:03:55.500 --> 00:03:58.200
 I can gain access to it, just by having a rooted device

80
00:03:58.200 --> 00:04:01.300
 device that I have a rooted device is sort of irrelevant to

81
00:04:01.300 --> 00:04:04.300
 my likability to access this date. I should have be able to get

82
00:04:04.300 --> 00:04:07.500
 your Sims ID passwords, whether braided or not. So, this would

83
00:04:07.500 --> 00:04:09.700
 be an example of insecurity in a storage.

84
00:04:10.700 --> 00:04:13.300
 Right? And then you can go and take the other pieces like, you

85
00:04:13.300 --> 00:04:16.800
 know, the password really should be hashed or something like that. It in

86
00:04:16.800 --> 00:04:19.100
 the sense. It really doesn't matter with half your not cuz you can

87
00:04:19.100 --> 00:04:22.400
 offline force that password and potentially gaining access to it.

88
00:04:22.400 --> 00:04:25.500
 You know, how attached based on the, on the code since

89
00:04:25.500 --> 00:04:28.600
 we have access to the code, we have access to the password hash

90
00:04:28.600 --> 00:04:31.200
 therefore unhatching the password or

91
00:04:31.200 --> 00:04:34.400
 finding a house that corresponds to that password wouldn't necessarily be

92
00:04:34.400 --> 00:04:37.900
 hard unless the password to unlock but there

93
00:04:37.900 --> 00:04:40.300
 are certain instances where if we could do a quick password might

94
00:04:40.300 --> 00:04:43.100
 be able to compromise any gain access. So this is something to

95
00:04:43.100 --> 00:04:46.400
 know about these shared access points is that they're accessible by

96
00:04:46.400 --> 00:04:49.500
 users. So we really should be favoring things like online

97
00:04:49.500 --> 00:04:52.000
 servers. If we can or sort of

98
00:04:52.500 --> 00:04:55.300
 hardening these down like password protecting the files or password

99
00:04:55.300 --> 00:04:58.400
 protecting a database for instance, and I'm speaking

100
00:04:58.400 --> 00:05:01.600
 of the pieces we could take a look at database storage as well. So

101
00:05:01.600 --> 00:05:04.000
 let's go ahead and I'll go back here.

102
00:05:04.700 --> 00:05:08.300
 And we have a second and secure data storage so

103
00:05:07.300 --> 00:05:10.700
 I can put in my username and

104
00:05:10.700 --> 00:05:10.900
 password.

105
00:05:13.100 --> 00:05:17.400
 And again, I do this, I can save it and it will save it successfully. So,

106
00:05:16.400 --> 00:05:19.800
 we take a look at the code here. You can

107
00:05:19.800 --> 00:05:22.500
 see that were inserting the data into a

108
00:05:22.500 --> 00:05:25.900
 mi into a sequel, light database, right? So in

109
00:05:25.900 --> 00:05:28.300
 general, most databases that you work with through

110
00:05:28.300 --> 00:05:31.000
 Android or going to be sequel light, but you can also tell that because of the

111
00:05:31.500 --> 00:05:34.700
 import up here that says seek with light database that exposes what

112
00:05:34.700 --> 00:05:37.100
 kind of database is being used. So you can

113
00:05:37.100 --> 00:05:40.100
 give you this information is being saved you some sort of database then we can

114
00:05:40.100 --> 00:05:42.400
 ask. Well, where can we find that database, right?

115
00:05:44.100 --> 00:05:47.100
 And the answer is if we CD up when directory will see this

116
00:05:47.100 --> 00:05:50.700
 folder called databases. We going to the databases folder,

117
00:05:50.700 --> 00:05:53.100
 we can see that there's a bunch of different databases that

118
00:05:53.100 --> 00:05:56.500
 exists inside of here. Now, which of these databases

119
00:05:56.500 --> 00:05:59.900
 is the correct one. And we

120
00:05:59.900 --> 00:06:02.200
 really just have to sort of look at the different things

121
00:06:02.200 --> 00:06:05.800
 that are available here. You'll see open or create database IDs, to

122
00:06:05.800 --> 00:06:08.300
 the tells us that the IDS to database is

123
00:06:08.300 --> 00:06:11.300
 the one that were likely looking for. So I can do

124
00:06:11.300 --> 00:06:14.500
 is, I can see a sequel, light 3 IDs to.

125
00:06:14.500 --> 00:06:17.500
 And as you can see, this opens up the IDS to

126
00:06:17.500 --> 00:06:21.000
 database inside of SQL light. And from

127
00:06:20.300 --> 00:06:23.300
 here, you can take me to come in like. Tea bowls and

128
00:06:23.300 --> 00:06:26.100
 that will show you the table that exist in the database. And then we can

129
00:06:26.100 --> 00:06:30.000
 do just like a simple Flex car from my user. And

130
00:06:29.100 --> 00:06:32.200
 you can see it exposes any users that were

131
00:06:32.200 --> 00:06:35.400
 in, put it into this input field. Right? So I did the test went

132
00:06:35.400 --> 00:06:38.700
 earlier username and password was the one that I just did. So you

133
00:06:38.700 --> 00:06:41.400
 can see that this very easily exposes the user.

134
00:06:41.400 --> 00:06:44.000
 So again, since I can access this.

135
00:06:44.100 --> 00:06:47.400
 It isn't considered to be a secure data storage method because

136
00:06:47.400 --> 00:06:50.400
 even though I have access doesn't really mean much

137
00:06:50.400 --> 00:06:53.100
 if I can access the data still, you know, whether you

138
00:06:53.100 --> 00:06:56.700
 can access it with Ruth, but you can access it without root access to

139
00:06:56.700 --> 00:06:59.600
 sensitive data, which you shouldn't be able to do. So, this is

140
00:06:59.600 --> 00:07:02.400
 something that we need to consider as well as that these databases have

141
00:07:02.400 --> 00:07:06.000
 been properly, secured could be compromised. The

142
00:07:05.300 --> 00:07:08.700
 proper thing to do here is to use a library on

143
00:07:08.700 --> 00:07:11.100
 the roof. You like a sequel safer? For

144
00:07:11.100 --> 00:07:14.600
 instance, I think is one that's available for Android. And what

145
00:07:14.600 --> 00:07:17.500
 they'll do with the password? Protect these databases for you through

146
00:07:17.500 --> 00:07:20.300
 like an encrypted process to anytime to

147
00:07:20.300 --> 00:07:23.500
 access it needs to sort of like decrypted and then run

148
00:07:23.500 --> 00:07:26.300
 or queries and then encrypted again, so if this

149
00:07:26.300 --> 00:07:29.500
 is done, then if we tracked it to his people like 3 and won't

150
00:07:29.500 --> 00:07:33.100
 be able to, we have to actually cracked the encryption on the database and

151
00:07:32.100 --> 00:07:36.000
 encryption is sufficiently strong. Then

152
00:07:35.100 --> 00:07:38.400
 it would be a much more secure data storage benches

153
00:07:38.400 --> 00:07:42.000
 stirring stuff in plain text out in the open, right? This

154
00:07:41.100 --> 00:07:43.900
 is another thing to consider and this is

155
00:07:44.400 --> 00:07:47.500
 Before we consider the fact that it looks like, this could easily be like

156
00:07:47.500 --> 00:07:50.800
 I'm victimized of SQL injection rate. You could probably do

157
00:07:50.800 --> 00:07:53.400
 SQL injection, cuz we just can't at knitting stuff into it,

158
00:07:53.400 --> 00:07:58.200
 but that will be something for another like, yeah. So

159
00:07:57.200 --> 00:08:00.300
 this would be another example of semantic. Your data

160
00:08:00.300 --> 00:08:03.100
 storage is, if we store things in the databases that are

161
00:08:03.100 --> 00:08:06.700
 available to us. I really do user. Can still gain access to them and potentially

162
00:08:06.700 --> 00:08:08.300
 get to those credentials.

163
00:08:09.900 --> 00:08:12.700
 That was their type of insecure. Data storage is sort

164
00:08:12.700 --> 00:08:15.600
 of like a more generic type of insecure storage

165
00:08:15.600 --> 00:08:18.300
 again. It's the same sort of structure. We

166
00:08:18.300 --> 00:08:20.800
 have username and password.

167
00:08:21.800 --> 00:08:24.100
 Eddie, can save it and get the credentials, see if

168
00:08:24.100 --> 00:08:27.300
 successfully. But if we take a look at this really all this

169
00:08:27.300 --> 00:08:30.600
 does is it creates a temp file? You see, as you info

170
00:08:30.600 --> 00:08:33.400
 in front of its and it says it's readable writable and

171
00:08:33.400 --> 00:08:37.300
 then it right to the username and password and saves it. So, when

172
00:08:36.300 --> 00:08:39.400
 this sort of thing happens, we're essentially saving

173
00:08:39.400 --> 00:08:42.200
 it. Local to that data folder. And you can tell

174
00:08:42.200 --> 00:08:46.500
 that because I'm so it's get up with Kitchen in photo editor. Is

175
00:08:46.500 --> 00:08:49.700
 this data directory that we're currently inside of semen,

176
00:08:49.700 --> 00:08:52.900
 we do this. You'll be able to see that I can quit out

177
00:08:52.900 --> 00:08:55.300
 of SQL light. And if I CD

178
00:08:55.300 --> 00:08:58.700
 up One Directory, you'll see this, you info folder. That's

179
00:08:58.700 --> 00:09:01.200
 now been created. And again, I can simply just

180
00:09:01.200 --> 00:09:04.800
 cat that folder and you'll

181
00:09:04.800 --> 00:09:07.700
 get username and password great. So you can see that it

182
00:09:07.700 --> 00:09:10.900
 again to seize the data in plain text, even

183
00:09:10.900 --> 00:09:13.200
 though it's in a directory that can only be accessible by

184
00:09:13.200 --> 00:09:16.300
 Route. The data is still there and accessible so

185
00:09:16.300 --> 00:09:19.400
 you can so we can access to it. So this gives you a good idea of the

186
00:09:19.400 --> 00:09:21.800
 different types of insecurity to storage that exist.

187
00:09:21.800 --> 00:09:24.300
 General. If you're looking at any sensitive data,

188
00:09:24.300 --> 00:09:27.600
 that is stored inside of databases. And so, does shift preferences or

189
00:09:27.600 --> 00:09:30.200
 just inside of folders, anywhere, a root user

190
00:09:30.200 --> 00:09:33.300
 can gain access to them. So it was folder should be treated with

191
00:09:33.300 --> 00:09:36.200
 the same level of security that someone is able to access them if

192
00:09:36.200 --> 00:09:39.600
 they so choose to. So you can keep in that in mind

193
00:09:39.600 --> 00:09:42.200
 and work with things like encrypted files are encrypted

194
00:09:42.200 --> 00:09:45.600
 data bases. In order to ensure that people can't actually access the

195
00:09:45.600 --> 00:09:48.300
 day because I'm leaving it out in the open means that

196
00:09:48.300 --> 00:09:51.200
 if you have a rear diffuser, who's using your application, they can

197
00:09:51.200 --> 00:09:54.400
 gain access to that data, which could potentially be catastrophic if

198
00:09:54.400 --> 00:09:57.300
 any website that has access to both are right. If it's just

199
00:09:57.300 --> 00:10:00.200
 their username and password. It's not really that big of a deal, but if it's

200
00:10:00.200 --> 00:10:04.400
 other people's names are passwords or generic information

201
00:10:03.400 --> 00:10:07.300
 about like the application application

202
00:10:06.300 --> 00:10:09.500
 using two passwords and usernames and passwords any of

203
00:10:09.500 --> 00:10:12.100
 that stuff that we don't want that to be stored here

204
00:10:12.100 --> 00:10:13.700
 because then you can get access to it.

205
00:10:14.500 --> 00:10:17.600
 52 idea. What to look for for these sort of things up. I

206
00:10:17.600 --> 00:10:20.400
 give me to decompile the application. You can look at things likes, your

207
00:10:20.400 --> 00:10:23.800
 preferences and file rates and a database inserts, to

208
00:10:23.800 --> 00:10:26.200
 find these sorts of vulnerabilities. Or in

209
00:10:26.200 --> 00:10:29.200
 general. We can just refused the up a little bit and then go to. It said, they

210
00:10:29.200 --> 00:10:32.700
 did director and see what kind of stuff is available inside of there. So, these

211
00:10:32.700 --> 00:10:35.600
 are some common fund abilities that will typically exist inside of

212
00:10:35.600 --> 00:10:38.400
 Android applications that you are now able to find and

213
00:10:38.400 --> 00:10:39.300
 report if you find them.
