fedora 25
misc weakness #443

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:

gammu-1.38.4/gammu/misc.c

Context:

The highlighted line of code below is the trigger point of this particular Fedora 25 misc weakness.

 
void EnterSecurityCode(int argc UNUSED, char *argv[])
{
	GSM_SecurityCode Code;
	GSM_Error error;
	char message[200];
#ifdef HAVE_GETPASS
	char *pass;
#endif

	if (strcasecmp(argv[2],"PIN") == 0) {		Code.Type = SEC_Pin;
	} else if (strcasecmp(argv[2],"PUK") == 0) {	Code.Type = SEC_Puk;
	} else if (strcasecmp(argv[2],"PIN2") == 0) {	Code.Type = SEC_Pin2;
	} else if (strcasecmp(argv[2],"PUK2") == 0) {	Code.Type = SEC_Puk2;
	} else if (strcasecmp(argv[2],"PHONE") == 0) {	Code.Type = SEC_Phone;
	} else if (strcasecmp(argv[2],"NETWORK") == 0) {	Code.Type = SEC_Network;
	} else {
		printf_err("%s: %s\n", _("Invalid security code type"), argv[2]);
		Terminate(2);
	}

	if (strcmp(argv[3], "-") == 0) {
		sprintf(message, _("Enter %s code: "), argv[2]);
#ifdef HAVE_GETPASS
		pass = getpass(message);
		strcpy(Code.Code, pass);
#else
		/* Read code from stdin */
#ifdef HAVE_UNISTD_H
		if (isatty(fileno(stdin))) {
			printf("%s", message);
		}
#endif
		if (fscanf(stdin, "%15s", Code.Code) != 1) {
			printf_err("%s\n", _("No PIN code entered!"));
			Terminate(2);
		}
#endif
	} else {
		strcpy(Code.Code,argv[3]);
	}

	if (argc >= 5) {
		if (strcmp(argv[4], "-") == 0) {
			sprintf(message, _("Enter new PIN code: "));
#ifdef HAVE_GETPASS
			pass = getpass(message);
			strcpy(Code.Code, pass);
#else
			/* Read code from stdin */ 

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.