alpine 3.6
access weakness #80

1

Weakness Breakdown


Definition:

An access weakness occurs when software does not properly implement permissions that could have unintended consequences if exploited by malicious actors. An example of this weakness is when a default username and password are set by the developer but do not get changed by the system administrator.

Warning code(s):

Ensure that umask is given most restrictive possible setting.

File Name:

libetpan/src/libetpan-1.7.2/src/engine/mailprivacy_tools.c

Context:

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

         cur != NULL ; cur = clist_next(cur)) {
      struct mailmime * submime;
      
      submime = clist_content(cur);
      
      mailprivacy_mime_clear(submime);
    }
    break;
    
  case MAILMIME_MESSAGE:
    if (mime->mm_data.mm_message.mm_msg_mime != NULL) {
      mailprivacy_mime_clear(mime->mm_data.mm_message.mm_msg_mime);
    }
    break;
  }
}


static FILE * get_tmp_file(char * filename)
{
  int fd;
  mode_t old_mask;
  FILE * f;
  
  old_mask = umask(0077);
  fd = mkstemp(filename);
  umask(old_mask);
  if (fd == -1)
    return NULL;
  
  f = fdopen(fd, "r+");
  if (f == NULL) {
    close(fd);
    unlink(filename);
  }
  
  return f;
}

FILE * mailprivacy_get_tmp_file(struct mailprivacy * privacy,
    char * filename, size_t size)
{
  snprintf(filename, size, "%s/libetpan-privacy-XXXXXX", privacy->tmp_dir);
  return get_tmp_file(filename);
}

int mailprivacy_get_tmp_filename(struct mailprivacy * privacy,
    char * filename, size_t size)
{
  FILE * f; 

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.