워게임
-
Dreamhack - BMP Recoverywargame/Dreamhack 2024. 5. 1. 23:45
[LEVEL 2 - BMP Recovery - misc, forensics] 문제 설명에 BMP 파일의 중요한 값들을 지워버려서 flag.bmp를 올바르게 복구해야 한다고 되어있다.문제 파일을 다운로드 받으면 chal.py 파일과 flag.bmp.broken 파일이 들어있다. 일단 flag.bmp.broken 복제본을 생성해놓고 복제본으로 문제를 풀었다. 위 캡처 사진은 문제파일에 있던 chal.py 파일이다. 커서가 하나 전으로 되어있어서 파일의 맨 끝 오프셋은 DA58F6이다. 초기 파일의 모습이다. 18 00 부분 오프셋 빼고 나머지는 다 날아간듯하다.이 부분에서 알 수 있는 건 1픽셀당 24비트(3바이트)로 표현된다는 것이다. bmp 파일의 헤더 시그니처(BM)인 42..
-
Dreamhack - sleepingsharkwargame/Dreamhack 2024. 5. 1. 23:17
[LEVEL 2 - sleepingshark - forensics] 문제 설명은 Do shark sleep? 가 끝이다. 문제 파일 다운로드 받으면 dump.pcap 파일이 들어있다.wireshark로 열어주면 아래와 같이 나온다. SELECT문 있는 요청 부분을 눌러보면 위와 같이 나오는데, 이 문자열을 복사해서 dreamhack cyberchef에서 Url decode를 시켜보면 flag값이 맞으면 3초동안 잠드는 것으로 예측할 수 있다. (즉, Time Based SQL Injection을 하는 페이로드임) 양이 너무 많아서 노가다로 푸는 것은 힘들 것 같았다. 그래서 일단 첫 번째로 3초 잠드는 구간을 찾아본다.위 캡처 사진에서 619번과 623번 패킷의 time을 보면 4.7초대에..
-
Dreamhack - web-ssrfwargame/Dreamhack 2024. 3. 26. 01:13
[LEVEL 2 - web-ssrf - web] 이 문제의 목표는 SSRF 취약점을 통해 플래그를 획득하는 것이다. flask로 작성된 image viewer 서비스이며, 플래그는 /app/flag.txt에 있다고 한다. 우선 문제 파일을 다운로드 받고 app.py 코드를 살펴본다. /img_viewer은 GET과 POST 요청을 처리한다. GET : img_viewer.html을 렌더링 POST : 이용자가 입력한 url에 HTTP 요청을 보내고, 응답을 img_viewer.html의 인자로 하여 렌더링 img_viewer 함수를 보면 이용자가 POST로 전달한 url에 HTTP 요청을 보내고, 응답을 반환한다. 그런데 조건문에서 서버 주소에 "127.0.0.1", "localhost"이 포함된 URL..
-
Dreamhack - file-download-1wargame/Dreamhack 2024. 3. 25. 22:38
[Beginner - file-download-1 - web] 문제 설명에 File Download 취약점이 존재하는 웹 서비스라고 되어 있다. 플래그값은 flag.py에 들어있다. 일단 문제파일 다운받고 app.py 코드 먼저 열어본다. 업로드 페이지에서 '..'을 넣으면 bad characters,, 라고 나오게 필터링을 해놓은 것을 볼 수 있다. 반면, /read 페이지에서는 filename을 특별히 검사하지 않고 있다. 문제 환경에 처음 접속하면 위와 같은 화면이다. 일단 업로드 하러 왔는데 어차피 Filename에 '..' 쓰면 필터링 걸려서 아무 내용이나 쓰고 업로드한다. 메인 페이지에 방금 업로드했던 게 올라와 있다. 들어가보면 썼던 거 그대로 나오는데, 아까 Filename을 test로 해..
-
Dreamhack - session-basicwargame/Dreamhack 2024. 1. 31. 19:04
[LEVEL 1 - session-basic - web] 이 문제는 쿠키와 세션으로 인증 상태를 관리하는 간단한 로그인 서비스이며, admin 계정으로 로그인에 성공하면 플래그를 획득할 수 있다. 문제 파일을 먼저 다운로드 받으면 app.py가 있다. 일단 아까 코드 중 users에 있던 아이디 guest, 비밀번호 guest로 로그인을 해보고 개발자도구를 열었다. 일단 Application 탭의 Cookies로 넘어와 sessionid 값을 복사해서 메모장에 붙여놓고 우클릭해서 삭제해본다. 그런데 아까 코드에 /admin 페이지가 있는 걸 보긴 했는데 들어가보니까 저렇게 admin의 sessionid값도 다 나와있다. admin의 sessionid 값이 필요할테니 이를 메모장에 복사해놓는다. 좀전에 삭..
-
Dreamhack - cookiewargame/Dreamhack 2024. 1. 31. 18:07
[Beginner - cookie - web] 이 문제는 쿠키로 인증 상태를 관리하는 간단한 로그인 서비스이며, admin 계정으로 로그인에 성공하면 플래그를 획득할 수 있다. 웹해킹 문제 환경에 접속하고 나면 문제 파일을 다운로드 받는다. users에 등록되어 있는 건 guest와 admin 사용자이고, guest의 비밀번호는 guest이며, admin의 비밀번호는 파일에서 읽어온 FLAG인 것을 알 수 있다. 로그인 화면에서 아이디 guest, 비밀번호 guest로 로그인하고 개발자도구를 열어 Application 탭의 Cookies를 보면 Value값이 guest로 바뀐 것을 볼 수 있다. 익스플로잇 하이라이트된 Value값 guest를 admin으로 바꾸어 다시 새로고침을 하면 admin 계정으로..
-
Dreamhack - Carve Partywargame/Dreamhack 2024. 1. 23. 22:48
[Beginner - Carve Party - web] 문제 설명에 호박을 10000번 클릭하고 플래그를 획득하라고 되어있다. 문제 파일 jack-o-lantern.html을 다운로드 받으면 아래와 같은 화면이 나온다. 호박 눌러보면 밑에 10000 숫자가 1씩 감소하면서 호박의 입 형태가 조금씩 진해진다. 진짜 10000번 클릭하면 정답이 나올 것 같긴 한데 너무 노가다니까 html 코드를 vs code로 열어서 살펴본다. 중요한 부분만 캡처했는데, 위의 함수는 호박을 클릭할 때마다 점점 호박의 눈, 코, 입이 진해지게 만든다. 이 호박 클릭 함수 자체를 10000번 반복하면 되는 거니까 원래의 코드 밑에 for문을 추가해준다. 수정한 코드를 저장하고 다시 웹 페이지를 열면 호박의 눈, 코, 입이 완전..
-
Dreamhack - FFFFAAAATTTwargame/Dreamhack 2024. 1. 22. 01:39
[LEVEL 1 - FFFFAAAATTT - forensics] 문제 파일은 드림핵 해당 문제 설명에 나와 있는 링크를 통해 다운로드 받으면 된다. FFFFAAAATTTT.001 압축된 시스템 이미지 파일이 들어있다. 처음에는 언인텐으로 쉽게 풀려고 해봤으나 내 컴퓨터에서는 vscode로 안 열렸다. 그래서 이후 HxD로 .zip 파일 시그니처를 찾아보면서 Local File Header Signature 50 4B 03 04 ~, Central Directory Signature 50 4B 01 02~, End of central directory record Signature 50 4B 05 06~로 각각 4bytes인 걸 알아보았다. .zip만 따로 추출해서 안에 .txt 파일들을 열어보려고 했으나..