Skip to content

Commit 45a142c

Browse files
tyvsmithKarl Rieb
authored andcommitted
Fix Android Fake ID Vulnerability.
Fixes T100909
1 parent a6b5b18 commit 45a142c

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/main/java/com/dropbox/core/android/AuthActivity.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.dropbox.core.android;
22

33
import java.security.SecureRandom;
4-
import java.security.SecureRandomSpi;
4+
import java.util.Arrays;
55
import java.util.List;
66
import java.util.Locale;
77

@@ -515,15 +515,13 @@ private boolean hasDropboxApp(Intent intent) {
515515
}
516516

517517
for (Signature signature : packageInfo.signatures) {
518-
for (String dbSignature : DROPBOX_APP_SIGNATURES) {
519-
if (dbSignature.equals(signature.toCharsString())) {
520-
return true;
521-
}
518+
if (!DROPBOX_APP_SIGNATURES.contains(signature.toCharsString())) {
519+
return false;
522520
}
523521
}
524522
}
525523

526-
return false;
524+
return true;
527525
}
528526

529527
private void startWebAuth(String state) {
@@ -547,7 +545,7 @@ private void startWebAuth(String state) {
547545
startActivity(intent);
548546
}
549547

550-
private static final String[] DROPBOX_APP_SIGNATURES = {
548+
private static final List<String> DROPBOX_APP_SIGNATURES = Arrays.asList(
551549
"308202223082018b02044bd207bd300d06092a864886f70d01010405003058310b3" +
552550
"009060355040613025553310b300906035504081302434131163014060355040713" +
553551
"0d53616e204672616e636973636f3110300e060355040a130744726f70626f78311" +
@@ -579,7 +577,7 @@ private void startWebAuth(String state) {
579577
"7bac97ae6d878064d47b3f9f8da654995b8ef4c385bc4fbfbb7a987f60783ef0348" +
580578
"760c0708acd4b7e63f0235c35a4fbcd5ec41b3b4cb295feaa7d5c27fa562a02562b" +
581579
"7e1f4776b85147be3e295714986c4a9a07183f48ea09ae4d3ea31b88d0016c65b93" +
582-
"526b9c45f2967c3d28dee1aff5a5b29b9c2c8639"};
580+
"526b9c45f2967c3d28dee1aff5a5b29b9c2c8639");
583581

584582
private String createStateNonce() {
585583
final int NONCE_BYTES = 16; // 128 bits of randomness.

0 commit comments

Comments
 (0)