alpine 3.6
format weakness #77

4

Weakness Breakdown


Definition:

A format string exploit occurs when the data of an input string is evaluated as a command by the program. This class of attacks is very similar to buffer overflows since an attacker could execute code, read the stack or cause new behaviors that compromise security. Learn more about format string attacks on OWASP attack index.

Warning code(s):

If format strings can be influenced by an attacker, they can be exploited.

File Name:

heirloom-mailx/src/mailx-12.4/sendout.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.6 format weakness.

 					&& (value("askcc") != NULL ||
					value("askbcc") != NULL)) ||
				value("askattach") != NULL ||
				value("asksign") != NULL) {
			if (value("askcc") != NULL)
				grabh(hp, GCC, 1);
			if (value("askbcc") != NULL)
				grabh(hp, GBCC, 1);
			if (value("askattach") != NULL)
				hp->h_attach = edit_attachments(hp->h_attach);
			if (value("asksign") != NULL)
				dosign = yorn("Sign this message (y/n)? ");
		} else {
			printf(catgets(catd, CATSET, 183, "EOT\n"));
			fflush(stdout);
		}
	}
	if (fsize(mtf) == 0) {
		if (Eflag)
			goto out;
		if (hp->h_subject == NULL)
			printf(catgets(catd, CATSET, 184,
				"No message, no subject; hope that's ok\n"));
		else if (value("bsdcompat") || value("bsdmsgs"))
			printf(catgets(catd, CATSET, 185,
				"Null message body; hope that's ok\n"));
	}
	if (dosign < 0) {
		if (value("smime-sign") != NULL)
			dosign = 1;
		else
			dosign = 0;
	}
	/*
	 * Now, take the user names from the combined
	 * to and cc lists and do all the alias
	 * processing.
	 */
	senderr = 0;
	if ((to = usermap(cat(hp->h_bcc, cat(hp->h_to, hp->h_cc)))) == NULL) {
		printf(catgets(catd, CATSET, 186, "No recipients specified\n"));
		senderr++;
	}
	to = fixhead(hp, to);
	if (hp->h_charset) {
		wantcharset = hp->h_charset;
		goto try;
	}
hloop:	wantcharset = NULL;
	if ((charsets = value("sendcharsets")) != NULL) { 

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.