[File upload] Remote code execution via web shell upload

2025. 4. 17. 16:34·Web Security Academy

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

https://portswigger.net/web-security/file-upload/lab-file-upload-remote-code-execution-via-web-shell-upload

 

Lab: Remote code execution via web shell upload | Web Security Academy

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 ...

portswigger.net


실습 페이지로 이동하면 블로그 형태의 웹페이지로 이동된다.

문제에서 주어진 계정으로 로그인을 한다.(wiener/peter)

로그인에 성공하면 My Account 페이지로 이동하게 되고, 해당 페이지에는 업로드 기능이 존재한다. 

먼저 정상적인 케이스를 시도하기 위해 임의의 이미지 파일을 업로드 한다.

출력된 메시지를 보아 avatars라는 폴더 하위에 이미지가 업로드된 것을 알 수 있다.

다시 My Account 페이지로 돌아와보면 업로드한 이미지 파일을 볼 수 있다.

이번에는 웹 셸을 업로드 해봤다. 웹 셸 코드는 다음과 같다.

<?php echo file_get_contents('/home/carlos/secret'); ?>

웹 셸 파일도 아무런 필터링 없이 업로드된 것을 알 수 있다.

버프스위트를 사용해서 요청 데이터와 응답 데이터를 확인해 보면 위와 같이 플래그?를 확인할 수 있다.

상단 배너에 있는 솔루션 제출 버튼을 클릭하고

응답 데이터에서 찾은 플래그를 입력한다.

문제 해결 완료

'Web Security Academy' 카테고리의 다른 글

[Path traversal] File path traversal, traversal sequences stripped with superfluous URL-decode  (0) 2025.04.18
[File upload] Web shell upload via extension blacklist bypass  (1) 2025.04.17
'Web Security Academy' 카테고리의 다른 글
  • [Path traversal] File path traversal, traversal sequences stripped with superfluous URL-decode
  • [File upload] Web shell upload via extension blacklist bypass
min8282
min8282
  • min8282
    min8282
    min8282
  • 전체
    오늘
    어제
    • 분류 전체보기 (110)
      • Security (33)
        • System & Network (2)
        • Application (5)
        • Cloud (20)
      • Dev (18)
        • Node.js (12)
        • Hadoop (3)
        • BOJ (2)
      • Web3 & Blockchain (2)
        • Web3 (2)
      • K-Shield.Jr (15)
      • Web Security Academy (3)
      • Wargame (13)
        • Dreamhack (3)
        • Bandit (10)
      • NS (16)
        • CTF (6)
  • 블로그 메뉴

    • 홈
  • 링크

    • github
  • 공지사항

  • 인기 글

  • 태그

    aws lambda
    web security academy
    splunk db connect
    ESC1
    metacode
    티스토리챌린지
    Path Traversal
    정처기
    보안 그룹
    정처기 필기
    amazon s3 트리거
    정처기필기
    metacodem
    정보처리기사
    File Upload
    web3 보안
    탈중앙화
    오블완
    AWS SSM
    스마트 컨트랙트
    ELB
    systems manager
    메타코드
    스마트컨트랙트
    AWS CLI
    Session Manager
    prepared statement
    web3
    aws 트리거
    메타코드M
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.4
min8282
[File upload] Remote code execution via web shell upload
상단으로

티스토리툴바