Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Exploit code

  • 30-11-2011 12:00am
    #1
    Registered Users Posts: 11


    Hi all,
    write down a call to the code below that will cause the magic string to be displayed.
    /* Read in a name but display the magic string only to the superuser */
      #include <stdio.h>
      #include <stdlib.h>
      #include <string.h>
      #include <unistd.h>
      #include <sys/types.h>
      char *magic = "This string confers special powers on its reader\n";
      int
      main(int argc, char *argv[])
      {
        char buffer[40];
        uid_t euid;
        if (argc != 2) {
          printf("Usage: %s your_name\n", argv[0]);
          exit(EXIT_FAILURE);
        }
        strncpy(buffer, "Nice to meet you ", sizeof (buffer));
        strcat(buffer, argv[1]);
        printf("%s\n", buffer);
        euid = geteuid();
        if (euid != 0) {
          printf("Sorry %s, you cannot access the magic string\n", argv[1]);
        } else {
          printf("%s\n", magic);
        }
        return (0);
      }
    
    you will use gdb and "perl" if you want to.
    THX ALL!I will appreciate your help!


Comments

  • Registered Users, Registered Users 2 Posts: 2,033 ✭✭✭Colonel Panic


    You first!


  • Registered Users Posts: 11 followme_1987


    You first!
    Sorry, I am a student aboard. As you know, it is really difficulity for me to study computing in English. I reallllllly don't know how to solve this problem.Please!


  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    Sorry, I am a student aboard. As you know, it is really difficulity for me to study computing in English. I reallllllly don't know how to solve this problem.Please!
    A lot of programmers don't speak english at all. Is it the question you can't interpret?

    Look into buffer overruns.


Advertisement