centos 6
misc weakness #40

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:

libesmtp-1.0.4/examples/mail-file.c

Context:

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

 
 fputs (writing ? "C: " : "S: ", fp);
 fwrite (buf, 1, buflen, fp);
 if (buf[buflen - 1] != '\n')
   putc ('\n', fp);
}

/* Callback to request user/password info.  Not thread safe. */
int
authinteract (auth_client_request_t request, char **result, int fields,
              void *arg unused)
{
  char prompt[64];
  static char resp[512];
  char *p, *rp;
  int i, n, tty;

  rp = resp;
  for (i = 0; i < fields; i++)
    {
      n = snprintf (prompt, sizeof prompt, "%s%s: ", request[i].prompt,
		    (request[i].flags & AUTH_CLEARTEXT) ? " (not encrypted)"
		    					: "");
      if (request[i].flags & AUTH_PASS)
	result[i] = getpass (prompt);
      else
	{
	  tty = open ("/dev/tty", O_RDWR);
	  write (tty, prompt, n);
	  n = read (tty, rp, sizeof resp - (rp - resp));
	  close (tty);
	  p = rp + n;
	  while (isspace (p[-1]))
	    p--;
	  *p++ = '\0';
	  result[i] = rp;
	  rp = p;
	}
    }
  return 1;
}

int
tlsinteract (char *buf, int buflen, int rwflag unused, void *arg unused)
{
  char *pw;
  int len;

  pw = getpass ("certificate password");
  len = strlen (pw); 

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.