Send the Alien Back home

🛡 Deep Dive into Path Traversal with “Send the Alien Back Home” – Selfmade Ninja Lab Cloud Lab Training for Aspiring IT Students 🛡

Hey Ninjas! 🥷  Welcome to an in-depth write-up for the "Send the Alien Back Home" CTF challenge! This series of hands-on challenges, hosted on our Selfmade Ninja Lab platform, is designed to help you practice cybersecurity skills with a focus on path traversal vulnerabilities. 🚀 These challenges provide a unique, practical learning experience for aspiring IT students exploring cloud lab training. Getting Started with Selfmade Ninja Labs Follow these steps to set up and access the challenge: Sign in to Selfmade Ninja Labs (Click here) New User? Create an account here. Activate WireGuard: Configure your VPN to securely connect to the labs. Navigate to the dashboard: Visit Selfmade Ninja Labs. On the left-side navbar, click the “My Lab” dropdown and select “Challenge Lab.” Search for the “Send the Alien Back Home” challenge: Use the search bar to locate the challenge. Click the challenge button to open its details. Start the mission: On the top-right corner, click “Deploy Lab” and then hit “Start Mission.” Your unique lab IP will be generated. Set up your environment: Use VS Code or your preferred editor to port-forward your lab IP. Begin exploring the challenge! You can jump straight into the action by accessing the Send the Alien Back Home challenges on our lab website. Each challenge will walk you through various techniques for identifying, exploiting, and defending against path traversal vulnerabilities. So, buckle up and prepare for a cybersecurity adventure with Selfmade Ninja Lab’s cloud lab training! 🌟 Prerequisites Make sure your computer is connected to SNA Labs [Essential lab] 🚨Alert: If you’re unfamiliar with connecting to Challenge labs, we recommend you check out our Connecting to CTF Labs Guide for essential tips and guidelines. Always approach these challenges with a responsible and ethical mindset. Before starting the writeup, let’s clarify what path traversal vulnerability is: Exploring Path Traversal: Path traversal is a critical security vulnerability in web applications, where attackers can gain unauthorized access to files by exploiting inadequately sanitized user inputs. This issue arises when applications fail to properly validate or sanitize file paths provided by users, leading to potential access to sensitive areas of the server’s file system. In our ‘Send the Alien Back Home’ challenge series, you’ll get hands-on experience with this concept, where each level intensifies in complexity. Through a series of engaging challenges, you’ll learn all about path traversal vulnerabilities and how to protect against them. 🌟 Let’s embark on this educational adventure together! Challenge 1: The Home Intel : After initiating the mission, let’s first review the brief mentioned above. Pay close attention to the code within the brief as it holds key insights for our challenge. $file_path = $_GET['file']; function fetch_file($file_path) { if(file_exists($file_path)) { $output = file_get_contents($file_path); print $output; } else { http_response_code(404); } } fetch_file($file_path); In our challenge, we’re exploring a scenario where the file parameter in a GET request is used to access files on the server. This technique can potentially expose sensitive files, depending on how the server handles these requests. Also, take a look at the code snippet: file_get_contents($file_path);. This function is crucial, as it’s used to retrieve the contents of the specified file. 🧐 Given this information, let’s put our detective hats on 🕵️‍♂️ and examine the website. Remember, the brief mentioned the location of the flag. With this key piece of information, we can strategize our approach to testing the website and ultimately capture that elusive flag. 🚩 Let’s dive in and see what we can uncover! Home page: Payload: Get the file mentioned in the mission brief just by entering it in the url: ?file=/documents/zoraxians_home_planet. 🎉 Hooray! We’ve got our first flag by passing the value of the file location of our flag /documents/zoraxians_home_planet. It turned out to be easier than expected to snag that flag, right? 😊 💡 Remember, this flag is uniquely generated for every user. Copying this flag won’t work for you. The real goal here is to practice and tackle the challenge on your own. So, get ready to dive in and learn! Are you excited for the next challenge? Let’s keep up the momentum and move forward! 🚀 Challenge 2: The Secret Project 🗂️ Just like in our first mission, let’s kick off this challenge by delving into the mission brief. Within it, we’ve uncovered an interesting PHP code snippet: $directory_path = "uploads/"; $file_path = $directory_path . $_GET['file']; function fetch_file($file_path) { if (file_exists($file_path)) { $output = file_get_contents($file_path); echo $output; } else { echo $file_path . " " . "not found"; http_response_code(404); } } Check out this key variable in the code: $directory_path = "uploads/";. It’s quite similar to what we encountered in the first challenge, involving the file parameter in a GET request and using the file_get_contents function. Plus, we’ve got a clue about the location of our flag! 🕵️ Let’s take this information and test it out on the website. Payload: Voila! 🎉 We’ve successfully captured the second flag, located in the ‘uploads’ directory. By cleverly navigating to file=../../../../media/usb/project_51, we uncovered it with ease. Remember, each challenge progressively becomes more intricate.🚀 Great job on the puzzles so far!, But guess what? There’s a whole bunch of new challenges coming up, and this time, you’re on your own!. There’s nothing like the feeling of solving tough puzzles on your own. Defense Measures: 🔒 Defending against such advanced path traversal attempts is a complex task. It requires a comprehensive approach, encompassing thorough input validation, constant security protocol updates, and a deep understanding of the underlying server and application architecture. Regular security audits and penetration testing are crucial in identifying potential bypass techniques and fortifying defenses against them. Resource: For those keen on understanding advanced path traversal defense strategies, OWASP’s Advanced Path Traversal Guide is an excellent resource. It delves into sophisticated attack vectors and provides guidance on creating robust security frameworks to counter them. Conclusion: The "Send the Alien Back Home" challenge series has equipped us with essential skills for identifying and defending against path traversal vulnerabilities. This practical experience is invaluable for aspiring …

