본문 바로가기
  • Tried. Failed. Logged.
728x90

dreamhack22

DreamHack - CTF에 유용한 도구 모음(드림핵 툴즈) https://tools.dreamhack.games/main dreamhack-tools tools.dreamhack.games 2023. 9. 7.
DreamHack - blind-command 풀이 https://dreamhack.io/wargame/challenges/73 blind-command Read the flag file XD Reference Server-side Basic Server-side Advanced - Command Injection dreamhack.io 해결 조건 사용자로부터 GET Method를 요청받아야 함 cmd라는 GET 파라미터 값을 전달받아야 함 request.method가 GET이 아니어야 함 해결 조건 1번과 3번이 좀 모순이 된다. 코드의 7번째 라인 @app.route('/' , methods=['GET'])에 인해 GET 외에 다른 Method를 전송하면 405(METHOD NOT ALLOWED) 에러가 발생한다. 하지만 14번째 라인 if문에 의해 .. 2023. 9. 7.
DreamHack - Robot Only 풀이 https://dreamhack.io/wargame/challenges/680/ Robot Only Description 로봇만 이용할 수 있는 도박장이에요. 로봇임을 인증하고 경기에서 이겨 플래그를 구매하세요! dreamhack.io 주요 함수 - verify() def verify(): global verified if verified is True: print('you have already been verified as a robot :]') return randn224 = (get_randn() | get_randn() ')) print('answer is [{0}]!'.format(answer)) if user_answer == answer: print('you earned ${0}.'.for.. 2023. 5. 24.
DreamHack - Mitigation: Stack Canary 실습 문제(카나리 값 구하기) https://learn.dreamhack.io/112#p2477 로그인 | Dreamhack dreamhack.io 우선 a를 8개 이하로 입력할 경우 아무런 문제는 없어 보인다. 만일 a를 9개를 입력하게 된다면 뒷부분에 tTc(xU8라는 이상한 값이 붙는다. 메모리를 눈으로 확인하면 카나리 영역에는 저런 식으로 값이 저장돼있는 것이다. 왜 a를 8개를 입력하면 카나리 값이 출력이 되지 않는가? 그 이유는 카나리에 문자 끝 부분에는 \x00인 즉 NULL을 가지고 있기 때문에 printf 출력을 하면 문자의 끝으로 인식이 되어 카나리 값이 함께 출력되지 않은 것이다. 그러므로 카나리를 유추하기 위해서는 \x00 부분을 다른 문자로 덮어 씌어서 나머지 7바이트를 가져오고 \x00을 그 앞에다 붙이면 진.. 2023. 5. 1.
DreamHack - Return to Shellcode 풀이 r2s.c // Name: r2s.c // Compile: gcc -o r2s r2s.c -zexecstack #include #include void init() { setvbuf(stdin, 0, 2, 0); setvbuf(stdout, 0, 2, 0); } int main() { char buf[0x50]; init(); printf("Address of the buf: %p\n", buf); printf("Distance between buf and $rbp: %ld\n", (char*)__builtin_frame_address(0) - buf); printf("[1] Leak the canary\n"); printf("Input: "); fflush(stdout); read(0, buf, 0x1.. 2023. 5. 1.
DreamHack - Quiz: x86 Assembly 1 문제 end로 점프하면 프로그램이 종료된다고 가정하자. 프로그램이 종료됐을 때, 0x400000 부터 0x400019까지의 데이터를 대응되는 아스키 문자로 변환하면 어느 문자열이 나오는가? [Register] rcx = 0 rdx = 0 rsi = 0x400000 ======================= [Memory] 0x400000 | 0x67 0x55 0x5c 0x53 0x5f 0x5d 0x55 0x10 0x400008 | 0x44 0x5f 0x10 0x51 0x43 0x43 0x55 0x5d 0x400010 | 0x52 0x5c 0x49 0x10 0x47 0x5f 0x42 0x5c 0x400018 | 0x54 0x11 0x00 0x00 0x00 0x00 0x00 0x00 =============.. 2023. 5. 1.
DreamHack - Return Address Overwrite rao.c // Name: rao.c // Compile: gcc -o rao rao.c -fno-stack-protector -no-pie #include #include void init() { setvbuf(stdin, 0, 2, 0); setvbuf(stdout, 0, 2, 0); } void get_shell() { char *cmd = "/bin/sh"; char *args[] = {cmd, NULL}; execve(cmd, args, NULL); } int main() { char buf[0x28]; init(); printf("Input: "); scanf("%s", buf); return 0; } 버퍼의 사이즈는 0x28(40 bytes)이며, get_shell() 함수로 return 하.. 2023. 4. 30.
DreamHack - basic_exploitation_000 풀이 basic_exploitation_000.c #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; } 사용자로부터 141 바이트 크기의 문자열을 입.. 2023. 4. 26.
DreamHack - login-1 풀이 관리자 레벨 유저 아이디 찾기 http://host3.dreamhack.games:20947/user/1 = MAXRESETCOUNT: 이렇게 작성했으면 이런 취약점은 없었을 것. 서버 에러 500을 이용 신규 계정을 만들게 되면 resetCount 영역에는 NULL이 생기게 되면서 아래의 resetCount = resetCount + 1 구문에서 오류가 발생한다. 결국 리셋 카운트는 증가 못한 채 서버 측 에러(500)가 발생한다. updateSQL = "UPDATE user set resetCount = resetCount+1 where idx = ?" cur.execute(updateSQL, (str(user['idx']))) msg = f"Wrong BackupCode ! Left Count : .. 2023. 3. 27.
DreamHack - node-serialize (nodejs 직렬화 취약점) 풀이 node-serialize 취약점 예시 var serialize = require('node-serialize'); var x = { rce : function(){ require('child_process').exec('echo serialize exploited!', function(error, stdout, stderr) { console.log(stdout) }); }(), } serialize.serialize(x); var y = '{"username": "guest", "country": "Korea", "exec": "_$$ND_FUNC$$_function(){ require(\'child_process\').exec(\'echo unserialize exploited!\', functio.. 2023. 3. 27.
728x90