Pwnable/Protostar

[Protostar] Stack Two

RootJJang 2022. 5. 14. 00:30
SMALL

코드 소스 확인!!

#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>

int main(int argc, char **argv)
{
  volatile int modified;
  char buffer[64];
  char *variable;

  variable = getenv("GREENIE");

  if(variable == NULL) {
      errx(1, "please set the GREENIE environment variable\n");
  }

  modified = 0;

  strcpy(buffer, variable);

  if(modified == 0x0d0a0d0a) {
      printf("you have correctly modified the variable\n");
  } else {
      printf("Try again, you got 0x%08x\n", modified);
  }

}

GREENIE라는 환경변수에 페이로드를 넣어야 하네요

 

저번 문제와 거리는 같을 테니 dummy값을 64를 채워주고 0x0d0a0d0a를 리틀 엔디언으로 적어줍니다

 

그렇다면 환경변수를 설정해보겠습니당

 

파일을 실행해주니 성공이라네요

 

LIST