alpine 3.6
access weakness #124

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:

vsftpd/src/vsftpd-3.0.3/sysutil.c

Context:

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

     die("initgroups");
  }
}

void
vsf_sysutil_chroot(const char* p_root_path)
{
  int retval = chroot(p_root_path);
  if (retval != 0)
  {
    die("chroot");
  }
}

unsigned int
vsf_sysutil_get_umask(void)
{
  return s_current_umask;
}

void
vsf_sysutil_set_umask(unsigned int new_umask)
{
  s_current_umask = (new_umask & 0777);
  (void) umask(s_current_umask);
}

void
vsf_sysutil_make_session_leader(void)
{
  /* This makes us the leader if we are not already */
  (void) setsid();
  /* Check we're the leader */
  if ((int) vsf_sysutil_getpid() != getpgrp())
  {
    die("not session leader");
  }
}

void
vsf_sysutil_reopen_standard_fds(void)
{
  /* This reopens STDIN, STDOUT and STDERR to /dev/null */
  int fd;
  if ((fd = open("/dev/null", O_RDWR, 0)) < 0)
  {
    goto error;
  }
  vsf_sysutil_dupfd2(fd, STDIN_FILENO);
  vsf_sysutil_dupfd2(fd, STDOUT_FILENO); 

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.