alpine 3.6
access weakness #433


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.


    /* Extract the privkey */
    ppc->privkey = gcry_sexp_find_token(key, "private-key", 0);

    return gcry_error(GPG_ERR_NO_ERROR);

static FILE* privkey_fopen(const char *filename, gcry_error_t *errp)
    FILE *privf;
#ifndef WIN32
    mode_t oldmask;

#ifndef WIN32
    oldmask = umask(077);
    privf = fopen(filename, "w+b");
    if (!privf && errp) {
	*errp = gcry_error_from_errno(errno);
#ifndef WIN32
    return privf;

/* Call this from the main thread only, in the event that the background
 * thread generating the key is cancelled.  The newkey is deallocated,
 * and must not be used further. */
void otrl_privkey_generate_cancelled(OtrlUserState us, void *newkey)
    struct s_pending_privkey_calc *ppc =
	    (struct s_pending_privkey_calc *)newkey;

    if (us) {
	pending_forget(pending_find(us, ppc->accountname, ppc->protocol));

    /* Deallocate ppc */

/* Call this from the main thread only.  It will write the newly created
 * private key into the given file and store it in the OtrlUserState. */ 

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.