본문 바로가기

Wargame

(51)
[Dreamhack] ssp-001 #include #include #include #include void alarm_handler() { puts("TIME OUT"); exit(-1); } void initialize() { setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); signal(SIGALRM, alarm_handler); alarm(30); } void get_shell() { //쉘을 띄워주는 함수 system("/bin/sh"); } void print_box(unsigned char *box, int idx) { //원하는 인덱스의 box 값을 출력 printf("Element of index %d is : %02x\n", idx, box[idx]);..
[Dreamhack] Return to shallcode Canary found. 카나리 방어 기법이 걸려있다. #include #include void init() { setvbuf(stdin, 0, 2, 0); setvbuf(stdout, 0, 2, 0); } int main() { char buf[0x50]; //80 bytes만큼 할당 init(); printf("Address of the buf: %p\n", buf); printf("Distance between buf and $rbp: %ld\n", (char*)__builtin_frame_address(0) - buf); //buf의 주소와 buf ~ $rbp 의 offset을 출력 printf("[1] Leak the canary\n"); printf("Input: "); fflush(stdou..
[pwnable.kr] bof 아래는 다운받은 bof.c 코드이다. #include #include #include void func(int key){ char overflowme[32]; printf("overflow me : "); gets(overflowme);// smash me! if(key == 0xcafebabe){ system("/bin/sh"); } else{ printf("Nah..\n"); } } int main(int argc, char* argv[]){ func(0xdeadbeef); return 0; } main 함수의 func()에서 key = 0xdeadbeef를 위쪽 func()처럼 key = 0xcafebabe 로 바꿔주면 쉘을 띄워준다. gets 함수를 통해 입력을 받는데, 입력값의 길이를 제한하지 ..
[Dreamhack] basic_exploitation_000 환경정보를 살펴보면, 보호기법이 아무것도 적용되지 않고 있다. #include #include #include #include void alarm_handler() { puts("TIME OUT"); exit(-1); } void initialize() { setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); signal(SIGALRM, alarm_handler); alarm(30); } int main(int argc, char *argv[]) { char buf[0x80]; initialize(); printf("buf = (%p)\n", buf); scanf("%141s", buf); return 0; } main 함수를 보면 buf..
[Dreamhack] XSS-1 #!/usr/bin/python3 from flask import Flask, request, render_template from selenium import webdriver from selenium.webdriver.chrome.service import Service import urllib import os app = Flask(__name__) app.secret_key = os.urandom(32) try: FLAG = open("./flag.txt", "r").read() except: FLAG = "[**FLAG**]" def read_url(url, cookie={"name": "name", "value": "value"}): cookie.update({"domain": "127.0.0..
[pwnable.kr] fd https://pwnable.kr/ https://pwnable.kr/ there are flag files corresponding to each challenges (similar to CTF), you need to read it and submit to pwnable.kr to get the corresponding point. in order to read the flag file, you need some skills regarding programming, reverse-engineering, bu pwnable.kr 마지막의 ssh fd@pwnable.kr -p2222 와 password로 guest 를 입력해 접속한다. ls -l 명령어를 입력해 현재 디렉토리에서 권한, 파일 수, 소유자..
Python 프로그래머스 문제 풀이 20제 #1 하) 팩토리얼 출력하기 (PCCE 모의고사2-4) https://school.programmers.co.kr/learn/courses/15007/lessons/121676 #2 하) 두 수의 차 (프로그래머스-두 수의 차) https://school.programmers.co.kr/learn/courses/30/lessons/120803 #3 하) 나머지 구하기 (프로그래머스-나머지 구하기) https://school.programmers.co.kr/learn/courses/30/lessons/120810 #4 하) 머쓱이보다 키 큰 사람 (프로그래머스-머쓱이보다 키 큰 사람) https://school.programmers.co.kr/learn/courses/30/lessons/120585 #5 ..
[Reversing.kr] Replace exe 파일을 실행하니 위와 같은 화면이 나온다. "Correct!" 를 더블클릭. "Correct!" 에 BP를 걸고 주변을 살펴봐도 별게 없어서, 401073 ~ 401084 부분을 참조하는 부분을 검색해 "Correct!"로 JMP하는 다른 부분을 찾아보자. 음. 아무것도 안나온다. 엥. 난 왜 이상한데서 멈추지? 지금 컴퓨터가 과열돼서 제정신이 아닌 모양이다. 원래는 40466F 에서 멈춘다는데 eax 주소를 참조해 0x90 으로 채우고, 그 eax 에 들어갈 값을 유추해야 한다고 한다. 아, 드디어 제대로 됐다! eax + 내 시리얼의 입력값, to hex 를 변경해 0x90 즉, NOP를 도출해내 프로그램이 동작하게 해야하는거다. 위의 eax 6017E80B 는 123456을 입력해 Check..