From nobody@FreeBSD.org  Wed Feb 27 13:52:28 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1D9A91065672
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 27 Feb 2008 13:52:28 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 151FF8FC1F
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 27 Feb 2008 13:52:28 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m1RDnVJe065000
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 27 Feb 2008 13:49:31 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m1RDnV0e064999;
	Wed, 27 Feb 2008 13:49:31 GMT
	(envelope-from nobody)
Message-Id: <200802271349.m1RDnV0e064999@www.freebsd.org>
Date: Wed, 27 Feb 2008 13:49:31 GMT
From: Erwin Peter <erwinpeterarcor.de@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Adduser produces defective blowfish cipher password hashes on FreeBSD 7.0-RC3 amd64 and i386
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         121146
>Category:       bin
>Synopsis:       [patch] adduser(8) produces defective blowfish cipher password hashes on FreeBSD 7.0-RC3 amd64 and i386
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    antoine
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 27 14:00:03 UTC 2008
>Closed-Date:    Mon Jul 28 20:15:10 UTC 2008
>Last-Modified:  Mon Jul 28 20:15:10 UTC 2008
>Originator:     Erwin Peter
>Release:        FreeBSD 7.0-RC3 amd64
>Organization:
>Environment:
FreeBSD erwin.example.net 7.0-RC3 FreeBSD 7.0-RC3 #0: Wed Feb 20 15:41:33 UTC 2008     root@driscoll.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
Blowfish cipher password hashes look strange after creating users with adduser on FreeBSD 7.0-RC3 amd64 and i386:

user0:$2a$04$xYpywjtq..............p1dnhRzopxTA03kej/n.6zzH1IPnFnq:1001:1001::0:0:User &:/home/user0:/bin/sh
user1:$2a$04$x8Oz2mIk..............ic9QqpzeeBC/8UkJkon5pW5N5TfwDAG:1002:1002::0:0:User &:/home/user1:/bin/sh
user2:$2a$04$lmDQpxT6..............iNc5meFZZnmw7byA8rt2ouR9wHoXmua:1003:1003::0:0:User &:/home/user2:/bin/sh
user3:$2a$04$c.RmkxcN..............oy3vTt.DSXmmn4.0FmpAjXdWJ1Q/AOq:1004:1004::0:0:User &:/home/user3:/bin/sh
user4:$2a$04$wuch.t4M..............oyvIaigqtR9kp0q1M9I.y3fYHxtqHRm:1005:1005::0:0:User &:/home/user4:/bin/sh


You can fix it by using passwd to reset the passwords:

user0:$2a$04$3FigWO7CgDRWakxDPQ50leHU6739Qj3e62mymnSfKNDq8qs0B8fAi:1001:1001::0:0:User &:/home/user0:/bin/sh
user1:$2a$04$5ngJCj0kptu4Lm.i3o4d9OJpLQH6yY4TFtWwVBxTdnaTHaN0nqTm6:1002:1002::0:0:User &:/home/user1:/bin/sh
user2:$2a$04$tkQwdseohOkb83U2XJnmk.r6ghthOrPB9i4VByq8w49mpUbNsvyPq:1003:1003::0:0:User &:/home/user2:/bin/sh
user3:$2a$04$Lq5HoOpnsfSpiocSIQqdrOi2XkzXWRcBQ3grTXzEES0Mx2tP8IBAa:1004:1004::0:0:User &:/home/user3:/bin/sh
user4:$2a$04$x03.j9m1V/fP2biVVQzFJOjUYvobXaAbqAESdE6N6Y8vz6GyVwHuK:1005:1005::0:0:User &:/home/user4:/bin/sh
>How-To-Repeat:
1. change default-profile's passwd_format to blf in /etc/login.conf
2. cap_mkdb /etc/login.conf
3. change crypt_default to blf in /etc/auth.conf
4. add users with adduser
>Fix:
Reset passwords with passwd.

>Release-Note:
>Audit-Trail:

From: Jaakko Heinonen <jh@saunalahti.fi>
To: bug-followup@FreeBSD.org, erwinpeterarcor.de@FreeBSD.org
Cc:  
Subject: Re: bin/121146: Adduser produces defective blowfish cipher
	password hashes on FreeBSD 7.0-RC3 amd64 and i386
