You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by "Brian Demers (JIRA)" <ji...@apache.org> on 2016/06/24 00:20:16 UTC

[jira] [Updated] (SHIRO-547) Use MessageDigest#isEqual() instead of Arrays#equals() for comparing digests

     [ https://issues.apache.org/jira/browse/SHIRO-547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Demers updated SHIRO-547:
-------------------------------
    Labels: patch  (was: )

> Use MessageDigest#isEqual() instead of Arrays#equals() for comparing digests
> ----------------------------------------------------------------------------
>
>                 Key: SHIRO-547
>                 URL: https://issues.apache.org/jira/browse/SHIRO-547
>             Project: Shiro
>          Issue Type: Bug
>          Components: Authentication (log-in), Cryptography & Hashing
>    Affects Versions: 2.0.0, 1.2.4
>            Reporter: Andreas Kohn
>              Labels: patch
>         Attachments: shiro-547-messagedigest.diff
>
>
> While looking through shiro code I noticed that there are three places which compare byte[]s representing hashes using `Arrays#equals()`
> To avoid potential timing attacks these should be using `MessageDigest#isEqual()`, which at least starting with Java 6u17 uses a constant-time comparison.
> I'm not sure which Java version shiro targets, but it might make sense to either require Java 7, or to at least strongly suggest this in the documentation.
> Attached a patch against trunk, but please also consider fixing this in the 1.2 branch.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)