목록WebHacking/WarGame (61)
Iriton's log
XSS(Cross Site Script)취약점 Web Application에서 사용자 입력 값에 대한 필터링이 제대로 이뤄지지 않을 경우 input 가능한 form에 script를 삽입하여 공격할 수 있는 것을 말한다. 문제 페이지 분석 vuln(xss) page부터 클릭해 봤더니 alert 창이 뜬다. 무슨 의미인진 모르겠어서 memo로 넘어갔다. memo에 접속할 때마다 hello가 한 줄씩 추가되는 거 같다. flag에 접속한 화면이다. 저 빈칸에 뭐가 들어가야 flag가 나올지 코드를 살펴 보자. 코드 분석 문제에서 XSS 취약점을 이용할 것을 요구했으니 app.route를 살펴봤다. /memo는 html 파일에 기록하고 출력하면서 filtering 과정을 거치는데 /vuln은 입력된 param을..
※ Dreamhack Wargame Lv.1 Cookie 문제를 먼저 푸는 것을 강력 추천한다. 이왕이면 Cookies & Session Lecture까지 수강하는 게 좋다. Lv.1 Cookie Write-up https://eunginius.tistory.com/27 [Dreamhack/Wargame] Lv.1 cookie 접속 정보 URL로 접속하면 뻔한 login 화면이 있다. 코드부터 살펴 보자 우선 quest의 id, pw가 보이지만 admin의 pw는 FLAG로 txt 파일에서 읽어들이는 거라 지금으로썬 알 수 없다. admin으로 로그인을 성 eunginius.tistory.com 우선 코드부터 확인했다. 역시나 admin의 pw는 볼 수 없다. 이전에 풀었던 cookie 문제와 아주 유사..
접속 정보 URL로 접속하면 뻔한 login 화면이 있다. 코드부터 살펴 보자 우선 quest의 id, pw가 보이지만 admin의 pw는 FLAG로 txt 파일에서 읽어들이는 거라 지금으로썬 알 수 없다. admin으로 로그인을 성공해야 FLAG를 얻을 수 있다. username은 cookies에서 가져온다는 걸 코드를 통해 볼 수 있다. 우선 guest로 로그인을 하여 guest에 해당하는 cookie를 얻어서 이를 변조해 볼 것이다. f12를 눌러서 Application-Cookies를 가보자. guest로 로그인하여 저장한 cookie라서 value가 guest로 지정되어 있다. 이를 admin으로 수정하고 새로고침을 해서 변조가 되는지 볼 것이다. EZ 쿠키는 클라이언트 브라우저 내에 저장되는 ..
*먼저 풀어 봐야 할 문제들의 풀이 https://eunginius.tistory.com/27 [Dreamhack/Wargame] Lv.1 cookie 접속 정보 URL로 접속하면 뻔한 login 화면이 있다. 코드부터 살펴 보자 우선 quest의 id, pw가 보이지만 admin의 pw는 FLAG로 txt 파일에서 읽어들이는 거라 지금으로썬 알 수 없다. admin으로 로그인을 성 eunginius.tistory.com https://eunginius.tistory.com/28 [Dreamhack/Wargame] Lv.1 session-basic ※ Dreamhack Wargame Lv.1 Cookie 문제를 먼저 푸는 것을 강력 추천한다. 이왕이면 Cookies & Session Lecture까지 수..
문제는 이러하다. 우선 문제 파일을 다운로드 받고 링크에 접속해 보았다. 초기 화면이다. Upload My Memo에 들어가면 이런 식으로 파일 이름과 내용을 저장하여 업로드 할 수 있다. 혹시나 해서 flag.py의 이름으로 업로드 해보았지만 될 리가 없다. 어떻게 flag.py를 다운 받지 싶어서 문제 파일에 있는 코드를 살펴 보았다. upload 하면 /upload 파일에 저장하고 read 하면 upload 파일에서 불러 오나보다. 근데 해당 조건문에서는 수상하게 파일명에서 ..이 사용되는 걸 막는다. ..은 상위폴더를 뜻하는데 그럼 flag.py가 upload파일이 아닌 상위 폴더에 있어서 막나? 싶은 생각이 든다. 파일명에 ../flag.py를 입력하고 업로드 하면 코드 내용대로 bad... 가..
문제에서 힌트를 다 주고 있다. 우선 파일을 다운 받자. 압축을 풀면 이렇게 파일이 많은데 이 중에서 최종 결과물으로 보이는 project만 열어 봤다. 평범한 웹 페이지다. 문제에서 개발자 툴을 사용하라 했으니 f12를 누른다. 개발자 모드로 진입하자마자 보이는 Search flag 형식을 검색해 보면 되지 않을까? 너무 쉽게 정답...
문제 파일을 다운로드 하면 html 파일이 있다. vscode로 열어도 되고 메모장으로 열어도 되는데 난 그냥 메모장으로 열었다. 문제를 풀다 보니 두 가지의 풀이법이 있어서 두 가지 다 작성하려고 한다. 1. 코드 변환 (While문) 메모장을 열면 엄청 긴 코드가 보이지만, 이 중에서 필요한 건 클릭할 때마다 카운트 되게 하는 함수이다. 10,000번 클릭할 수 없으니 코드를 수정해 줘야 하기 때문이다. 해당 코드는 아래와 같다. 코드를 대충 읽고 '어 그럼 카운트를 1씩 증가하지 말고 9999번씩 증가 시키면 되겠네' 라는 생각을 했다. counter += 9999로 바꾼 뒤 실행하면 flag가 암호화 되어서 출력된다. 그럼 반복문을 통해서 내부적으로 매크로를 돌려야 할 것이라 생각했다. 원래 코드..
첫 화면이다. nickname, comment, captcha가 있다. captcha 옆에는 정체불명의 문자열이 있다. 잘 모르겠으니 소스코드를 살펴 보자. ck() 함수를 보면 조건문이 여러개 있다. 조건문을 분석해 보면 id, cmt, capcha의 value가 공백이라면 focus 함수가 실행되고 리턴된다. focus 함수가 뭔지는 몰라도, 공백을 입력하면 안 되는 거 같다. captcha와 captcha_의 value가 달라도 focus 함수가 실행된다. 즉, nickname과 comment에는 공백이 아닌 값을 입력하고 captcha에는 captcha_.value와 동일한 값을 입력해야 한다. 해당 코드를 보면 captcha 라는 box에 입력한 값은 captcha이고 정체불명의 문자열이라 했던..