[Tier1] Funnel (tunneling, postgresql)
2026. 4. 4. 22:05

Task

  • How many TCP ports are open?
    • 2
  • What is the name of the directory that is available on the FTP server?
    • mail_backup
  • What is the default account password that every new member on the "Funnel" team should change as soon as possible?
    • funnel123#!#
  • Which user has not changed their default password yet?
    • christine
  • Which service is running on TCP port 5432 and listens only on localhost?
    • postgresql
  • Since you can't access the previously mentioned service from the local machine, you will have to create a tunnel and connect to it from your machine. What is the correct type of tunneling to use? remote port forwarding or local port forwarding?
    • local port forwarding
  • What is the name of the database that holds the flag?
    • secrets
  • Could you use a dynamic tunnel instead of local port forwarding? Yes or No.
    • Yes

postgresql

  • 접속 : `psql -h [ip] -p [port] -U [username] -d [targetDB]`
    • `\c [DB Name] [Connection User]`
    • `\l` : 전체 DB 목록
    • `\dt` : 접속한 DB의 Table 목록
    • `\du` : 유저 목록

tunneling

  • remote port forwarding (외부 → 내 로컬 접속)
    • `ssh -R 8080:localhost:3000 user@remote_host` : 원격서버 8080번 포트 ↔ 내 PC 3000번 포트
    • 원격서버IP:8080
  • local port forwarding
    • `ssh -L 3000:localhost:80 user@remote_host` : 내PC의 3000번 포트 ↔ 원격 80번 포트
    • 접속 주소 : localhost:3000

Write Up

nmap으로 포트스캐닝을 해준다.

ftp를 anonymous 계정으로 로그인하여 볼만한걸 찾아봤다.

mget * 으로 모든 파일을 다운받아 확인해보았다.

welcome_28112022 파일로부터 확인한 사용자명은 아래와 같다.

root
optimus albert andreas christine maria

참고로 hydra를 이용하여 해당 비밀번호로 접근이되는 사용자를 빠르게 추출할 수도 있다.

직접 다 접근하여 확인한 default 계정으로 접근이되는 사용자명은 christine 였다.

 

`hydra -L usernames.txt -p 'funnel123#!#' {target_IP} ssh`

`ss -tln`로 로컬에 열려있는 포트를 확인해보았다..
`psql -h [ip] -p [port] -U [username] -d [targetDB]`로 postgresql에 접속할 수 있다.

그치만.. sudo 권한이 없어 해당 프로그램을 설치할 수가 없다.

그럼 어떻게 할 수 있냐. 터널링을 통해 로컬과 원격 서버 간 포트를 연결시켜줄 수 있다.

로컬포워딩 : 외부에서도 5432 port 에 접근할 수 있도록 외부에 노출시켜준다. 이후 내 로컬에서 psql을 설치하고 연결하면된다.

`ssh -L 3000:localhost:5432 christine@10.129.14.237` 외부에서 3000번 포트로 local:5432 에 연결하기

`psql -h localhost -p 3000 -U christine 비번은 funnel123#!#`

`\l`로 DB 목록을 확인해보겠다.

딱봐도 secrets이 수상하다.

\c secrets로 DB를 선택해주고 SELECT * FROM flag 로 플래그를 확인하면된다. (대소문자 주의)

 

'HackTheBox' 카테고리의 다른 글

[Tier1] Pennyworth (Jenkins)  (0) 2026.04.04
[Tier1] Bike (SSTI)  (0) 2026.04.04
[Tier1] Ignition (Most common passwords)  (0) 2026.04.04
[Tier1] Three (wfuzz, s3, php web shell)  (0) 2026.04.04
[Tier1] Responder (LFI, RFI, NTLM)  (0) 2026.04.04