Listen to this Post
How CVE-2025-3822 Works
The vulnerability exists in `changepassword.php` due to improper sanitization of user-supplied inputs (txtconfirm_password, txtnew_password, txtold_password). An attacker can inject malicious JavaScript payloads into these parameters, which are then executed in the victim’s browser when the password change page is rendered. This stored XSS attack persists across sessions, allowing session hijacking, credential theft, or phishing attacks. The flaw occurs because the application fails to validate or encode input before embedding it in the HTML response.
DailyCVE Form
Platform: SourceCodester Pharmacy System
Version: 1.0
Vulnerability: Stored XSS
Severity: Medium
Date: 04/24/2025
What Undercode Say:
Exploitation:
POST /changepassword.php HTTP/1.1 Host: target.com Content-Type: application/x-www-form-urlencoded txtold_password=<script>alert(1)</script>&txtnew_password=test123&txtconfirm_password=test123
Detection:
curl -X POST "http://target.com/changepassword.php" -d "txtold_password=<script>console.log('XSS')</script>" | grep -Po "<script>.+?</script>"
Mitigation:
1. Patch `changepassword.php` with input sanitization:
$old_password = htmlspecialchars($_POST['txtold_password'], ENT_QUOTES); $new_password = htmlspecialchars($_POST['txtnew_password'], ENT_QUOTES);
2. WAF Rule to block XSS patterns:
location ~ .php$ {
modsecurity_rules 'SecRule ARGS "@detectXSS" deny,status:403";
}
3. CSP Header:
Header set Content-Security-Policy "default-src 'self'; script-src 'unsafe-inline'"
Analytics:
- Attack Vector: Network (HTTP)
- Privileges Required: Low (User-level)
- Exploitability: High (No CSRF protection)
- Impact: Medium (Session compromise)
- CVSS:4.0 Vector: AV:N/AC:L/PR:H/UI:P/VI:L
Sources:
Reported By: nvd.nist.gov
Extra Source Hub:
Undercode

