

실습서버의 환경
#Dockerfile
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y zip unzip tzdata curl
RUN apt-get install -y php5
RUN apt-get install -y apache2 libapache2-mod-php5
RUN rm /var/www/html/index.html
COPY ./src /var/www/html/
RUN chmod 777 /var/www/html/upload/
COPY ./run-lamp.sh /usr/sbin/
COPY ./000-default.conf /etc/apache2/sites-enabled/
RUN a2enmod rewrite
RUN chmod +x /usr/sbin/run-lamp.sh
# FLAG
COPY ./flag.c /flag.c
RUN apt install -y gcc \
&& gcc /flag.c -o /flag \
&& chmod 111 /flag && rm /flag.c
EXPOSE 80
CMD ["/usr/sbin/run-lamp.sh"]
src/index.php

src/upload.php

html로 우회 했지만 출력 하지 않는다.

.htaccess는 파일이 있는 디렉토리 내 (하위디렉터리 포함) 설정 옵션을 제공한다.

실행되는 것을 확인

명령어도 잘먹힌다.

이제 플래그를 찾으면 끝.

