Server Lockdown
Ubuntu 24.04 hardening CTF · 25 challenges · 5300 points
Go-live is Monday
The registrar’s new self-service portal runs on regportal-01, an Ubuntu server a contractor built and handed over on Friday. Before students can sign in, the server must pass the campus security baseline. You have an administrator account with sudo and a terminal session.
The contractor made choices that kept the build moving and left the server exposed. Find each one, fix it without breaking the portal, and prove it with a flag.
How to play
- Start with
cat HANDOFF.txt. Typechallengesfor the full list, or read the board. - Find challenges ask for a value you discover. Enter
submit ID ANSWER. - Fix challenges ask you to harden the server. Run
hardencheck ID. A passing control prints aFLAG{...}to submit. - Stuck?
hint IDgives a nudge at no cost.helplists every command.
The terminal works like bash: Tab completes commands and paths (press it twice to list matches), ↑ and ↓ recall history, Ctrl+R searches it, Ctrl+C cancels the line and Ctrl+L clears the screen. Press Esc then Tab to move focus out of the terminal.
Challenges can be done in any order. Your progress is saved in this browser, and reset --confirm starts over.
Challenge board
Accounts and sudo 0/3
Security+ 4.5 · Identity and access management
-
A second root
Two accounts on this server have UID 0, which makes both of them root. One is root itself. Submit the name of the other account.
Answer: An account name
-
Offboard the contractor
The contractor engagement ended Friday. Remove the contractor account from every group that grants administrative rights and stop it from signing in by any method, including SSH keys. Keep the account and its home directory for the records request.
Answer: Flag from hardencheck
-
Accountable root
Root access should belong to named, accountable people. Remove the duplicate UID 0 account and every sudo rule that grants all commands without a password.
Answer: Flag from hardencheck
File permissions 0/3
Security+ 4.1 · Hardening techniques
-
Readable hashes
Password hashes live in /etc/shadow, which ordinary users should never be able to read. Submit the file’s current permissions in octal.
Answer: Three octal digits, for example 750
-
Lock down shadow
Restore /etc/shadow to the Ubuntu default so ordinary users cannot read it: owner root, group shadow, readable by owner and group only, writable only by root.
Answer: Flag from hardencheck
-
Anyone can edit root’s job
One script that root’s cron runs every night can be modified by any user on the system. Find it and remove that write access without deleting the script or stopping it from running.
Answer: Flag from hardencheck
Remote access 0/3
Security+ 4.5 · Secure protocols
-
Off the usual port
The contractor moved SSH off its default port during the build. Submit the TCP port that sshd is actually listening on.
Answer: A port number
-
No direct root logins
Disallow direct root logins over SSH. Change the SSH server configuration and apply it to the running service.
Answer: Flag from hardencheck
-
Keys, not passwords
Require key-based SSH logins by turning off password authentication. Confirm the effective setting the server uses, not just the line you edited.
Answer: Flag from hardencheck
Host firewall 0/3
Security+ 4.5 · Firewalls and ports
-
Drafted, never enforced
The firewall is installed but switched off. The contractor drafted rules for it anyway. Submit the port number of the drafted rule that would expose the database to the entire internet.
Answer: A port number
-
Default deny
Switch the firewall on with a default-deny inbound policy. The portal must stay reachable over HTTPS, and administrators must still reach SSH on the port it actually uses.
Answer: Flag from hardencheck
-
Database for the app tier only
Only the application servers in 10.40.2.0/24 need PostgreSQL. Make the database port accept connections from that subnet and from nowhere else.
Answer: Flag from hardencheck
Services and exposure 0/3
Security+ 4.1 · Attack surface reduction
-
Cleartext listener
A cleartext file-transfer service is listening on the network. Submit the name of the process that owns that listener.
Answer: A process name
-
Retire the migration service
The data migration that needed that file-transfer service is finished. Stop the service now and make sure it does not start again at boot.
Answer: Flag from hardencheck
-
Cache on loopback
The portal uses Redis as a local cache only, but Redis is listening on every interface with no password. Restrict it to the loopback interface and keep it running.
Answer: Flag from hardencheck
Patching 0/3
Security+ 4.3 · Vulnerability remediation
-
What’s pending
Refresh the package lists. How many upgradable packages come from the noble-security pocket?
Answer: A number
-
Patch without waiting
Security fixes should not wait for someone to remember them. Turn on automatic daily package-list refreshes and unattended security upgrades.
Answer: Flag from hardencheck
-
Held back
Install every pending security update. Something is keeping one of them back. Find out what and resolve it.
Answer: Flag from hardencheck
Logging 0/3
Security+ 4.4 · Monitoring and log sources
-
Logs that vanish
Logs that exist only in memory disappear at every reboot. Check how the systemd journal stores logs on this host and submit the current Storage= value.
Answer: A single word
-
Survive a reboot
Make the systemd journal keep logs across reboots and apply the change to the running journal service.
Answer: Flag from hardencheck
-
Silent sign-ins
/var/log/auth.log has not received an entry in weeks, though people sign in and use sudo every day. Restore authentication logging, apply it, and confirm that a new entry arrives.
Answer: Flag from hardencheck
Auditing and integrity 0/4
Security+ 4.4 · Monitoring and drift
-
Borrowed privileges
SUID programs run with their owner’s privileges. One SUID-root program on this host does not belong to any installed package. Submit its full path.
Answer: An absolute path
-
Keep the tool, drop the privilege
Registrar staff still need that program, but not with root’s privileges. Remove its SUID bit without deleting it.
Answer: Flag from hardencheck
-
Watch the identity files
Configure auditd to record every write or attribute change to /etc/passwd and /etc/shadow. The rules must survive a reboot and be loaded now.
Answer: Flag from hardencheck
-
Configuration drift
Some of your fixes may not stay fixed. Find the scheduled job that keeps undoing the baseline and neutralize it without stopping cron. Then make sure everything it changed is compliant again.
Answer: Flag from hardencheck