centos 6
misc weakness #38

4

Weakness Breakdown


Definition:

The software specifies permissions for a security-critical resource in a way that allows the resource to be read or modified by unintended actors.

Warning code(s):

This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data.

File Name:

shadow-4.1.5.1/src/passwd.c

Context:

The highlighted line of code below is the trigger point of this particular Centos 6 misc weakness.

 			return -1;
		}
		if (warned && (strcmp (pass, cp) != 0)) {
			warned = false;
		}
		STRFCPY (pass, cp);
		strzero (cp);

		if (!amroot && (!obscure (orig, pass, pw) || reuse (pass, pw))) {
			(void) puts (_("Try again."));
			continue;
		}

		/*
		 * If enabled, warn about weak passwords even if you are
		 * root (enter this password again to use it anyway). 
		 * --marekm
		 */
		if (amroot && !warned && getdef_bool ("PASS_ALWAYS_WARN")
		    && (!obscure (orig, pass, pw) || reuse (pass, pw))) {
			(void) puts (_("\nWarning: weak password (enter it again to use it anyway)."));
			warned = true;
			continue;
		}
		cp = getpass (_("Re-enter new password: "));
		if (NULL == cp) {
			memzero (orig, sizeof orig);
			return -1;
		}
		if (strcmp (cp, pass) != 0) {
			(void) fputs (_("They don't match; try again.\n"), stderr);
		} else {
			strzero (cp);
			break;
		}
	}
	memzero (orig, sizeof orig);

	if (i == 0) {
		memzero (pass, sizeof pass);
		return -1;
	}

	/*
	 * Encrypt the password, then wipe the cleartext password.
	 */
	cp = pw_encrypt (pass, crypt_make_salt (NULL, NULL));
	if (cp == NULL) {
		perror ("crypt");
		exit (EXIT_FAILURE); 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.