Source code
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv)
{
volatile int modified;
char buffer[64];
if(argc == 1) {
errx(1, "please specify an argument\n");
}
modified = 0;
strcpy(buffer, argv[1]);
if(modified == 0x61626364) {
printf("you have correctly got the variable to the right value\n");
} else {
printf("Try again, you got 0x%08x\n", modified);
}
}

바로 앞의 문제 stack0과 거의 유사하므로 앞의 내용은 생략하겠다.
다른 점은 이번에는 modified가 0x61626364가 되어야 된다.
여기서는 Little Endian 방식으로 저장되기 때문에 '\x64\x63\x62\x61'로 넣어줘야 한다.
nano ~/answer/stack1.py

stack1에서는 stdin이 아니라 인자 argv를 읽기 때문에 인자에 넣어서 실행해 줘야 된다.
/opt/protostar/bin/stack1 "$(python ~/answer/stack1.py)"

'Exploit_Protostar' 카테고리의 다른 글
| 00-Stack0 (0) | 2025.12.28 |
|---|