글

[CTF Writeup / Web] KalmarCTF 2024 - Ez ⛳ v2

이미지
[CTF Writeup / Web] KalmarCTF 2024 - Ez ⛳ v2 안녕하세요. 이번 글에서는 KalmarCTF 2024에서 출제된 Web 문제 Ez ⛳ v2의 writeup을 작성해보려고 합니다.  Caddy webserver is AWESOME, using a neat and compact syntax you can do a lot of powerful things, e.g. wanna know if your browser supports HTTP3? Or TLS1.3? etc Flag is located at GET /$(head -c 18 /dev/urandom | base64) go fetch it. Caddy 라는 웹 서버 문제입니다. Flag는 랜덤값 이름으로 저장되어 있습니다. 문제 메인 페이지 접근 화면입니다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 (sec_headers) {     root * /     header {         Content-Security-Policy "default-src 'none'; frame-ancestors 'none'; base-uri 'none';"      ...

[CTF Writeup / Web] VishwaCTF 2024 - MediCare Pharma

이미지
[CTF Writeup / Web] VishwaCTF 2024 - MediCare Pharma 안녕하세요. 이번 글에서는 VishwaCTF 2024에 출제된 Web 문제 MediCare Pharma의 Writeup을 작성해보도록 하겠습니다. 문제 설명입니다.  URL 접속하면 로그인 페이지가 뜹니다. 로그인 시, SQL 쿼리문이 보입니다. ' or 1-- a 입력 시 Incorrect Username or Password라고 뜹니다. ' union select username,pass from users;-- a 이것저것 입력해보면서 테스트 하다가 union select를 시도하여 계정 4개를 획득했습니다. 알아낸 계정으로 로그인하면 구매할 수 있는 사이트가 열립니다. 상품을 하나 구매하면 alert 창이 뜨고, pharmacy.php 파일이 다운로드 됩니다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 <?php header ( 'Content-Type: application/json' );   if  ( $_SERVER [ "REQUEST_METHOD" ]  = =   "POST" )  {      $enteredInput   =   $_POST [ 'search_param' ];           if  (strlen( $enteredInput )  = =   0 )     {          echo  json_encode([ 'result'   = > ...

[CTF Writeup / Web] VishwaCTF 2024 - Prompt Injection

이미지
  Prompt Injection I have this collection of poems and whenever I am happy I have a look at them, hope you like it.

[CTF Writeup / Web] VishwaCTF 2024 - Trip To Us

이미지
  [Trip To Us] IIT kharakpur is organizing a US Industrial Visit. The cost of the registration is $1000. But as always there is an opportunity for intelligent minds. Find the hidden login and Get the flag to get yourself a free US trip ticket. Author : Samarth Ghante & Kanishk Kumar

[Python Flask 오류] AttributeError: 'Blueprint' object has no attribute 'register_blueprint'

flask 웹 개발 중 blueprint로 파일 분리를 했다. 프로젝트가 점점 복잡해지면서 blueprint를 중첩으로 사용하려고 했는데, 오류가 발생   AttributeError: 'Blueprint' object has no attribute 'register_blueprint' 예전 Flask 버전에서는 중첩이 안됐다고 한다. flask를 업데이트 해주면 해결된다. pip install --upgrade flask 위 명령으로 flask를 업데이트 해주어야 하는데, watchdog 오류가 뜰 수도 있다. 이 경우 아래 링크 참고. https://dongdongguri.blogspot.com/2024/02/python-flask-importerror-cannot-import.html

[Python Flask 오류] ImportError: cannot import name 'EVENT_TYPE_OPENED' from 'watchdog.events'

flask 웹 개발 중 버전 문제 때문에 flask를 업데이트 해주었다. 그런데 다음과 같은 오류가 발생. ImportError: cannot import name 'EVENT_TYPE_OPENED' from 'watchdog.events' 검색해보니 의존성 문제라고 한다. watchdog 최신버전이 아니라서 발생한 오류다. pip install --upgrade watchdog 위와 같이 watchdog을 따로 업데이트 해주면 오류가 해결된다. (flask 의존성에 추가해주면 안되나,,?) 참고 https://stackoverflow.com/questions/76228417/cannot-import-name-event-type-opened-from-watchdog-events

flask Blueprint 사용 시, error handle을 전역으로 설정하는 방법

flask로 웹 개발 중 blueprint로 라우팅을 계속해서 나누고 있었다. 오류 관련 라우팅도 파일을 분리하고 싶어서 blueprint를 사용했는데   @app.errorhandler(500) 이렇게 사용하니 오류 핸들링이 안됐다. 검색해보니 전역으로 설정해주는 방법이 따로 있었다. @app.app_errorhandler(500) 위와 같이 errorhandler 앞에 app_을 붙여서 사용하면 blueprint와 관계없이 전역으로 설정된다. 참고 https://stackoverflow.com/questions/12768825/flask-error-handler-for-blueprints https://nrodrig1.medium.com/flask-blueprints-error-handling-and-config-file-example-d1a031070763