🛡 Deep Dive into Path Traversal with “Send the Alien Back Home” – Selfmade Ninja Lab Cloud Lab Training for Aspiring IT Students 🛡 Read More »

Connect Selfmade Ninja Labs

How to Connect to Selfmade Ninja Labs with WireGuard (Ubuntu)

Welcome to our guide on how to connect Selfmade Ninja Labs using SSH and WireGuard on Ubuntu. This step-by-step tutorial is tailored to help you integrate your Ubuntu environment with Selfmade Ninja Labs for seamless remote development and productivity. Ubuntu, a versatile and robust operating system, is ideal for both development and daily tasks. By learning how to Connect Selfmade Ninja Labs, you can efficiently manage remote servers, deploy applications, and streamline your development process. Whether you’re a beginner or an advanced user, this guide will equip you with the skills to maximize your Ubuntu setup for Selfmade Ninja Lab cloud lab training for aspiring IT students. Let’s dive in and unlock the potential of Ubuntu with Selfmade Ninja Labs! Prerequisites SNA Gitlab account (Create one by clicking here) A working installation of Ubuntu. Connect to Selfmade Ninja Labs Adding SSH Keys Login your credentials by clicking here. Select your profile, then click on ‘preferences’ tab Select ‘SSH keys’ from the list of options, then select ‘Add key’ Open your Terminal and put any of the following commands to generate SSH keys For example, for ED25519: ssh-keygen -t ed25519 -C "key-name" For 2048-bit RSA: ssh-keygen -t rsa -b 2048 -C "key-name" You can add passphrase if needed Your SSH key is generated. Now copy the key generated which has the extension .pub in it. To view the key, use cat command Paste the public key in the ‘key’ field, Change the title if needed, then press ‘Add key’ Now your key has been successfully added. Wireguard connection Now open https://labs.selfmade.ninja and login. Go to ‘My Devices’ under the connectivity tab, then click on ‘Add Device’ button and Fill it with your appropriate device requirements. Open your terminal and install wireguard by putting the following command sudo apt install wireguard Check whether wireguard has been successfully installed by putting the following command wg –version Now generate a wireguard public key and private key by putting the following command wg genkey | tee privatekey | wg pubkey > publickey You can see that the private key and public key are generated by using ls command Copy the public key by opening it using cat command Paste the ‘Wireguard public key’ which you have copied’. Then click ‘Verify and Add’ button. Now you can see that a new device has been added. But still there is no connection. to connect that press that three dots button, then select ‘Show configuration’. Copy the Info in it. Now open terminal and create a new wireguard configuration file by using this command. sudo nano /etc/wireguard/confname.conf Make sure you keep the conf file in the above given location.You can change the name of the conf file as you want. Replace the private key with your private key you generated. and then save it. Now give the following command to start the on the wireguard connection. sudo wg-quick up confname You can check whether it has been connected successfully by using the following command sudo wg show Now you can see that your device has become online Open ‘My Labs’, Go to ‘Machine Labs’, then go to ‘Essentials Labs’ Click ‘Deploy’ Click on ‘Confirm Deploy’ Now copy the SSH command from the connetion settings. Open terminal and connect with essentials lab by pasting the SSH command You have connected to the labs successfully Visual Studio Code Open VS code and install Remote-SSH extenstion Click the icon from the bottom-left, click ‘connect to host’ Click ‘Add new SSH host’ Paste the SSH command, and hit enter. Click ‘Connect’ below You have successfully with labs vis VS code. you can open the terminal and check it. Also you can see that the SSH is connected to your labs Conclusion Congratulations! You’ve successfully connected to Selfmade Ninja Lab cloud lab training for aspiring IT students using SSH and WireGuard and configured Visual Studio Code for remote development. By following these steps, you now have a robust environment to manage remote servers, deploy applications, and enhance your learning experience. Whether you’re developing complex applications or exploring new functionalities, Ubuntu combined with SNA Labs will serve as your reliable platform. Feel free to revisit this guide whenever needed, and continue leveraging the power of Selfmade Ninja Labs to streamline your workflow. Happy coding!

