TryHackMe - ExfilNode
The ExfilNode challenge on TryHackMe is a medium-difficulty room that focuses on exploiting a Node.js application to gain initial access, followed by a clever lateral movement and privilege escalation involving sensitive data exfiltration.
1. Enumeration
The process begins with a standard network scan. You’ll find a web server running a Node.js application. By exploring the site and its source code (or through directory brute-forcing), you identify an endpoint that allows for file uploads or processes user input in a way that is vulnerable to Command Injection.
2. Initial Foothold
Vulnerability: The application fails to properly sanitize input before passing it to a system shell.
Exploitation: By injecting a reverse shell payload (e.g., using bash or python), you gain a shell as a low-privileged user (typically www-data).
Stabilization: Use Python's pty module to upgrade your shell to a fully interactive TTY.
3. Lateral Movement
Once inside, you discover a second user on the system.
Discovery: Searching the filesystem or checking running processes reveals a Node.js-based backup or monitoring script.
Exfiltration: The challenge gets its name here. You often have to find a way to "exfiltrate" credentials or SSH keys. This might involve intercepting local traffic or reading a configuration file that contains the password for the next user.
4. Privilege Escalation to Root
The final step usually involves exploiting Sudo permissions or a misconfigured binary.
The Hook: In ExfilNode, the user may have the ability to run node or a similar runtime with sudo privileges without a password.
Root Shell: By using a "GTFOBins" style exploit, you can use the Node.js child_process module to spawn a root shell:
sudo node -e 'child_process.spawn("/bin/sh", {stdio: [0, 1, 2]})'
Conclusion: Capture the root flag located in /root/root.txt.

Comments
Post a Comment