alpine 3.6
shell weakness #74

4

Weakness Breakdown


Definition:

A shell weakness occurs when a program enables an attacker to execute unexpected commands on the operating system.

Warning code(s):

This causes a new program to execute and is difficult to use safely.

File Name:

libxkbcommon/src/libxkbcommon-0.6.1/test/interactive-evdev.c

Context:

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

         locale = setlocale(LC_CTYPE, NULL);
        compose_table =
            xkb_compose_table_new_from_locale(ctx, locale,
                                              XKB_COMPOSE_COMPILE_NO_FLAGS);
        if (!compose_table) {
            ret = -1;
            fprintf(stderr, "Couldn't create compose from locale\n");
            goto err_xkb;
        }
    }

    kbds = get_keyboards(keymap, compose_table);
    if (!kbds) {
        ret = -1;
        goto err_compose;
    }

    act.sa_handler = sigintr_handler;
    sigemptyset(&act.sa_mask);
    act.sa_flags = 0;
    sigaction(SIGINT, &act, NULL);
    sigaction(SIGTERM, &act, NULL);

    /* Instead of fiddling with termios.. */
    (void) system("stty -echo");

    ret = loop(kbds);
    if (ret)
        goto err_stty;

err_stty:
    (void) system("stty echo");
    free_keyboards(kbds);
err_compose:
    xkb_compose_table_unref(compose_table);
err_xkb:
    xkb_keymap_unref(keymap);
err_ctx:
    xkb_context_unref(ctx);
err_out:
    exit(ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
} 

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.