Connect to Selfmade Ninja Labs

How to Connect to Selfmade Ninja Lab with WireGuard (Windows)

Prerequisites A Selfmade Ninja Lab account (If you don’t have an account, create one here). A working installation of WireGuard for Windows. Steps to Connect to Selfmade Ninja Labs Log in to your Git Selfmade Ninja account (click here) using your credentials. Click on your profile and select the Preferences tab. Under Preferences, choose SSH Keys, then click Add new key. Connect to Selfmade Ninja Labs Login to your GitLab account using your credentials here. Select your profile, then click on ‘Preferences’ tab Select ‘SSH Keys’ from the list of options, then select ‘Add new key’. Open your command prompt, type the following command: ssh-keygen -t rsa -b 2048 -C “your-key-name” Enter a passphrase for your key, if needed. Now, in the command prompt, type type your_key_location Copy your Public key and paste it in the ’Key’ field. Click ‘Add key’, and your Key is added. Under ‘Connectivity’ tab, Click ‘My Devices’. Click ‘Add Device’ option. Now, to configure your PC to WireGuard, Install WireGuard for windows by clicking here Now, Open WireGuard on your windows. Under the ‘+’ symbol, Click ‘Add an empty tunnel’. Copy the public key. Paste it in the ‘Wireguard Public Key’ field, and click ‘Verify and add’ option Under your device, click ‘Show Configuration’. Copy from the ‘Address’ field to the end of the configuration as shown below. Paste it in the WireGuard Configuration as shown below. Add a name to the interface in the ‘Name’ field, and hit ‘Save’. Now click ‘Activate’ to connect to the WireGuard Interface. Open your Command Prompt, type 'ping 172.30.0.0' to check whether the WireGuard connection is working or not. Now you have configured your PC to WireGuard. Now, from your ‘Labs’ page, click ‘deploy’ Click ‘Confirm deploy’ After the server is deployed, you can copy the SSH command from the field below and run it in the terminal. If you want to connect it via VS Code, make sure Remote-SSH extension is installed (If you don’t have VS Code Installed, Click here to download.) Click SSH icon from bottom-left of VS Code, Click ‘Connect to Host’, and click ‘Add new SSH host’ Then paste the SSH command, and hit enter. then click ‘Connect’ below. Your Labs is now connected via VS Code. To open the terminal within the code server environment, simply press Ctrl and the backtick (`) button simultaneously. This action will grant you direct access to the terminal. Why Choose Selfmade Ninja Lab? Selfmade Ninja Lab provides aspiring IT students with a cutting-edge cloud-based training environment. Through seamless connectivity and practical learning experiences, learners can master advanced technologies using the Selfmade Ninja Lab cloud lab training for aspiring IT students. Our platform is designed to empower students with hands-on expertise in a secure and efficient environment.

MQTT Service

Hosting MQTT Service in Selfmade Ninja Labs

Welcome to the Guide on Setting Up and Using MQTT in Selfmade Ninja Labs Welcome to your comprehensive guide on configuring and leveraging MQTT within Selfmade Ninja Lab cloud lab training for aspiring IT students! In this tutorial, we will walk you through how to effectively use MQTT (Message Queuing Telemetry Transport)—a lightweight and efficient messaging protocol designed for real-time data exchange, IoT solutions, and device communication. By integrating MQTT into the Selfmade Ninja Lab environment, you’ll unlock powerful tools to enhance your projects and development skills. Whether you’re building IoT applications, streamlining communication between devices, or optimizing data flow, MQTT is an essential protocol for IT professionals. Let’s dive into the details and get started! Prerequisites Before diving into MQTT configuration, ensure you have the following: Access to a Selfmade Ninja Lab account (Sign up here). Basic knowledge of MQTT concepts Why Host Your MQTT Service in Selfmade Ninja Lab? Using Selfmade Ninja Lab cloud lab training for aspiring IT students offers distinct advantages: High-Speed Internet: Ensures seamless operations for your MQTT services. Robust DoS Protection: Safeguards your applications against attacks. User-Friendly Interface: Easy to set up and navigate. Round-the-Clock Availability: Access your services anytime 24/7. Free Enhancements: Includes complimentary tools like MongoDB, Memcache, and more. Real-Time Learning: Experiment with cutting-edge technologies in a safe environm Publisher: Imagine you have a weather station that collects temperature data from various sensors located across a city. This weather station acts as an MQTT publisher. It generates real-time temperature readings from these sensors and publishes this data to an MQTT broker under a specific topic, such as "city/weather/temperature." The MQTT broker {rabbitmq}, acting as a central hub, receives this data from the publisher. Subscriber On the other side of the equation, there are residents in the city who want to stay updated on the current temperature in their neighborhood. They have a weather app on their smartphones that serves as an MQTT subscriber. This weather app has subscribed to the "city/weather/temperature" topic on the MQTT broker. As a subscriber, it doesn’t send messages but actively listens for updates RabbitMq server RabbitMQ is an open-source message broker used to facilitate communication between components in a distributed system. It enhances system reliability, scalability, and decouples components for independent operation. RabbitMQ primarily supports the Advanced Message Queuing Protocol (AMQP) but also offers compatibility with protocols like MQTT and STOMP, making it versatile for different integration needs. It’s a critical tool for building efficient and robust distributed applications Configuring MQTT in Selfmade Ninja Labs Log in to the Selfmade Ninja Labs Dashboard: To get started, visit https://labs.selfmade.ninja/ and then click on "login with our Gitlab." To get started, simply click on "Machine Labs," which serves as the gateway to our virtual laboratory. Here, you’ll find a wide range of resources and tools to support your learning and experimentation. Additionally, it’s worth noting that even if you’re a free user, you can still take advantage of the lab; however, there may be some limitations imposed on your access or features. Upon entering the laboratory, your next step is to access the lab through the code server. To do this, simply click on "Machine Labs." Inside Machine Labs, you’ll discover a plethora of labs, each one remarkable in its own unique way. These labs offer a diverse range of learning and experimentation opportunities, allowing you to explore and engage with various topics and tools. To begin your journey, navigate to the Essential lab section and click on "Code." This Essential lab serves as your personal computer located remotely, providing you with a powerful platform to perform tasks, experiments, and coding exercises Once you reach this stage, follow these steps to proceed smoothly: First, you’ll notice a popup on your screen. Within the popup, you should locate and copy the code server password. With the password in hand, proceed by clicking "Launch Code IDE." This action will open the code environment directly in your web browser, providing you with a convenient and accessible workspace for your coding tasks and projects. As you initiate the code IDE, you’ll encounter a password prompt. Simply paste the previously copied password into the prompt field. After doing so, all that’s left to do is wait for the magic to happen. The code environment will initialize, granting you access to a powerful workspace for your coding endeavors. With the password successfully entered, you now have full access to the code server. To open the terminal within the code server environment, simply press Ctrl and the backtick (`) button simultaneously. This action will grant you direct access to the terminal, providing you with a versatile tool for executing commands and managing your coding tasks efficiently. "Congratulations! 🎉 You’ve successfully accessed the code server in your browser. You’re now ready to dive into the world of MQTT and RabbitMQ services in SNA Lab. Let’s get started!" Accessing the RabbitMQ Service in Your Browser Navigate to the service tab using this link: https://labs.selfmade.ninja/services. Once on the service tab, locate the "VS Code Web" command and copy it. Now, proceed by clicking the "Manage" button. This action will allow you to configure. Begin by opening the code server environment. Inside the code server terminal, paste the previously copied "socat" command. what is socat and why? socat is a versatile command-line utility for networking tasks. It enables bidirectional data streams between two endpoints and serves various purposes, including port forwarding, proxying, file transfers, serial communication, and encryption. It’s a valuable tool for network administrators, developers, and security professionals to establish, monitor, and manipulate network connections. In your specific case, socat was used to bridge a local port to a remote service, allowing you to access and interact with the remote service as if it were running on your local machine. This is particularly useful for remote development and accessing services in virtual environments. Navigate to the port tab, where you’ll find a specific link. Copy the URL provided within the port tab. Now, paste this URL into your …

