Skip to content

[Security Enhancement] Decentralizing the encrypted "hash" in the native libraryΒ #126

Description

@kaitoz11

Current behavior

At build time, the plaintext configuration is encrypted and embedded into the native library file alongside some obfuscation operations.

However, the libreact-native-keys.so library file alone is currently sufficient for an attacker to retrieve the plaintext config.
Image

Bypassing the following key validation procedure:

string hash;
string halfString = base64Secret.substr(base64Secret.length() / 2);
if (key == halfString)
{
return plaintext;
}
else
{
return "";
}

Expected behavior

The key parameter (pass in from Java/Objective-C layer) should be a cryptographically required component in the decryption process. An attacker should not be able to retrieve the plaintext configuration statically from the libreact-native-keys.so file alone.

Proposed Solution

This can be addressed in several ways, but the core requirement is that the parameter needed to decrypt the config is not stored entirely in one place.

My recommendation is to use the key parameter as an active variable to reconstruct or decrypt the values of getEncryptedSecureData and/or getPasswordSecureData. By deriving the final decryption key partially from the runtime argument, the .so file alone will no longer contain all the necessary information to extract the sensitive configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions