alpine 3.6
tmpfile weakness #55

4

Weakness Breakdown


Definition:

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:

openssl/src/openssl-1.0.2r/crypto/threads/mttest.c

Context:

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

     BIO_printf(bio_stdout, "solaris threads done (%d,%d)\n",
               s_ctx->references, c_ctx->references);
#else
    BIO_printf(bio_stdout, "solaris threads done\n");
#endif
}

void solaris_thread_id(CRYPTO_THREADID *tid)
{
    CRYPTO_THREADID_set_numeric((unsigned long)thr_self());
}
#endif                          /* SOLARIS */

#ifdef IRIX

static usptr_t *arena;
static usema_t **lock_cs;

void thread_setup(void)
{
    int i;
    char filename[20];

    strcpy(filename, "/tmp/mttest.XXXXXX");
    mktemp(filename);

    usconfig(CONF_STHREADIOOFF);
    usconfig(CONF_STHREADMALLOCOFF);
    usconfig(CONF_INITUSERS, 100);
    usconfig(CONF_LOCKTYPE, US_DEBUGPLUS);
    arena = usinit(filename);
    unlink(filename);

    lock_cs = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(usema_t *));
    for (i = 0; i < CRYPTO_num_locks(); i++) {
        lock_cs[i] = usnewsema(arena, 1);
    }

    CRYPTO_set_id_callback(irix_thread_id);
    CRYPTO_set_locking_callback(irix_locking_callback);
}

void thread_cleanup(void)
{
    int i;

    CRYPTO_set_locking_callback(NULL);
    for (i = 0; i < CRYPTO_num_locks(); i++) {
        char buf[10];
 

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.