Wembsoncket
·
CTF Write Up/BYU CTF 2025
코드 분석더보기server.jsJWT 토큰을 확인해 사용자를 인증하고 /getFlag 메시지를 받을 경우 FLAG를 보내준다. // WebSocket connection handlerwss.on('connection', (ws, req) => { // Get the userId from the cookie const userId = req.headers.cookie ? req.headers.cookie.split('token=')[1] : null; if (userId) { try { const decoded = jwt.verify(userId, JWT_SECRET); const user = decoded.userId; sendMsg(ws, `Welcome! Send..
JWTF
·
CTF Write Up/BYU CTF 2025
코드 분석더보기server.pyJWT를 이용해 관리자 여부를 확인하고, JRL에 등록되지 않은 유효한 토큰에 한해 FLAG를 반환하는 구조이다.# JRL - JWT Revocation Listjrl = [ jwt.encode({"admin": True, "uid": '1337'}, APP_SECRET, algorithm="HS256")]# get flag if you are an admin@app.route('/flag', methods=['GET'])def flag(): session = request.cookies.get('session', None).strip().replace('=','') if session is None: return redirect('/') ..
Cooking Flask
·
CTF Write Up/BYU CTF 2025
코드 분석더보기No Source Code Exploit사용자가 입력할 수 있는 부분은 recipe_name, description, tags가 있다. 공격 표면이 제한적이고 소스 코드가 없는 블랙박스 환경이므로 서버가 돌려주는 에러 메세지를 잘 확인할 필요가 있다.우선, sqli 페이로드를 tags에 넣었을 때 아래와 같은 sqlit3.OperationalError가 발생했으며 주석 유무에 따라 출력 결과가 다르다는 것을 알 수 있다.dessert' or 1=1→ sqlite3.OperationalError: unrecognized token: ""%')"dessert' or 1=1-- → sqlite3.OperationalError: incomplete input 주석이 없을 때 "%') 토큰이 인식되..
Willy Wonka Web
·
CTF Write Up/BYU CTF 2025
코드 분석더보기server.jsa라는 HTTP 헤더가 있고 그 값이 admin이면 FLAG를 반환된다.// endpointsapp.get('/', async (req, res) => { if (req.header('a') && req.header('a') === 'admin') { return res.send(FLAG); } return res.send('Hello '+req.query.name.replace("","")+'!');}); httpd.conf백엔드 서버에 요청이 가기 전 리버스 프록시가 설정되어 있어 a라는 헤더가 삭제된다.LoadModule rewrite_module modules/mod_rewrite.soLoadModule proxy_module module..
Red This
·
CTF Write Up/BYU CTF 2025
코드 분석더보기insert.redis관리자 비밀번호는 admin_password라는 키 이름으로 저장되어 있으며 FLAG는 admin_options에 포함되어 있다.set key valueset "FDR" "The only thing we have to fear is fear itself."set "Shakespeare" "To be, or not to be, that is the question."set "Mandela" "The greatest glory in living lies not in never falling, but in rising every time we fall."set "Theodore Roosevelt" "Believe you can and you're halfway there."..
link-shortener
·
CTF Write Up/b01lers CTF 2025
코드 분석더보기main.pyFlask 앱이 시작될 때 설정되는 전역 구성값들이다.app = Flask(__name__)app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///db/links.db"app.config["TOKEN"] = token_hex(64)app.secret_key = token_hex(64)engine = create_engine(app.config["SQLALCHEMY_DATABASE_URI"], echo=False)SessionFactory = sessionmaker(bind=engine)Session = scoped_session(SessionFactory)base_url = getenv("BASE_URL", "http://127.0.0.1:5..
defense-in-depth
·
CTF Write Up/b01lers CTF 2025
코드 분석더보기app.pyBLACKLIST 필터링, EXPLAIN QUERY PLAN 쿼리로 WAF가 걸려있다.@app.route('/info/', methods=['GET'])def get_user_info(name): if len(name) > 100: return jsonify({"Message": "Why the long name? Are you Tung Tung Tung Tung Tung Tung Tung Sahua????"}), 403 try: db = get_db() cursor = db.cursor() except Exception: print(traceback.format_exc()) return jsonify..
Atom Bomb
·
CTF Write Up/b01lers CTF 2025
코드 분석더보기page.html/bomb_impacts 경로로 폭탄 정보를 전달하면 Elixir 서버가 위험도를 계산해 준다.async function check_bomb_danger(bomb) { // convert altitude to an atom bomb.altitude = ":" + bomb.altitude payload = { impact: { bomb: bomb } }; try { const responce = await fetch("/bomb_impacts", { method: "POST", body: JSON.stringify(payload), h..
trouble at the spa
·
CTF Write Up/b01lers CTF 2025
코드 분석더보기main.tsxReact 앱이 시작되는 부분이다. /flag 경로에서 FLAG를 보여주도록 라우터가 설정되어 있다.import { StrictMode } from 'react';import { createRoot } from 'react-dom/client';import { BrowserRouter, Routes, Route } from 'react-router';// Pagesimport App from './App.tsx';import Flag from './Flag.tsx';import './index.css';createRoot(document.getElementById('root')!).render( } /> ..
when
·
CTF Write Up/b01lers CTF 2025
코드 분석더보기app.tsExpress 앱에 limiter라는 전역 미들웨어가 등록되어 있다. 60초에 60번까지만 /gamble 요청이 가능하다.const limiter = rateLimit({ windowMs: 60 * 1000, limit: 60, // 60 per minute standardHeaders: 'draft-7', legacyHeaders: false, skip: (req, res) => { return req.path != "/gamble" }})const app = express()app.use(limiter)app.use(express.static(path.join(__dirname, 'static'))) 클라이언트가 보낸 date 헤더 값을 초 단위 tim..