Start the machine, hack the system, and find the hidden flags to complete this challenge and earn points!
This walkthrough explains how to hack the lab and capture the flags. For help with Learning Mode questions, use the Request Hint button next to each question.
Before starting, you'll need to install the required tools:
# On Ubuntu/Debian:
sudo apt update
sudo apt install nmap
# On CentOS/RHEL/Fedora:
sudo yum install nmap
# or
sudo dnf install nmap
# On macOS:
brew install nmap
# On Windows:
# Download from https://nmap.org/download.html
# On Ubuntu/Debian:
sudo apt update
sudo apt install redis-tools
# On CentOS/RHEL/Fedora:
sudo yum install redis
# or
sudo dnf install redis
# On macOS:
brew install redis
# On Windows:
# Download from https://github.com/microsoftarchive/redis/releases
# or use WSL with Ubuntu
This challenge simulates a real-world penetration testing scenario where you need to discover and analyze an exposed service. The flag is hidden within a database service that needs to be discovered and exploited.
First, we need to discover what services are running on the target. In a real pentest, you would start with port scanning:
# Basic port scan to discover open ports (skip ping)
nmap -Pn -sS -p- <target-ip>
# Or scan common ports (skip ping)
nmap -Pn -sS -p 21,22,23,25,53,80,110,111,135,139,143,443,993,995,1723,3306,3389,5900,6379,8080 <target-ip>
# Service version detection (skip ping)
nmap -Pn -sV -p 6379 <target-ip>
After scanning, you would discover that port 6379 is open. Running a service version scan would reveal:
6379/tcp open redis Redis key-value store 7.4.4
Once you discover Redis is running, you need to understand what it is and how to interact with it:
Redis is an in-memory data structure store that can be used as a database, cache, and message broker. It supports various data types including strings, hashes, lists, sets, and sorted sets.
# Connect to Redis using redis-cli
redis-cli -h <target-ip> -p 6379
# Or if authentication is required (not in this case)
redis-cli -h <target-ip> -p 6379 -a [password]
# Test the connection
PING
# Should return: PONG
Once connected to Redis, start exploring the database structure:
# Get Redis server information
INFO
# Check database statistics
INFO keyspace
# List all keys in the current database
KEYS *
# Redis supports multiple databases (0-15)
# Switch to different databases
SELECT 0
SELECT 1
SELECT 2
# ... and so on
# Check each database for keys
KEYS *
After exploring, you'll find various keys in the database. Let's analyze them systematically:
# Get the value of a string key
GET secret_flag
# Returns: YmQ5NWNkNjktZjRjMS00OTkwLWIxNDYtYjEzNWM3MDRkY2Vk
# This looks like base64 encoded data
# Get all fields from the hash
HGETALL hidden_data
# Returns:
# part1 -> 62643935636436392d663463312d343939302d
# part2 -> 623134362d623133356337303464636564
# hint -> hex_encoded_flag_parts
# The hint reveals these are hex-encoded flag parts
# Get all elements from the list
LRANGE encoded_parts 0 -1
# Returns:
# YmQ5NWNkNjktZjRjMS00OTkwLWIxNDYtYjEzNWM3MDRkY2Vk
# 623134362d623133356337303464636564
# 62643935636436392d663463312d343939302d
# Get all members from the set
SMEMBERS flag_pieces
# Returns:
# YmQ5NWNkNjktZjRjMS00OTkwLWIxNDYtYjEzNWM3MDRkY2Vk
# base64_encoded_flag
# bd95cd69-f4c1-4990-b146-b135c704dced
# Interesting! One of the set members looks like a UUID
Now we need to decode the various encoded data we found:
# Decode the base64 string from secret_flag
echo "YmQ5NWNkNjktZjRjMS00OTkwLWIxNDYtYjEzNWM3MDRkY2Vk" | base64 -d
# Returns: bd95cd69-f4c1-4990-b146-b135c704dced
# This looks like a UUID! Let's verify it's the flag
# Decode the hex parts from hidden_data
echo "62643935636436392d663463312d343939302d" | xxd -r -p
echo "623134362d623133356337303464636564" | xxd -r -p
# Combine the parts to form the complete flag
We found the same UUID in the set data: bd95cd69-f4c1-4990-b146-b135c704dced
This confirms it's the correct flag!
This scenario is realistic because:
Exposed Redis instances are a common security issue:
To prevent Redis exposure:
Useful commands for Redis forensics:
# Database information
INFO
INFO keyspace
INFO memory
# Key analysis
TYPE key_name
TTL key_name
OBJECT encoding key_name
# Pattern matching
KEYS pattern*
SCAN cursor
# Data inspection
DEBUG OBJECT key_name
MEMORY USAGE key_name
# Database switching
SELECT [0-15]
# Data type specific commands
# For strings: GET, STRLEN
# For hashes: HGET, HGETALL, HLEN
# For lists: LLEN, LRANGE, LINDEX
# For sets: SCARD, SMEMBERS, SISMEMBER
The flag is: bd95cd69-f4c1-4990-b146-b135c704dced
This challenge teaches:
Choose how you want to get started
Choose a username to get started
We've sent a 9-character code to your email