Wargame Write Up/LOB
level7 분석 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 /* The Lord of the BOF : The Fellowship of the BOF - orge - check argv[0] */ #include #include extern char **environ; int main(int argc, char *argv[]) { char buffer[40]; int i; if(argc 48){ printf("argument is too long!\n"); exit(0); } strcp..
블로그를 운영하기전에 이미 LOB level1부터 level5까지 풀이를 마친 상태였습니다. LOB는 level6부터 풀이를 시작하도록 하겠습니다. level6 분석 일단 정상적으로 쉘을 띄우기 위해서 피해가야 할 2가지 조건이 있습니다. 조건1 argv[1][47]의 값은 '\xbf'이어야 합니다. 조건2 argv[1]이 길이는 최대 48이어야 합니다. 공격 방지책 2가지도 존재합니다. 1. 모든 환경변수 삭제 for(i=0; environ[i]; i++) memset(environ[i], 0, strlen(environ[i])); 2.buffer에 쉘코드를 넣어 실행시키지 못하도록 return 직전 buffer의 모든 값을 0으로 설정 memset(buffer, 0, 40); level6 풀이 모든 ..
1. 메모리 보호 기법 유무 확인 1-1. ASLR 설정 유무 확인 ASLR 설정파일인 randomize_va_space 파일이 존재하지 않습니다. [gate@localhost test]$ cat /proc/sys/kernel/randomize_va_space cat: /proc/sys/kernel/randomize_va_space: No such file or directory cs 몇몇 커널은 ASLR 설정파일이 exec-shield-randomize 이므로 이 파일도 살펴보도록 합시다. [gate@localhost test]$ cat /proc/sys/kernel/exec-shield-randomize cat: /proc/sys/kernel/exec-shield-randomize: No such f..