OpenSSH 7.3ããªãªã¼ã¹ããã¦ãCVE-2016-6210ãä¿®æ£ãããããã
http://www.openssh.com/txt/release-7.3sshd(8): Mitigate timing differences in password authentication
that could be used to discern valid from invalid account names
when long passwords were sent and particular password hashing
algorithms are in use on the server. CVE-2016-6210, reported by
EddieEzra.Harari at verint.com
ã©ãä¿®æ£ãããã®ããªã¨ãgitãªãã¸ããªãcloneãã¦ãã¦ã³ããããã°ãã¿ã¦ã¿ãã
$ git show 9286875a commit 9286875a73b2de7736b5e50692739d314cd8d9dc Author: Darren Tucker <[email protected]> Date: Fri Jul 15 13:32:45 2016 +1000 Determine appropriate salt for invalid users. When sshd is processing a non-PAM login for a non-existent user it uses the string from the fakepw structure as the salt for crypt(3)ing the password supplied by the client. That string has a Blowfish prefix, so on systems that don't understand that crypt will fail fast due to an invalid salt, and even on those that do it may have significantly different timing from the hash methods used for real accounts (eg sha512). This allows user enumeration by, eg, sending large password strings. This was noted by EddieEzra.Harari at verint.com (CVE-2016-6210). To mitigate, use the same hash algorithm that root uses for hashing passwords for users that do not exist on the system. ok djm@
ã·ã¹ãã ä¸ã®rootã使ã£ã¦ããããã·ã¥ã¢ã«ã´ãªãºã ã¨åããã®ãå©ç¨ããããã«ããã¨ããªãã»ã©ã
openbsd-compat/xcrypt.cã®pick_salté¢æ°ã§/etc/shadowã®rootã®ã¨ã³ããªãã$id$salt$ã®é¨åãåå¾ãã¦ããã
/* * Pick an appropriate password encryption type and salt for the running * system. */ static const char * pick_salt(void) { struct passwd *pw; char *passwd, *p; size_t typelen; static char salt[32]; if (salt[0] != '\0') return salt; strlcpy(salt, "xx", sizeof(salt)); if ((pw = getpwuid(0)) == NULL) return salt; passwd = shadow_pw(pw); if (passwd[0] != '$' || (p = strrchr(passwd + 1, '$')) == NULL) return salt; /* no $, DES */ typelen = p - passwd + 1; strlcpy(salt, passwd, MIN(typelen, sizeof(salt))); explicit_bzero(passwd, strlen(passwd)); return salt; }
ãã ãææ°çã®openbsd-compat/xcrypt.cãè¦ãã¨rootããã¹ã¯ã¼ãæã£ã¦ããã¨ã¯éããªãã®ã§ãåãã¦è¦ã¤ããDES以å¤ã®ã¨ã³ããªã®$id$salt$ãè¿ãããã«ãªã£ã¦ããã
/* * Pick an appropriate password encryption type and salt for the running * system by searching through accounts until we find one that has a valid * salt. Usually this will be root unless the root account is locked out. * If we don't find one we return a traditional DES-based salt. */ static const char * pick_salt(void) { struct passwd *pw; char *passwd, *p; size_t typelen; static char salt[32]; if (salt[0] != '\0') return salt; strlcpy(salt, "xx", sizeof(salt)); setpwent(); while ((pw = getpwent()) != NULL) { passwd = shadow_pw(pw); if (passwd[0] == '$' && (p = strrchr(passwd+1, '$')) != NULL) { typelen = p - passwd + 1; strlcpy(salt, passwd, MIN(typelen, sizeof(salt))); explicit_bzero(passwd, strlen(passwd)); goto out; } } out: endpwent(); return salt; }