Hosting MQTT Service in Selfmade Ninja Labs Read More »

hosting flask application

Hosting a Flask Website via Apache Server in Selfmade Ninja Lab

Hosting a Flask Website via Apache Server [WSGI]: A Step-by-Step Guide A Step-by-Step Guide for Aspiring IT Students Welcome, students! If you’re eager to learn how to host a Flask website using an Apache server with WSGI, you’re in the right place. This comprehensive guide simplifies the deployment process, helping you showcase your projects to the world with ease. Let’s dive into the details and make your Flask application live! Introduction Flask is a powerful web framework in Python that allows rapid development and deployment of web applications. Using Apache server with WSGI (Web Server Gateway Interface) is a reliable method for production-ready hosting. This combination ensures your app runs smoothly in a secure and scalable environment. Why Choose Selfmade Ninja Lab Cloud Lab Training for Aspiring IT Students? Selfmade Ninja Lab is an excellent platform for hosting your applications. Here’s why it stands out for aspiring IT students: High-Speed Connectivity First and foremost, Selfmade Ninja Labs offers a blazing-fast internet connection, ensuring quick access and interaction with your web applications. Robust Security In addition to speed, SNA Labs provides robust Denial-of-Service (DoS) protection. This security measure keeps your applications safe from malicious attacks, maintaining their integrity and availability. Ease of Use Moreover, the setup process is user-friendly, making it easy for you to understand and implement. This simplicity helps you focus more on your development and less on troubleshooting deployment issues. Continuous Availability Another significant benefit is the 24/7 availability of your applications. With SNA Labs, your web applications are always online, ensuring that users can access them at any time. Enhanced Functionality Furthermore, SNA Labs offers free services such as MongoDB and Memcache, adding extra functionality to your applications without additional costs. These services help you build more robust and dynamic web applications. Real-Time Learning Finally, hosting your applications in SNA Labs provides a real-time learning experience. This hands-on approach allows you to apply your knowledge practically, helping you gain valuable skills in web development and deployment. By leveraging these benefits, you can ensure your Flask applications are not only well-hosted but also optimized for performance and security. Ready to start? Visit Selfmade Ninja Lab(click here) to activate your lab environment and explore the possibilities. Obtaining a Domain for Your Website To give your website its own unique identity, follow these steps to obtain a domain: Visit the Labs: Start by going to SNA Labs (click here) Navigate to Connectivity -> My Domains -> Add New Domains. Enter your desired domain name in the input field. Return to https://labs.selfmade.ninja/labs. Select Essential Lab and initiate a Redeploy. From the "Choose Domains" dropdown, pick your new domain. Confirm the redeployment by clicking Confirm Redeploy. With these steps completed, your website now has its own domain. 🌐 It’s all set to shine on the internet stage! 🚀 2. Install Python and Flask To begin, execute these commands in your terminal to install Python and Flask: sudo apt install python3.10-venv sudo apt-get install libapache2-mod-wsgi-py3 sudo a2enmod wsgi 3. Create a Virtual Environment Next, create and activate a virtual environment for your Flask application with the following commands: python -m venv flaskEnev source flaskEnev/bin/activate pip install flask 4. Create a Flask App You can use your existing project or follow these steps to create a simple "Hello World" application: 1.Set Up the Project Directory: Create a new directory and navigate into it: mkdir helloworld cd helloworld 2.Create the Application File: Open a new Python file named app.py: nano app.py 3.Write the Flask Application: Add the following code to app.py: from flask import Flask application = app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello, World!' if __name__ == '__main__': app.run(debug=False) 5 Configure Apache to Serve Your Flask App To configure Apache to serve your Flask application, follow these steps: Create a Virtual Host Configuration 1.Navigate to the Sites-Available Directory: Create a new virtual host configuration file: cd /etc/apache2/sites-available nano testingSite.conf 2. Edit the Configuration File: Replace the placeholders in the configuration file with your specific details: <VirtualHost *:80> ServerName [Your domain name] WSGIDaemonProcess [project_name] user=[your username] group=[your username] threads=5 python-home=[env dir ex=/home/john/flaskEnev] WSGIScriptAlias / [application folder ex=/home/john/helloworld/app.py] <Directory [project_folder]> WSGIProcessGroup [project_name] WSGIApplicationGroup [project_name] Order deny,allow Allow from all Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/[project_name]-error.log CustomLog ${APACHE_LOG_DIR}/[project_name]-access.log combined </VirtualHost> Test and Enable Your Site 3. Verify and Activate Your Configuration: Test and enable your new site configuration: sudo apachectl configtest sudo a2ensite testingSite.conf sudo systemctl reload apache2 At this point, your Flask application should be accessible via your domain. Conclusion Congratulations on successfully hosting your Flask website via an Apache Server using WSGI! If you have followed the steps correctly, your Flask app should now be live. Feel free to explore and expand your Flask application. If you have any questions or run into issues, don’t hesitate to seek help or refer to the documentation. Happy coding! For more tutorials and tech insights, visit http://blog.selfmade.ninja/ Happy Coding! Author :‎ ‎ ‎ [Jawahar.s] GITHUB :‎ ‎ ‎ https://github.com/jawa77

Scroll to Top