CVE-2021-43137

8.8 HIGH

📋 TL;DR

This vulnerability in hostel management system 2.1 allows attackers to perform Cross-Site Scripting (XSS) and Cross-Site Request Forgery (CSRF) attacks via the name field in my-profile.php. When chained together, these vulnerabilities can lead to complete account takeover. Users of hostel management system 2.1 are affected.

💻 Affected Systems

Products:
  • Hostel Management System
Versions: 2.1
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: The vulnerability exists in the my-profile.php file and requires user interaction through the name field.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete account takeover leading to unauthorized access, data theft, privilege escalation, and potential compromise of the entire system if admin accounts are affected.

🟠

Likely Case

Session hijacking, unauthorized profile modifications, and potential data exfiltration from affected user accounts.

🟢

If Mitigated

Limited impact with proper input validation, output encoding, and CSRF tokens preventing successful exploitation.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: CONFIRMED
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploit requires user to be logged in and interact with malicious content. The chaining of XSS and CSRF makes exploitation straightforward.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Unknown

Vendor Advisory: Not available

Restart Required: No

Instructions:

1. Implement proper input validation on the name field in my-profile.php
2. Add output encoding for all user-controlled data
3. Implement CSRF tokens for all state-changing operations
4. Update to a patched version if available from the vendor

🔧 Temporary Workarounds

Input Validation and Sanitization

all

Add server-side validation to restrict name field to alphanumeric characters only

Modify my-profile.php to include: $name = preg_replace('/[^a-zA-Z0-9\s]/', '', $_POST['name']);

CSRF Token Implementation

all

Add CSRF tokens to all forms to prevent cross-site request forgery

Add hidden CSRF token field to forms: <input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token']; ?>">

🧯 If You Can't Patch

  • Implement web application firewall (WAF) rules to block XSS and CSRF patterns
  • Disable or restrict access to my-profile.php functionality if not essential

🔍 How to Verify

Check if Vulnerable:

Test the name field in my-profile.php with XSS payloads like <script>alert('XSS')</script> and check if it executes

Check Version:

Check system version in admin panel or configuration files

Verify Fix Applied:

Verify that XSS payloads are properly sanitized and CSRF tokens are required for profile updates

📡 Detection & Monitoring

Log Indicators:

  • Unusual name field entries containing script tags or special characters
  • Multiple profile update requests from same IP

Network Indicators:

  • HTTP requests with suspicious payloads in name parameter
  • Cross-origin requests to my-profile.php without proper referrer

SIEM Query:

source="web_logs" AND (uri="*my-profile.php*" AND (param="*<script>*" OR param="*javascript:*"))

🔗 References

📤 Share & Export