Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[security issue]: Android implementation use AES/ECB mode to encrypt/decrypt saved data #350

Open
jpstotz opened this issue May 29, 2024 · 0 comments

Comments

@jpstotz
Copy link

jpstotz commented May 29, 2024

The Android implementation defines

public static final String AES_ALGORITHM = "AES/ECB/PKCS5Padding";

and uses it for encryption/decryption of data:

private byte[] encryptAesPlainText(SecretKey secretKey, String plainText) throws GeneralSecurityException, IOException {
Cipher cipher = Cipher.getInstance(Constants.AES_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
return encryptCipherText(cipher, plainText);
}

encryptAesPlainText is used through setCipherText and setSecureKey to encrypt the data provided in the react native code. Therefore from my perspective it seems like all data saved on Android using this library is encrypted using AES/ECB/PKCS5Padding.

As pointed out in several CVEs "The use of the ECB operation mode can put the confidentiality of specific information at risk, even in an encrypted form."

Expected behavior

According to the README AES-CFB is used but I don't see any AES-CFB usage in the Android implementation.

The library supports full encryption (AES CFB-128) on Android and iOS. You can choose to store your encryption key securely for continuious usage. The library uses Keychain on iOS and Android Keystore on android (API 23 and above). Encrypting an instance is simple:

Platform Information:

  • OS: Android
  • Library Version latest (GIT master branch)

Note: Implementations for other platforms have not been checked for ECB usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant