Bug 193469 - defective crypt() implementation affects www/apache24, possibly www/apache22
Summary: defective crypt() implementation affects www/apache24, possibly www/apache22
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-apache (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-08 20:15 UTC by papowell
Modified: 2015-07-14 21:54 UTC (History)
3 users (show)

See Also:
mva: maintainer-feedback? (apache)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description papowell 2014-09-08 20:15:04 UTC
Another port hit by the defective crypt() implementation for FreeBSD 9.3

See Apache documentation for authentication:

http://httpd.apache.org/docs/2.2/howto/auth.html
and http://httpd.apache.org/docs/2.4/howto/auth.html

See password formats for Apache 2.4
http://httpd.apache.org/docs/2.4/misc/password_encryptions.html

CRYPT

$ htpasswd -nbd myName myPassword
myName:rqXexS6ZhobKA 

And when run on FreeBSD 9.3:htpasswd -nbd myName myPassword
myName:$6$Xaxjf5o0$4qAdV/N7OKPGsqM3KuD7D4HkkneCsAz752VFuDfsoRCV15c2AV295cEtBss9X.zErMK0OLYLS2P7pOzpDGGXY1

Question: does Apache 2.4 recognize this format for encrypted passwords?
Server version: Apache/2.4.10 (FreeBSD)

I put this value into an htpasswd file and discovered that it did not.

From the Apache 2.4 documentation,  and the Apache 2.2 documentation is
almost identical:


There are five formats that Apache recognizes for basic-authentication passwords. Note that not all formats work on every platform:

bcrypt
    "$2y$" + the result of the crypt_blowfish algorithm. See the APR source file crypt_blowfish.c for the details of the algorithm.
MD5
    "$apr1$" + the result of an Apache-specific algorithm using an iterated (1,000 times) MD5 digest of various combinations of a random 32-bit salt and the password. See the APR source file apr_md5.c for the details of the algorithm.
SHA1
    "{SHA}" + Base64-encoded SHA-1 digest of the password. Insecure.
CRYPT
    Unix only. Uses the traditional Unix crypt(3) function with a randomly-generated 32-bit salt (only 12 bits used) and the first 8 characters of the password. Insecure.

So it appears that the $6$ is not documented as being valid and using it as an encrypted password value does not work.
Comment 1 Marcus von Appen freebsd_committer freebsd_triage 2014-09-27 08:18:24 UTC
Assign to apache maintainer group.
Comment 2 Olli Hauer freebsd_committer freebsd_triage 2014-09-30 21:31:59 UTC
I can confirm crypt will not work on 9.3, haven't had the time to test on upcoming 10.1.

At the moment I don't see an quick and easy way for an fix to support backward compatiblity,
Comment 3 Olli Hauer freebsd_committer freebsd_triage 2014-11-30 22:19:47 UTC
Hi Papowell,

it seems the crypt() regression was fixed recently by this errata
https://www.freebsd.org/security/advisories/FreeBSD-EN-14:11.crypt.asc

FreeBSD-10.1 contains the errata fix already.
Systems on 9.3/10.0 should run freebsd-update to get the fix.

Can you run the test on your site again with an up-to-date system?
Comment 4 Philip M. Gollucci freebsd_committer freebsd_triage 2015-07-14 21:54:26 UTC
submitter feedback timeout 309 days.

Also the ENs fix this on all supported versions.