웹해킹기초
-
Dreamhack - proxy-1wargame/Dreamhack 2024. 10. 8. 10:57
[LEVEL 1 - proxy-1 - web] 문제 설명에 나와있는 그대로 Raw Socket Sender가 구현된 서비스가 주어진다.플래그는 flag.txt, FLAG 변수에 있다고 한다. 문제 파일부터 다운로드 받으면 위와 같은 코드를 볼 수 있는데 중요한 부분만 캡처했다.host는 127.0.0.1port는 8000data 부분에는 나머지 요구 조건을 만족시키면서 직접 HTTP 헤더 구조를 정확히 작성해야 한다.HTTP 헤더 구조는 아래 링크를 참고했다.https://raonctf.com/essential/study/web/http RAON CTF - WEB EssentialHTTP, HTTPS Secure Protocol HTTP 평문 전송과 암호화 HTTP Header / HTTP 헤더 HT..
-
Dreamhack - simple-web-requestwargame/Dreamhack 2024. 10. 8. 10:46
[Beginner - simple-web-request - web] STEP 1과 STEP 2를 거쳐 FLAG 페이지에 도달하면 플래그가 출력되는 문제이다. 문제 환경에 접속하면 나오는 페이지다. 문제 파일을 다운로드 받으면 위와 같은 코드들을 볼 수 있는데, 자세히 보면 문제의 답이 다 나와있다. STEP 1 페이지로 들어가면 위와 같이 나오는데 첫 번째 코드 사진에 있던 prm1과 prm2에 맞는 값을 각각 넣어준다. 제출을 누르면 바로 STEP 2 페이지로 리다이렉트된다.마찬가지로 두 번째 코드 사진에 있던 prm1과 prm2에 맞는 값을 각각 넣어준다. 제출을 누르면 FLAG 페이지로 이동해 플래그값을 바로 확인할 수 있다. 플래그를 획득했다!
-
Dreamhack - sessionwargame/Dreamhack 2024. 9. 25. 23:58
[Beginner - session - web] 쿠키와 세션으로 인증 상태를 관리하는 간단한 로그인 서비스가 주어진다.admin 계정으로 로그인에 성공하면 플래그를 획득할 수 있다고 한다. 문제 파일을 다운로드 받으면 위와 같이 app.py가 있다.여기서 가장 중요한 코드는 os.urandom(1).hex()인데 1바이트의 랜덤값을 생성한 후 이를 16진수로 바꾸는 코드이다.즉, session_storage에 저장되는 admin의 session_id값은 두자리다.(1바이트는 8비트고, 4비트가 16진수 하나로 표현됨) 문제 환경에 접속하면 가장 처음 나오는 페이지다. BurpSuite로 프록시 탭에서 intercept on으로 바꿔준 뒤 open browser 해주고 아까 위에 코드에서 본 ..
-
Dreamhack - php7cmp4rewargame/Dreamhack 2024. 9. 25. 13:32
[Beginner - php7cmp4re - web] php 7.4로 작성된 문제이다.알맞은 Input값을 입력하면 플래그값을 얻을 수 있다고 한다. 문제파일을 다운로드 받으면 3개의 php파일이 들어있는데, 그중 index.php파일이다. flag.php파일이다. check.php이다. 알아야 하는 정보는 여기에 다 들어있다.위 php 코드를 보면 input_1의 값은 최대 3자리 문자열이어야 하고, 문자열 "7.9"보다 크면서 문자열 "7.A"와 문자열 "8"보다는 작아야 한다.참고로 php는 문자열끼리 비교할 때 문자열의 각 문자를 ASCII Code 값을 기준으로 비교하고, 이는 사전적 순서로 이루어진다.즉, 문자열 "7.9"와 문자열 "7.A" 사이에 있는 값들이 가능하므로, 아스키..
-
Dreamhack - web-misconf-1wargame/Dreamhack 2024. 9. 24. 22:48
[Beginner - web-misconf-1 - web] 기본 설정을 사용한 서비스라고 한다.로그인한 후 Organization에 플래그를 설정해 놓았다고 되어있다. 문제 환경에 접속하면 가장 처음 보이는 페이지 문제 파일 다운로드하면 설정 파일 들어있는데 그거 열어서 쭉 보다보니까 default인 admin_user랑 admin_password가 나오길래 참고했다. 저걸로 진짜 로그인이 된다. organization 페이지에 들어가서 누가봐도 플래그처럼 보이는 값을 찾았다. 플래그를 획득했다!
-
Dreamhack - pathtraversalwargame/Dreamhack 2024. 5. 28. 21:19
[Beginner - pathtraversal - web] 먼저 문제 환경에 접속한 후 문제파일도 다운로드한다.플래그값은 /api/flag에 있다고 문제 설명에 나와 있다. 유저가 guest랑 admin이 있는 걸 볼 수 있다. 위 코드를 보고 /api나 /api/flag를 입력하면 역시나 unauthorized가 떠서 플래그값을 볼 수 없다.그리고 /get_info에서 /api/user/일 때 상위 디렉토리로 한번 이동해서 /api/flag 경로를 가야하니까 ..flag를 입력해봤는데, 마찬가지로 플래그값을 볼 수 없다. 그래서 일단 BurpSuite을 켜서 프록시 탭의 intercept에서 open browser로 문제 환경에 접속하고, intercept를 on으로 킨다. 그다음 ..
-
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..