Information Gathering

NMAP

  • 개방된 TCP 포트 : 21, 22, 80
└─# nmap -p- -sC -sV -Pn -n --min-rate 10000 10.129.142.202 -oN 10.129.142.202_TCP
Starting Nmap 7.95 ( https://nmap.org ) at 2025-09-03 10:14 EDT
Nmap scan report for 10.129.142.202
Host is up (0.30s latency).
Not shown: 65532 closed tcp ports (reset)
PORT   STATE SERVICE VERSION
21/tcp open  ftp     vsftpd 3.0.3
22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.2 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   3072 fa:80:a9:b2:ca:3b:88:69:a4:28:9e:39:0d:27:d5:75 (RSA)
|   256 96:d8:f8:e3:e8:f7:71:36:c5:49:d5:9d:b6:a4:c9:0c (ECDSA)
|_  256 3f:d0:ff:91:eb:3b:f6:e1:9f:2e:8d:de:b3:de:b2:18 (ED25519)
80/tcp open  http    Gunicorn
|_http-title: Security Dashboard
Service Info: OSs: Unix, 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 36.33 seconds

PORT 80

  • [1] 80번 포트에서 운영중인 웹 서비스 접속 후 Security Snapshot 메뉴에 접근한다.
  • [2] URL 확인 시 /data/[?] 구조로 Security Snapshot 데이터가 조회되는 구조를 확인할 수 있다.

  • [3] URL 값을 변경하여 /data/0, /data/1, /data/2, ... 경로로 접근한다.
  • [4] 접속 가능한 유효한 경로(숫자)에 대하여 pcap 파일을 다운로드 후 분석을 시도한다.

  • 0.pcap 파일로부터 FTP 접속에 사용된 평문 계정정보를 확인할 수 있다.


Initial Access

  • 포트스캔 과정에서 21(FTP), 22(SSH) 포트가 개방되어 있음을 확인했다.
  • 획득한 계정정보를 통해 2개의 포트에 대해 접속을 시도하였으며, 모두 접속이 가능했다.

└─# ssh nathan@10.129.142.202
nathan@10.129.142.202's password: 
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-80-generic x86_64)
 
 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
 
  System information as of Wed Sep  3 14:38:29 UTC 2025
 
  System load:           0.0
  Usage of /:            36.7% of 8.73GB
  Memory usage:          21%
  Swap usage:            0%
  Processes:             231
  Users logged in:       0
  IPv4 address for eth0: 10.129.142.202
  IPv6 address for eth0: dead:beef::250:56ff:feb0:93a3
 
  => There are 2 zombie processes.
 
 * Super-optimized for small spaces - read how we shrank the memory
   footprint of MicroK8s to make it the smallest full K8s around.
 
   https://ubuntu.com/blog/microk8s-memory-optimisation
 
63 updates can be applied immediately.
42 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable
 
 
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
 
Last login: Thu May 27 11:21:27 2021 from 10.10.14.7
nathan@cap:~$


Privilege Escalation

nathan@cap:/tmp$ ./linpeas.sh
 
[ . . . ]
  • linpeas.sh 출력 정보 중 Files with Capabilities 부분에서 권한 상승 포인트가 존재한다.
  • cap_setuid는 setuid 값을 변경할 수 있도록 허용하므로, 권한 상승이 가능하다.

  • 해당 취약점을 이용하여 setuid 값을 root 계정에 대한 값(0)으로 변경하여 루트 계정으로 권한 상승에 성공했다.


Reference

  1. https://cumulus.tistory.com/154