Impact
String comparison method in multiple authentication validation in Armeria were known to be vulnerable to timing attacks. This vulnerability is caused by the insecure implementation of equals
method from java.lang.String
. While this attack is not practically possible, an attacker still has a potential to attack if the victim's server validates user by using equals
method.
We would like to thank @chrsow for pointing out the issue.
Potentially vulnerable codes
|
return accessToken.equals(that.accessToken); |
|
return username.equals(that.username()) && password.equals(that.password()); |
Patches
There are two options to patch this issue.
-
Remove equals
method; it has been exclusively used for test cases and was never used in any OSS projects that are using Armeria. (But it is worth noting that there are possibilities of closed projects authenticating users by utilizing equals
method)
-
Use MessageDigest.isEqual
to compare the credential instead.
Workarounds
- Update to the latest version (TBD)
2-1. Users can prevent these vulnerabilities by modifying and implementing timing attack preventions by themselves.
2-2. Precisely speaking, it is possible to compare credentials by securely comparing them after calling methods to directly return the input (namely Object. accessToken()
, Object.username()
and Object.password()
).
References
Side Note
Since it is a theoretical attack, there is no PoC available from neither the vendor nor the security team.
Impact
String comparison method in multiple authentication validation in Armeria were known to be vulnerable to timing attacks. This vulnerability is caused by the insecure implementation of
equals
method fromjava.lang.String
. While this attack is not practically possible, an attacker still has a potential to attack if the victim's server validates user by usingequals
method.We would like to thank @chrsow for pointing out the issue.
Potentially vulnerable codes
armeria/core/src/main/java/com/linecorp/armeria/server/auth/OAuth2Token.java
Line 54 in f0d870f
armeria/core/src/main/java/com/linecorp/armeria/server/auth/BasicToken.java
Line 64 in f0d870f
Patches
There are two options to patch this issue.
Remove
equals
method; it has been exclusively used for test cases and was never used in any OSS projects that are using Armeria. (But it is worth noting that there are possibilities of closed projects authenticating users by utilizingequals
method)Use
MessageDigest.isEqual
to compare the credential instead.Workarounds
2-1. Users can prevent these vulnerabilities by modifying and implementing timing attack preventions by themselves.
2-2. Precisely speaking, it is possible to compare credentials by securely comparing them after calling methods to directly return the input (namely
Object. accessToken()
,Object.username()
andObject.password()
).References
Side Note
Since it is a theoretical attack, there is no PoC available from neither the vendor nor the security team.