salt w crypt z glibc 2.17

Rafał Janiczek rafal.janiczek at gmail.com
Wed Jun 5 19:52:06 CEST 2013


> test:a$4z6BEzCXx2c
>
> lighttpd-1.4.32-1.x86_64
> glibc-2.17-3.x86_64
>
>
Ok, już wiem o co chodzi:
http://upstream-tracker.org/changelogs/glibc/2.17/changelog.html

* The `crypt' function now fails if passed salt bytes that violate the
  specification for those values.

A w lighttpd-1.4.32/src/http_auth.c:

       crypted = crypt(pw, salt);

                if (0 == strcmp(password->ptr, crypted)) {
                        return 0;
                }

Z czym, że strcmp słabo sobie z NULLem radzi, chyba tam trzeba dorzucić coś
ala:
--- http_auth.c.orig    2013-06-05 19:50:15.559871864 +0200
+++ http_auth.c 2013-06-05 19:50:44.828016997 +0200
@@ -689,6 +689,10 @@

                crypted = crypt(pw, salt);

+               if (NULL == crypted) {
+                       return -1;
+               }
+
                if (0 == strcmp(password->ptr, crypted)) {
                        return 0;
                }

Bo inaczej każdy user, który ma dostęp do dowolnego pliku htpasswd może
wysypać serwer www.

-- 
Rafał Janiczek


More information about the pld-devel-pl mailing list