alpine 3.6
access weakness #100


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.

    return dbapi_err(dbi->dbi_rpmdb, msg, error, printit);

static void errlog(const DB_ENV * env, const char *errpfx, const char *msg)
    rpmlog(RPMLOG_ERR, "%s: %s\n", errpfx, msg);

static uint32_t db_envflags(DB * db)
    DB_ENV * env = db->get_env(db);
    uint32_t eflags = 0;
    (void) env->get_open_flags(env, &eflags);
    return eflags;

 * Try to acquire db environment open/close serialization lock.
 * Return the open, locked fd on success, -1 on failure.
static int serialize_env(const char *dbhome)
    char *lock_path = rstrscat(NULL, dbhome, "/.dbenv.lock", NULL);
    mode_t oldmask = umask(022);
    int fd = open(lock_path, (O_RDWR|O_CREAT), 0644);

    if (fd >= 0) {
	int rc;
	struct flock info;
	memset(&info, 0, sizeof(info));
	info.l_type = F_WRLCK;
	info.l_whence = SEEK_SET;
	do {
	    rc = fcntl(fd, F_SETLKW, &info);
	} while (rc == -1 && errno == EINTR);
	if (rc == -1) {
	    fd = -1;

    return fd;

static int db_fini(rpmdb rdb, const char * dbhome)

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.