Skip to content

Commit b9a81f8

Browse files
committed
Add source code for SECCON CTF 2022 Finals
1 parent 221e095 commit b9a81f8

File tree

156 files changed

+25762
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+25762
-10
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ Sat, 11 Feb. 2023, 01:00 UTC — Sun, 12 Feb. 2023, 09:00 UTC
4545

4646
|Challenge|Category|Solved / 10<br>(International)|Solved / 12<br>(Domestic)|Difficulty|Writeup|Keywords|
4747
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
48-
|[babybox](https://github.com/SECCON/SECCON2022_final_CTF/tree/main/jeopardy/web/babybox)|web|6|4||[link](https://blog.arkark.dev/2023/02/17/seccon-finals/#web-100-babybox)|prototype pollution|
49-
|[easylfi2](https://github.com/SECCON/SECCON2022_final_CTF/tree/main/jeopardy/web/easylfi2)|web|10|8||[link](https://blog.arkark.dev/2023/02/17/seccon-finals/#web-200-easylfi2)|LFI, curl|
50-
|[MaaS](https://github.com/SECCON/SECCON2022_final_CTF/tree/main/jeopardy/web/maas)|web|3|1|★★★|[link](https://blog.arkark.dev/2023/02/17/seccon-finals/#web-300-MaaS)|newline normalization, CSP bypass|
51-
|[light-note](https://github.com/SECCON/SECCON2022_final_CTF/tree/main/jeopardy/web/light-note)|web|0|0|★★★|[link](https://blog.arkark.dev/2023/02/17/seccon-finals/#web-300-light-note)|DOM clobbering, Sanitizer API|
52-
|[dark-note](https://github.com/SECCON/SECCON2022_final_CTF/tree/main/jeopardy/web/dark-note)|web|0|0|★★★★|[link](https://blog.arkark.dev/2023/02/17/seccon-finals/#web-500-dark-note)|time-based oracle|
48+
|[babybox](challenges/202302_SECCON_CTF_2022_Finals/web/babybox)|web|6|4||[link](https://blog.arkark.dev/2023/02/17/seccon-finals/#web-100-babybox)|prototype pollution|
49+
|[easylfi2](challenges/202302_SECCON_CTF_2022_Finals/web/easylfi2)|web|10|8||[link](https://blog.arkark.dev/2023/02/17/seccon-finals/#web-200-easylfi2)|LFI, curl|
50+
|[MaaS](challenges/202302_SECCON_CTF_2022_Finals/web/maas)|web|3|1|★★★|[link](https://blog.arkark.dev/2023/02/17/seccon-finals/#web-300-MaaS)|newline normalization, CSP bypass|
51+
|[light-note](challenges/202302_SECCON_CTF_2022_Finals/web/light-note)|web|0|0|★★★|[link](https://blog.arkark.dev/2023/02/17/seccon-finals/#web-300-light-note)|DOM clobbering, Sanitizer API|
52+
|[dark-note](challenges/202302_SECCON_CTF_2022_Finals/web/dark-note)|web|0|0|★★★★|[link](https://blog.arkark.dev/2023/02/17/seccon-finals/#web-500-dark-note)|time-based oracle|
5353

5454
## SECCON CTF 2022 Quals
5555

challenges/202302_SECCON_CTF_2022_Finals/data.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const ctf: Ctf = {
3232
],
3333
challenges: [
3434
[
35-
"[babybox](https://github.com/SECCON/SECCON2022_final_CTF/tree/main/jeopardy/web/babybox)",
35+
"[babybox](challenges/202302_SECCON_CTF_2022_Finals/web/babybox)",
3636
"web",
3737
"6",
3838
"4",
@@ -41,7 +41,7 @@ const ctf: Ctf = {
4141
"prototype pollution",
4242
],
4343
[
44-
"[easylfi2](https://github.com/SECCON/SECCON2022_final_CTF/tree/main/jeopardy/web/easylfi2)",
44+
"[easylfi2](challenges/202302_SECCON_CTF_2022_Finals/web/easylfi2)",
4545
"web",
4646
"10",
4747
"8",
@@ -50,7 +50,7 @@ const ctf: Ctf = {
5050
"LFI, curl",
5151
],
5252
[
53-
"[MaaS](https://github.com/SECCON/SECCON2022_final_CTF/tree/main/jeopardy/web/maas)",
53+
"[MaaS](challenges/202302_SECCON_CTF_2022_Finals/web/maas)",
5454
"web",
5555
"3",
5656
"1",
@@ -59,7 +59,7 @@ const ctf: Ctf = {
5959
"newline normalization, CSP bypass",
6060
],
6161
[
62-
"[light-note](https://github.com/SECCON/SECCON2022_final_CTF/tree/main/jeopardy/web/light-note)",
62+
"[light-note](challenges/202302_SECCON_CTF_2022_Finals/web/light-note)",
6363
"web",
6464
"0",
6565
"0",
@@ -68,7 +68,7 @@ const ctf: Ctf = {
6868
"DOM clobbering, Sanitizer API",
6969
],
7070
[
71-
"[dark-note](https://github.com/SECCON/SECCON2022_final_CTF/tree/main/jeopardy/web/dark-note)",
71+
"[dark-note](challenges/202302_SECCON_CTF_2022_Finals/web/dark-note)",
7272
"web",
7373
"0",
7474
"0",
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# [web] babybox
2+
3+
## Description
4+
5+
Can you hack this sandbox?
6+
7+
- `http://babybox.seccon.games:3000`
8+
9+
[babybox](files/babybox)
10+
11+
## Usage
12+
13+
Launch a challenge server:
14+
15+
```
16+
cd build
17+
docker compose up
18+
```
19+
20+
Run the author's solver:
21+
22+
```
23+
docker run -it \
24+
-e SECCON_HOST=localhost \
25+
-e SECCON_PORT=3000 \
26+
--network=host \
27+
(docker build -q ./solver)
28+
```
29+
30+
## Flag
31+
32+
```
33+
SECCON{pr0totyp3_po11ution_iS_my_friend}
34+
```
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: "3"
2+
services:
3+
web:
4+
build: ./web
5+
restart: always
6+
ports:
7+
- "3000:3000"
8+
environment:
9+
- PORT=3000
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:19.6.0-slim
2+
ENV NODE_ENV=production
3+
WORKDIR /app
4+
5+
COPY ["package.json", "package-lock.json", "./"]
6+
RUN npm install --omit=dev
7+
COPY . .
8+
RUN mv flag.txt /flag-$(md5sum flag.txt | cut -c-32).txt
9+
10+
USER 404:404
11+
12+
CMD ["node", "index.js"]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const { Parser } = require("expr-eval");
2+
3+
const expr = process.argv[2].trim();
4+
console.log(new Parser().evaluate(expr));
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SECCON{pr0totyp3_po11ution_iS_my_friend}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<link rel="stylesheet" href="https://unpkg.com/simpledotcss/simple.min.css">
6+
<title>Math Calculator</title>
7+
</head>
8+
<body>
9+
<h1>Math Calculator</h1>
10+
<p>Expression:</p>
11+
<input type="text" id="expr" placeholder="1 + 2 + 3"></input>
12+
<button id="calc" type="button">Evaluate</button>
13+
<article>
14+
<p>Result:</p>
15+
<p id="result" style="text-align: center; font-size: 3rem;"></p>
16+
</article>
17+
<script>
18+
document.getElementById("calc").addEventListener("click", async () => {
19+
const expr = document.getElementById("expr").value.trim();
20+
if (!expr) return;
21+
try {
22+
const res = await fetch("/calc", {
23+
method: "POST",
24+
headers: {
25+
'Content-Type': 'application/json'
26+
},
27+
body: JSON.stringify({ expr }),
28+
});
29+
const text = await res.text();
30+
if (res.status !== 200) {
31+
alert(text);
32+
} else {
33+
document.getElementById("result").textContent = text;
34+
}
35+
} catch (err) {
36+
alert(err);
37+
}
38+
});
39+
</script>
40+
</body>
41+
</html>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const fastify = require("fastify")();
2+
const fs = require("node:fs").promises;
3+
const execFile = require("util").promisify(require("child_process").execFile);
4+
5+
const PORT = process.env.PORT ?? "3000";
6+
7+
fastify.get("/", async (req, reply) => {
8+
const html = await fs.readFile("index.html");
9+
return reply.type("text/html; charset=utf-8").send(html);
10+
});
11+
12+
fastify.post("/calc", async (req, reply) => {
13+
const { expr } = req.body;
14+
try {
15+
const result = await execFile("node", ["./calc.js", expr.toString()], {
16+
timeout: 1000,
17+
});
18+
return result.stdout;
19+
} catch (err) {
20+
return reply.code(500).send(err.killed ? "Timeout" : err);
21+
}
22+
});
23+
24+
fastify.listen({ port: PORT, host: "0.0.0.0" });

0 commit comments

Comments
 (0)