Skip to content

Commit

Permalink
obfuscation name changes bypass
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelsc committed Sep 20, 2018
1 parent 17db7c5 commit 139740c
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions src/android/FirebasePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -728,13 +728,24 @@ public void onVerificationCompleted(PhoneAuthCredential credential) {

JSONObject returnResults = new JSONObject();
try {
String verificationId = getPrivateField(credential, "zzfc");
String code = getPrivateField(credential, "zzfd");

returnResults.put("verificationId", verificationId);
returnResults.put("code", code);
String verificationId = null;
String code = null;

Field[] fields = credential.getClass().getDeclaredFields();
for (Field field : fields) {
Class type = field.getType();
if(type == String.class){
String value = getPrivateField(credential, field);
if(value == null) continue;
if(value.length() > 100) verificationId = value;
else if(value.length() >= 4 && value.length() <= 6) code = value;
}
}

returnResults.put("verificationId", verificationId != null ? verificationId : false);
returnResults.put("code", code != null ? code : false);
returnResults.put("instantVerification", true);
} catch(Exception e){ // JSONException | IllegalAccessException | NoSuchFieldException
} catch(JSONException e){
Crashlytics.logException(e);
callbackContext.error(e.getMessage());
return;
Expand Down Expand Up @@ -800,10 +811,13 @@ public void onCodeSent(String verificationId, PhoneAuthProvider.ForceResendingTo
});
}

private static String getPrivateField(PhoneAuthCredential credential, String field) throws NoSuchFieldException, IllegalAccessException {
Field credentialField = credential.getClass().getDeclaredField(field);
credentialField.setAccessible(true);
return (String) credentialField.get(credential);
private static String getPrivateField(PhoneAuthCredential credential, Field field) {
try {
field.setAccessible(true);
return (String) field.get(credential);
} catch (IllegalAccessException e) {
return null;
}
}

//
Expand Down

0 comments on commit 139740c

Please sign in to comment.