CTF
-
[Clear] hxp CTF 2021 Log 4 sanity check WriteupCTF/hxp CTF 2021 2021. 12. 21. 22:29
최근 log4j 사태가 핫했는데, hxp CTF에 바로 반영되서 문제로 출제되었다. 해당 서버로 접근하여 log4j exploit에 주로 활용되는 예제(?)인 ${jndi:} 구문을 입력했더니, jndi lookup이 수행되는지, java:comp/env/~ 의 resource를 확인하려함과 동시에 에러 메시지가 노출되었다. 문제에서 제공되는 파일을 보면, flag는 FLAG라는 환경변수에 저장되어있음을 알 수 있는데, ${env:FLAG} 를 통해 환경변수를 호출하면 플래그를 획득 할 수 있다.(롸업을 적으면서 보니, 중간에 ldap:은 굳이 필요 없을 것 같다) FLAG = hxp{Phew, I am glad I code everything in PHP anyhow :) - :( :( :(}
-
[Study] ASIS CTF 2021 ASCII art as a service WriteupCTF/ASIS CTF 2021 2021. 10. 26. 00:53
주어진 페이지에 접근해보면, 이미지를 아스키로 바꿔주는 서비스가 제공된다. 주어진 소스를 분석해보자. #!/usr/bin/env node const express = require('express') const childProcess = require('child_process') const expressSession = require('express-session') const fs = require('fs') const crypto = require('crypto') const app = express() const flag = process.env.FLAG || process.exit() const genRequestToken = () => Array(32).fill().map(()=>"abcdef..
-
[Clear]TSG CTF 2021 Welcome to TSG CTF! WriteupCTF/TSG CTF 2021 2021. 10. 5. 07:25
이름만 들어서는 sanity check 문제 같지만, 나름 WEB 카테고리의 문제이다. 주어진 URL에 접속하면 위와같은 페이지가 나타난다. 플래그를 입력하면 일치여부를 판단해주는 것 같다. 주어진 소스에서 플래그 출력조건을 분석해보면, const {promises: fs} = require('fs'); const fastify = require('fastify'); const flag = process.env.FLAG || 'DUMMY{DUMMY}'; const app = fastify(); app.get('/', async (_, res) => { res.type('text/html').send(await fs.readFile('index.html')); }); app.post('/', (req, r..
-
[Clear] CCE 2021 GS25 WriteupCTF/CCE 2021 2021. 9. 27. 22:22
테트리스 게임을 할 수 있는 페이지와 로봇 페이지가 주어진다. 게임 저장/불러오기 기능이 제공된다. 봇의 기능은 filename과 code를 입력하면 const express = require('express') const app = express() // const __DIR = '/usr/src/app' const __DIR = './' const puppeteer = require('puppeteer') const url = 'http://prob' /* express */ app.set('views', __DIR + '/views') app.set('view engine', 'ejs') app.engine('html', require('ejs').renderFile) app.use(express...
-
[Clear] CCE 2021 ptmd WriteupCTF/CCE 2021 2021. 9. 27. 19:11
제공되는 서버에 nc로 접속하면 +,-,*,/ 연산이 주어진다. 짧은 제한시간안에 100문제를 해결해야 플래그가 나온다. python pwntools를 활용하여 수식을 분석하고 답을 전송하는 코드를 통해 플래그 획득이 가능하다. from pwn import * import base64 import binascii import sys def int_or_float(x) : ##### ........................................................(1) if "." in x : return float(x) else : return int(x) def calc(x,y,z) : if x + y == z : return b'+' elif x - y == z : return b..
-
-
-