개발세발보안중

Command Injection Advanced 본문

CTF

Command Injection Advanced

채영채영 2023. 9. 27. 14:40

https://dreamhack.io/wargame/challenges/413

 

Command Injection Advanced

Description Exercise: Command Injection Advanced에서 실습하는 문제입니다. 문제 수정 내역 2023.07.27 Dockerfile 제공

dreamhack.io

 

escapeshellcmd() 함수를 통해 문자를 필터링하는 코드이다. 

shell_exec()함수로 curl명령에 입력받은 인자를 실행한다.

chache folder에서 md5(url)로 파일을 만들고 내용을 넣는다.

curl 명령어에 -o 옵션을 사용하면 임시 파일을 생성할 수 있다.

-o /var/www/html/cache/webshell.php 

http://host3.dreamhack.games:23406/cache/webshell.php 임시 서버 경로를 이렇게 바꿔주었다.

ls를 입력하면

이렇게 뜨는데, flag 파일에 들어가면 플래그가 나온다 .

/flag 

'CTF' 카테고리의 다른 글

file-special-bit  (0) 2023.09.27
welcome  (0) 2023.09.27
command-injection-chatgpt  (0) 2023.09.27
[드림핵] phphreg  (0) 2023.09.20
[드림핵] RSA-wiener Write Up  (0) 2023.05.31
Comments