alpine 3.8
tmpfile weakness #45


Weakness Breakdown


A temporary file weakness occurs when a temporary file that is created and used by a high-privilege process is accidentally shared with a low-privilege process, on account of it being temporary and generated after all security controls have been applied. This allows the low-privilege process to read data from the high-privilege process (information leakage), or worse, influence the high-privilege process by modifying the shared temporary file.

Warning code(s):

Temporary file race condition.

File Name:



The highlighted line of code below is the trigger point of this particular Alpine 3.8 tmpfile weakness.

 /* In pre-5.7-Perls the PERL_MAGIC_uvar magic didn't get the thread context.
 * XS code wanting to be backward compatible can do something
 * like the following:

#define PERL_MG_UFUNC(name,ix,sv) I32 name(IV ix, SV *sv)

static PERL_MG_UFUNC(foo_get, index, val)
    sv_setsv(val, ...);
    return TRUE;

-- Doug MacEachern


#define PERL_MG_UFUNC(name,ix,sv) I32 name(pTHX_ IV ix, SV *sv)

/* Fix these up for __STDC__ */
char *mktemp (char*);
#ifndef atof
double atof (const char*);

#ifndef STANDARD_C
/* All of these are in stdlib.h or time.h for ANSI C */
Time_t time();
struct tm *gmtime(), *localtime();
#if defined(OEMVS)
char *(strchr)(), *(strrchr)();
char *(strcpy)(), *(strcat)();
char *strchr(), *strrchr();
char *strcpy(), *strcat();
#endif /* ! STANDARD_C */

#ifdef I_MATH
#    include <math.h>
#    ifdef __VMS
     /* isfinite and others are here rather than in math.h as C99 stipulates */
#        include <fp.h>
#    endif 

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.