[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <54193208.70602@riseup.net>
Date: Wed, 17 Sep 2014 09:02:32 +0200
From: beloumi <beloumi@...eup.net>
To: fulldisclosure@...lists.org
Subject: Re: [FD] Laravel 2.1 Hash::make() bcrypt truncation
Am 16.09.2014 12:03, schrieb Pichaya Morimoto:
> ######################################################################
> # _ ___ _ _ ____ ____ _ _____
> # | | / _ \| \ | |/ ___|/ ___| / \|_ _|
> # | | | | | | \| | | _| | / _ \ | |
> # | |__| |_| | |\ | |_| | |___ / ___ \| |
> # |_____\___/|_| \_|\____|\____/_/ \_\_|
> #
> # Laravel 2.1 Hash::make() bcrypt truncation
> # Website : http://laravel.com/
> # Author : @u0x (Pichaya Morimoto)
> # Release dates : September 16, 2014
> #
> # Special Thanks to 2600 Thailand group
> # https://www.facebook.com/groups/2600Thailand/ , http://2600.in.th/
> #
> ########################################################################
>
> [+] Laravel
> ============================================================
> Laravel is a free, open source PHP web application framework, designed for
> the development of model–view–controller (MVC) web applications. According
> to a December 2013 developers survey on PHP frameworks popularity, Laravel
> is listed as the most popular PHP framework in 2013. At the same time, as
> of August 2014 Laravel is the most popular and watched PHP project on
> GitHub.
> https://en.wikipedia.org/wiki/Laravel
>
> [+] Description
> ============================================================
> By using Laravel Security mechanism,
> http://laravel.com/docs/security#storing-passwords
> The passwords will be hashed using Laravel's Hash::make() function.
> This function internally call PHP 's password_hash() without checking the
> length.
>
> Why do we need to check length? as PHP manual said,
> "Using the PASSWORD_BCRYPT for the algo parameter,
> will result in the password parameter being truncated
> to a maximum length of 72 characters."
> http://php.net/manual/en/function.password-hash.php
>
> The problem occurs if users enter password longer than 72 characters
> then the password will be truncated to be 72 characters.
>
> This will result in pseudo hash collision.
This problem might depend on the password hashing scheme Bcrypt which
allows only password up to 55 Byte.
The authors of Bcrypt probably thought that longer passwords are not
present.
So, this might mainly be a problem of the chosen key derivation
function, not of Laravels code.
>
> [+] How to fix this?
> ============================================================
> In Django project, they solved this problem by applying SHA256 before using
> bcrypt
> "BCryptSHA256PasswordHasher fixes this by first hashing the password using
> sha256.
> This prevents the password truncation"
> https://docs.djangoproject.com/en/dev/topics/auth/passwords/#using-bcrypt-with-django
>
Anyway, this is a good solution.
_______________________________________________
Sent through the Full Disclosure mailing list
http://nmap.org/mailman/listinfo/fulldisclosure
Web Archives & RSS: http://seclists.org/fulldisclosure/
Powered by blists - more mailing lists