alpine 3.6
access weakness #507


Weakness Breakdown


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:



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

 #ifndef LOCK_EX
#define LOCK_EX 2
#ifndef LOCK_NB
#define LOCK_NB 4
#ifndef LOCK_UN
#define LOCK_UN 8

#define STAT(p, s)        stat(p, s)

mrb_file_s_umask(mrb_state *mrb, mrb_value klass)
#if defined(_WIN32) || defined(_WIN64)
  /* nothing to do on windows */
  return mrb_fixnum_value(0);

  mrb_int mask, omask;
  if (mrb_get_args(mrb, "|i", &mask) == 0) {
    omask = umask(0);
  } else {
    omask = umask(mask);
  return mrb_fixnum_value(omask);

static mrb_value
mrb_file_s_unlink(mrb_state *mrb, mrb_value obj)
  mrb_value *argv;
  mrb_value pathv;
  mrb_int argc, i;
  const char *path;

  mrb_get_args(mrb, "*", &argv, &argc);
  for (i = 0; i < argc; i++) {
    pathv = mrb_convert_type(mrb, argv[i], MRB_TT_STRING, "String", "to_str");
    path = mrb_string_value_cstr(mrb, &pathv);
    if (UNLINK(path) < 0) {
      mrb_sys_fail(mrb, path);
  return mrb_fixnum_value(argc);

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.