[PortSwigger Web Security Academy]Lab: Remote code execution via web shell upload write up

zzsla·2023년 8월 18일
0

문제 정보

This lab contains a vulnerable image upload function. It doesn't perform any validation on the files users upload before storing them on the server's filesystem.
To solve the lab, upload a basic PHP web shell and use it to exfiltrate the contents of the file /home/carlos/secret. Submit this secret using the button provided in the lab banner.
You can log in to your own account using the following credentials: wiener:peter

문제

lab에 들어가면 가상 blog 사이트가 나온다.

분석

이미지 업로드 기능이 취약하다.
파일 시스템에 저장하기 전에 어느 검사하지 않는다.
wiener:peter로 로그인 가능하다.
목표
php webshell을 업로드해서 /home/carlos/secret을 보고 lab 배너에 값을 넣는다.

먼저 아이디:비밀번호가 주어졌으니까 주어진 아이디로 로그인한 뒤에 My Account에 들어가면 avater 이미지를 업로드할 수 있는 곳이 있다.
php webshell을 업로드를 해야 하니 간단한 webshell을 제작한다.
<?php echo file_get_contents('/home/carlos/secret'); ?>

해당 webshell을 이미지에 업로드를 하고 My account로 돌아간 뒤에 burpsuite proxy http history에서 response된 것을 확인한다.

kyZzv09lsqf4jLTsSXzNAZaB1rCsh3fP

해당 값을 lab 배너 submit solution에 적고 ok를 누르면 문제가 풀린다.

profile
[README]newbi security hacker :p

0개의 댓글