Skip to content

Timing attack possible on Phalcon\Security::checkHash() ? #1755

Closed
@moderndeveloperllc

Description

@moderndeveloperllc

While doing a userland class to allow the use of scrypt hashing in Phalcon, I came across lots of talk about theoretical timing attacks on hash/encyption checking functions. The issue comes about with C function memcmp() internally used by PHP. Basically, it returns on the first non-equal byte, which can provide timing info to allow iterative guessing of the string. Other vendors have added utility functions to do constant-time string comparison. I noticed that the checkHash() function uses the is_equal_function C function. I believe that this has the same issue, but I'm not totally sure. Perhaps something to think about for 2.0?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions