Logo

dev-resources.site

for different kinds of informations.

NYP Infosec December CTF 2024 writeup!

Published at
12/30/2024
Categories
cybersecurity
linux
docker
bash
Author
cyberfate
Categories
4 categories in total
cybersecurity
open
linux
open
docker
open
bash
open
Author
9 person written this
cyberfate
open
NYP Infosec December CTF 2024 writeup!

Background

I recently created a Capture The Flag (CTF) challenge that was later used in NYP Infosec December CTF 2024.

The inspiration for creating this challenge came primarily from another CTF challenge in PicoCTF 2024, titled 'SansAlpha'. The main idea behind the CTF is for participants to figure out how to execute commands without the use of alphabets. There are several ways to solve it but it takes some experience and creativity to do so. I will go through the thought process in detail so that it is easy to follow even for beginners.

The CTF Challenge: Wild

Creator - Edwin Oh
Category - Misc
Difficulty - Medium

Description:
Christmas is back, but something's amiss — Santa Claus has gone missing! Can you track down Santa, uncover the hidden secrets, and save Christmas in time?

Image description
At first glance, we can see we are given access to an SSH connection.

ssh [email protected] -p 8010 
password: xmas
Enter fullscreen mode Exit fullscreen mode

Image description
We can confirm that normal Linux commands have been disabled, at least through "alphabets". After researching online, we know that there are special characters like wildcards and symbols we can use to possibly mimic commands.

Image description

# Basic Linux knowledge you need to know here
/ #Backslash separates directories in Linux file system
? #Acts as a wildcard; Example: ???? represents 4 characters
/home/user/ #Standard directory of a user in a Linux environment
Enter fullscreen mode Exit fullscreen mode

From the image, you can see that I am trying to enumerate what is inside the user's directory. The result is the path to the flag. After finding out the location of the flag, we need to find a way to retrieve the flag. The first thing that should come to mind is finding an executable to do so.

# Most executables are stored in this directory:
/bin #bin short for binary
Enter fullscreen mode Exit fullscreen mode

Image description
After enumerating the /bin directory, I found this executable /bin/base64. If you don't know what base64 is, it is a way to encode strings. I am now going to try and encode the flag using base64 and decode it later.

Image description
The first thing I tried was using wildcards to mimic the directory of /bin/base64 using /???/??????, but it was getting confused with other binaries that matches binary directories that have the same number of characters. To get what we want which is /bin/base64, we need to filter.

  1. Filter against base32 we can simply add a 64 /???/?????? to /???/????64
  2. Now it is getting mixed up between /bin/base64 and /bin/x86_64 as you can see from this message: /bin/base64: extra operand ‘/bin/x86_64’
  3. We can filter out underscore through exclamation mark and globbing > [!] matches any single character that is not . > [!_] matches any single character that is not underscore. This way we can filter out the the directory /bin/x86_64.

The final output shows an encoded string. All that is left to do is decoding the encoded string. You can do it through the terminal or going to a decoder to decode it. Finally, you retrieve the flag!
Image description

The Author's Perspective

To differentiate this CTF challenge from PicoCTF's "SansAlpha", I blocked certain solutions, such as mimicking commands like cat and ls, to increase the difficulty level.

This challenge was created using a Docker environment, with a restricted shell layered on top, along with some additional configurations.

I have also developed another CTF challenge that builds on this one and plan to feature it in the next CTF event. Stay tuned for my next blog post. Thank you for reading—I truly appreciate your time and interest. I hope you enjoyed this post!

bash Article's
30 articles in total
Favicon
Understanding Linux Shells: Interactive, Non-Interactive, and RC Files
Favicon
Fixing Linux Backup Sync Issues for exFAT Compatibility
Favicon
Ergonomic Pyhon Text Piping Solution for Linux Shell with pypyp and uv
Favicon
Changing the Login Shell with Security and Interactivity
Favicon
Final Bash Script Series Mastering Remote Server Management and Web App Deployment
Favicon
Writting a GH extension with AI
Favicon
Test GPIO pins on BeagleBone Black by toggling high to low
Favicon
NYP Infosec December CTF 2024 writeup!
Favicon
Building a Smart Heater Controller with Python, Docker, and Bluetooth #3
Favicon
The Complete Guide to Bash Commands
Favicon
How to Get Started with Bash Scripting for Automation
Favicon
Building a Basic Testing Framework in Bash 🐚
Favicon
Funny how, as I was writing this, I started wondering—could we make this pipeline even smarter? That’s when SonarQube came to mind. But can it even work with Bash scripts? I’d love to hear your thoughts!
Favicon
Domina Bash con ejemplos prácticos de Git
Favicon
Explaining Null Device or Black Hole Register in Vim
Favicon
A Media Server on Steroids - Walkthrough
Favicon
From FZF file preview to a browser for cht.sh to discovering the ideal solution
Favicon
Code. Battery notifier.
Favicon
🌟Simplifying User Account Management with Bash Scripting Day3🌟
Favicon
Become a Bash Scripting Pro in 10 Minutes: A Quick Guide for Beginners
Favicon
Automatically Monitor and Manage RAM Usage for Next.js Development
Favicon
Bash Script - Task Management
Favicon
Bash Your Tools
Favicon
Bash Script Series: Automating Log Analysis with Bash Script or Shell Script
Favicon
The Most Interesting Mostly Tech Reads of 2024
Favicon
🚀 Automating Process Monitoring & Restarting with Bash Scripting Day4! 🔧
Favicon
🚀 RazzShell v1.0.1 is Here: Plugin Support, Enhanced Job Management, and More! 🌟
Favicon
Step-by-Step Guide: Assigning a Namecheap Domain to DigitalOcean Hosting with Nginx
Favicon
Simplify GitHub Workflow Management with My-GitHub-Manager
Favicon
How to play a bunch of lemmings

Featured ones: