Machine IP : 192.168.192.163

초기 침투

[서비스] / [취약점] / [CVE 또는 기법] 요약

nmap 스캐닝 결과, 22번 80번 포트 열림

Nmap scan report for 192.168.192.163
Host is up (0.11s latency).

PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.2 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   3072 c1:99:4b:95:22:25:ed:0f:85:20:d3:63:b4:48:bb:cf (RSA)
|   256 0f:44:8b:ad:ad:95:b8:22:6a:f0:36:ac:19:d0:0e:f3 (ECDSA)
|_  256 32:e1:2a:6c:cc:7c:e6:3e:23:f4:80:8d:33:ce:9b:3a (ED25519)
80/tcp open  http    Apache httpd 2.4.41 ((Ubuntu))
|_http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: Did not follow redirect to http://exfiltrated.offsec/
| http-robots.txt: 7 disallowed entries 
| /backup/ /cron/? /front/ /install/ /panel/ /tmp/ 
|_/updates/
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 at Fri May  1 19:16:40 2026 -- 1 IP address (1 host up) scanned in 10.97 seconds

http://exfiltrated.offsec/ 도메인을 사용하므로 /etc/hosts 경로에 추가함 http://exfiltrated.offsec/ 접속

Wappalyzer 확인, Subrion CMS 사용함 http://exfiltrated.offsec/install/upgrade/ 접속 결과, 4.2.1 버전 사용함

searchsploit 검색 결과, Subrion CMS 4.2.1 - Arbitrary File Upload 취약점 존재함 https://nvd.nist.gov/vuln/detail/CVE-2018-19422

┌──(kali㉿kali)-[~/oscp_pg/Exfiltrated/recon]
└─$ searchsploit Subrion CMS 4.2.1
------------------------------------------------------------------------------------------- ---------------------------------
 Exploit Title                                                                             |  Path
------------------------------------------------------------------------------------------- ---------------------------------
Subrion CMS 4.2.1 - 'avatar[path]' XSS                                                     | php/webapps/49346.txt
Subrion CMS 4.2.1 - Arbitrary File Upload                                                  | php/webapps/49876.py
Subrion CMS 4.2.1 - Cross Site Request Forgery (CSRF) (Add Amin)                           | php/webapps/50737.txt
Subrion CMS 4.2.1 - Cross-Site Scripting                                                   | php/webapps/45150.txt
Subrion CMS 4.2.1 - Stored Cross-Site Scripting (XSS)                                      | php/webapps/51110.txt
------------------------------------------------------------------------------------------- ---------------------------------
Shellcodes: No Results
Papers: No Results

searchsploit에서 다운로드한 익스플로잇 코드 사용했지만 지속적으로 실패함

┌──(root㉿kali)-[/home/kali/oscp_pg/Exfiltrated/recon]
└─# python3 49876.py -u http://exfiltrated.offsec --user=admin --passw=admin
[+] SubrionCMS 4.2.1 - File Upload Bypass to RCE - CVE-2018-19422 

[+] Trying to connect to: http://exfiltrated.offsec
Traceback (most recent call last):
  File "/home/kali/oscp_pg/Exfiltrated/recon/49876.py", line 117, in <module>
    login()
    ~~~~~^^
  File "/home/kali/oscp_pg/Exfiltrated/recon/49876.py", line 49, in login
    csrfToken = soup.find('input',attrs = {'name':'__st'})['value']
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

직접 웹쉘 업로드 하기위해 업로드 엔드포인트 확인

업로드 시도, 응답 패킷에 업로드 디렉터리 노출됨

웹쉘 업로드 성공

리버스 쉘 업로드 해 리버스 쉘 연결함 mysql DB 접속했으나 특별한 정보 없으며 coaran 디렉터리 접근 불가함

정보 수집 결과, * * * * * root bash /opt/image-exif.sh 크론탭 발견

www-data@exfiltrated:/var/www/html/subrion/admin$ cat /etc/crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
* *     * * *   root    bash /opt/image-exif.sh

권한 상승

[misconfiguration 또는 exploit] 요약

/opt/image-exif.sh cron 코드 확인

www-data@exfiltrated:/opt$ cat image-exif.sh 
#! /bin/bash
#07/06/18 A BASH script to collect EXIF metadata 

echo -ne "\\n metadata directory cleaned! \\n\\n"


IMAGES='/var/www/html/subrion/uploads'

META='/opt/metadata'
FILE=`openssl rand -hex 5`
LOGFILE="$META/$FILE"

echo -ne "\\n Processing EXIF metadata now... \\n\\n"
ls $IMAGES | grep "jpg" | while read filename; 
do 
    exiftool "$IMAGES/$filename" >> $LOGFILE 
done

echo -ne "\\n\\n Processing is finished! \\n\\n\\n"
www-data@exfiltrated:/opt$ 

exiftool을 사용하고 11.88 버전임, exiftool은 7.44 이상 버전에서 임의 코드 실행 취약점이 존재함 https://www.cve.org/CVERecord?id=CVE-2021-22204

www-data@exfiltrated:/opt$ exiftool -ver
11.88

searchsploit 검색 결과, 익스플로잇 코드가 존재함 리버스쉘 코드 주입해 악성 이미지 파일 생성

파일 업로드

루트 권한 획득

유저 플래그 확보

루트 플래그 확보

막힌 포인트

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