Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Hack strcmp

Name: Anonymous 2012-04-11 8:47

i need to hack a strcmp to go in the if and pass a command in the system. The program is a server when i lunch the server i lunch a client normaly with a command using "handlerBuyIngredient" i can pass a line like ";reboot" with it and being use by the system under the if but i don't know how to hack the if with the strcmp cause i cn't overflow the strcmp.

normaly with the system i can send some comand to other person who are conected with the same port to the server.

static int
handlerBuyIngredient(void *packetPtr, size_t packetSize)
{
  int                   i;
  char                  *ingredientName;
  int                   amount;
  char                  log[128];
  char                  *password = NULL;

  password = getStr(&packetPtr, &packetSize);
  if (checkPassword(password) == ADMIN) {
    ingredientName = getStr(&packetPtr, &packetSize);
    amount = getNumber(&packetPtr, &packetSize);for (i = 0; stock[i].name != NULL; ++i) {
      if (!strcmp(ingredientName, stock[i].name)) {
        puts("PASS");
        money -= 2 * amount;
    stock[i].quantity += amount;
        sendLogMessage(INGREDIENT_BOUGHT);
        sprintf(log, "echo \"%s was bought\" >> log", ingredientName);
        free(ingredientName);
        system(log);
        return amount;
      }
    }
    sendLogMessage(UNKNOWN_INGREDIENT);
  }
  return -1;
}

Name: Anonymous 2012-04-11 10:03

I can't see a way. I though of inserting a '\0' in the middle but then the rest wouldn't be copied. What about adding elements to stock[]?

Name: Anonymous 2012-04-11 10:08

You lunch a client? How did it taste?

Name: Anonymous 2012-04-11 10:34

i cant add a '\0' because the 'ingredientName' is passed from a command line and i cant add any element to stock[] because i dont have access to the server.
what im looking to do is bypass the strcmp in this function so i can send any command to the function "system".

Name: Anonymous 2012-04-11 10:53

>>4
Guess you're fucked then bra

Name: Anonymous 2012-04-11 10:58

javascript:quote(5,"post1334148422");>>5
thank's

do you thnink, if their is something to overflow in the program i can access to this "system" ?

Name: Anonymous 2012-04-11 11:48

Your brain had obviously had a tremendous overflow

Name: Anonymous 2012-04-11 13:48

>>7

help so ?

Name: bampu pantsu 2012-05-29 4:19

bampu pantsu

Don't change these.
Name: Email:
Entire Thread Thread List