Date: Wed, 27 Feb 2008 20:01:56 +0200

 --2fHTh5uZTiUOsy+g
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 
 Increasing the salt size for pw(8) might fix the problem. See the
 attached patch.
 
 -- 
 Jaakko
 
 --2fHTh5uZTiUOsy+g
 Content-Type: text/x-diff; charset=us-ascii
 Content-Disposition: attachment; filename="pw-salt-size.diff"
 
 Index: pw_user.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.sbin/pw/pw_user.c,v
 retrieving revision 1.61
 diff -p -u -r1.61 pw_user.c
 --- pw_user.c	30 Mar 2007 12:57:25 -0000	1.61
 +++ pw_user.c	27 Feb 2008 17:51:56 -0000
 @@ -1029,22 +1029,24 @@ pw_shellpolicy(struct userconf * cnf, st
  	return shell_path(cnf->shelldir, cnf->shells, sh ? sh : cnf->shell_default);
  }
  
 +#define SALTSIZE	32
 +
  static char const chars[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.";
  
  char           *
  pw_pwcrypt(char *password)
  {
  	int             i;
 -	char            salt[12];
 +	char            salt[SALTSIZE + 1];
  
  	static char     buf[256];
  
  	/*
  	 * Calculate a salt value
  	 */
 -	for (i = 0; i < 8; i++)
 +	for (i = 0; i < SALTSIZE; i++)
  		salt[i] = chars[arc4random() % 63];
 -	salt[i] = '\0';
 +	salt[SALTSIZE] = '\0';
  
  	return strcpy(buf, crypt(password, salt));
  }
 
 --2fHTh5uZTiUOsy+g--
State-Changed-From-To: open->feedback 
State-Changed-By: gavin 
State-Changed-When: Sun Mar 2 19:08:55 UTC 2008 
State-Changed-Why:  
To submitter: does the patch in the PR fix the issue for you? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121146 
State-Changed-From-To: feedback->suspended 
State-Changed-By: vwe 
State-Changed-When: Sat May 17 20:26:33 UTC 2008 
State-Changed-Why:  

I'm pretty sure the submitters' email address is invalid so 
we can't expect any feedback. 
Erwin: If you see this message, please provide a valid and working 
email address. 
suspend this until someone will check this issue. 


Responsible-Changed-From-To: freebsd-bugs->vwe 
Responsible-Changed-By: vwe 
Responsible-Changed-When: Sat May 17 20:26:33 UTC 2008 
Responsible-Changed-Why:  

track 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121146 
State-Changed-From-To: suspended->open 
State-Changed-By: antoine 
State-Changed-When: Sat May 17 22:14:39 UTC 2008 
State-Changed-Why:  
Take this. 


Responsible-Changed-From-To: vwe->antoine 
Responsible-Changed-By: antoine 
Responsible-Changed-When: Sat May 17 22:14:39 UTC 2008 
Responsible-Changed-Why:  
Take this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121146 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/121146: commit references a PR
Date: Tue, 27 May 2008 19:04:36 +0000 (UTC)

 antoine     2008-05-27 19:04:31 UTC
 
   FreeBSD src repository
 
   Modified files:
     usr.sbin/pw          pw_user.c 
   Log:
   - Increase the size of the salt in pw(8) from 8 to 32 (same as in pam_unix(8)).
    This makes blowfish password hashes look normal when set using
   pw(8)/adduser(8). [1]
   - Make it possible to have a '/' in the salt.
   
   PR:             121146 [1]
   Submitted by:   Jaakko Heinonen [1]
   Approved by:    rwatson (mentor)
   MFC after:      1 month
   
   Revision  Changes    Path
   1.62      +7 -5      src/usr.sbin/pw/pw_user.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: antoine 
State-Changed-When: Tue May 27 19:12:04 UTC 2008 
State-Changed-Why:  
Patched in HEAD. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121146 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/121146: commit references a PR
Date: Mon, 28 Jul 2008 20:05:18 +0000 (UTC)

 antoine     2008-07-28 20:04:39 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_7)
     usr.sbin/pw          pw_user.c 
   Log:
   SVN rev 180935 on 2008-07-28 20:04:39Z by antoine
   
   MFC r179365 to stable/7:
     - Increase the size of the salt in pw(8) from 8 to 32 (same as in pam_unix(8)).
      This makes blowfish password hashes look normal when set using
     pw(8)/adduser(8). [1]
     - Make it possible to have a '/' in the salt.
   
     PR:             121146 [1]
     Submitted by:   Jaakko Heinonen [1]
     Approved by:    rwatson (mentor)
     MFC after:      1 month
   
   Revision  Changes    Path
   1.61.2.1  +7 -5      src/usr.sbin/pw/pw_user.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/121146: commit references a PR
Date: Mon, 28 Jul 2008 20:08:31 +0000 (UTC)

 antoine     2008-07-28 20:08:08 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     usr.sbin/pw          pw_user.c 
   Log:
   SVN rev 180936 on 2008-07-28 20:08:08Z by antoine
   
   MFC r179365 to stable/6:
     - Increase the size of the salt in pw(8) from 8 to 32 (same as in pam_unix(8)).
      This makes blowfish password hashes look normal when set using
     pw(8)/adduser(8). [1]
     - Make it possible to have a '/' in the salt.
   
     PR:             121146 [1]
     Submitted by:   Jaakko Heinonen [1]
     Approved by:    rwatson (mentor)
     MFC after:      1 month
   
   Revision  Changes    Path
   1.57.8.4  +7 -5      src/usr.sbin/pw/pw_user.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: antoine 
State-Changed-When: Mon Jul 28 20:14:29 UTC 2008 
State-Changed-Why:  
Close: fix committed in head, releng_6 and releng_7. 
Thanks for the report! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121146 
>Unformatted:
