Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gmocanu/session 01 task #71

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions common/activity.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
INTERNAL_PORT := 80
CONT_NAME := ${IMG_NAME}
FILE_FLAG := ../flag
FLAG := $(shell cat $(FILE_FLAG))

ifndef CONT_NAME
$(error You need to set a name for IMG_NAME variable(e.g. sss-web-01_activity-name).)
endif

ifndef FILE_TEMPLATE
$(error You need to set a path for FILE_TEMPLATE.)
endif

ifndef FILE_SRC
$(error You need to set a path for FILE_SRC.)
endif

ifndef EXTERNAL_PORT
$(error You need to set EXTERNAL_PORT variable.)
endif

run: generate build
docker run -d -p $(EXTERNAL_PORT):$(INTERNAL_PORT) --name $(CONT_NAME) -t $(IMG_NAME)

build: generate
docker build -t $(IMG_NAME) -f Dockerfile ..

generate:
sed 's/__TEMPLATE__/$(FLAG)/g' $(FILE_TEMPLATE) > $(FILE_SRC)

stop:
docker stop $(CONT_NAME)

clean: stop
docker rm $(IMG_NAME)
docker image rm $(IMG_NAME):latest
rm $(FILE_SRC)

.PHONY: run build generate stop clean
19 changes: 19 additions & 0 deletions web-basics-browser-security-model/activities/cockroach/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Name

Web: Web basics and browser security model: Cockroach

## Description

Get the flag from [cockroach](http://141.85.224.157:8080/cockroach/).
What happened?
Get the flag!

Score: 25

## Vulnerability

The flag is displayed only if the `DELETE` method is called for the exposed route.

## Exploit

Solution in `./sol/solution`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM tiangolo/uwsgi-nginx-flask:python3.8

# copy over our requirements.txt file
COPY src/requirements.txt /tmp/

# upgrade pip and install required python packages
RUN pip3 install --no-cache-dir -r /tmp/requirements.txt && mkdir app

# copy over our app code
COPY src/main.py /app
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
EXTERNAL_PORT := 8080
IMG_NAME := sss-web-01_cockroach
FILE_TEMPLATE := ../src/main.template.py
FILE_SRC := ../src/main.py

include activity.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SSS{You_smashed_it}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-License-Identifier: BSD-3-Clause

from flask import Flask

app = Flask(__name__)


@app.route("/cockroach", methods=["DELETE"])
def delete_this_bastard():
return "__TEMPLATE__"


if __name__ == "__main__":
app.run(host="127.0.0.1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
click==8.0.1
Flask==2.0.1
itsdangerous==2.0.1
Jinja2==3.0.1
MarkupSafe==2.0.1
Werkzeug==2.0.1
18 changes: 18 additions & 0 deletions web-basics-browser-security-model/activities/eyes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Name

Web: Web basics and browser security model: Eyes

## Description

Get the flag from [eyes](http://141.85.224.118:8081/eyes).

Score: 25

## Vulnerability

The flag is hidden somewhere in the source code.
Check CSS style.

## Exploit

Script in `./sol/solution`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM php:7.2-apache

COPY /src/index.html /var/www/html/eyes/
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
EXTERNAL_PORT := 8081
IMG_NAME := sss-web-01_eyes
FILE_TEMPLATE := ../src/index.template.html
FILE_SRC := ../src/index.html

include activity.mk
1 change: 1 addition & 0 deletions web-basics-browser-security-model/activities/eyes/flag
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SSS{almost_in_plain_site}
Loading
Loading