SourceCodester Web-Based Pharmacy Product Management System Cross-Site Scripting Vulnerability

Vulnerability

A stored cross-site scripting vulnerability has been identified in SourceCodester Web-Based Pharmacy Product Management System version 1.0. The issue arises in the add-product.php file, where user input from the txtprice and txtproduct_name fields is not properly sanitized before being output. This vulnerability allows attackers to inject malicious scripts that are executed when the affected page is viewed. The vulnerability can be exploited remotely, but requires authentication and user interaction.

Impact

Exploitation of this vulnerability allows for the injection of malicious scripts that are executed in the context of the user viewing the affected page. This could lead to session hijacking, phishing attacks, defacement of the application interface, and potentially allow for privilege escalation through compromise of the admin interface.

Reproduction

To reproduce this vulnerability, log into the application and navigate to the 'add product' section. Enter a script payload into the 'product name' and 'price' fields. Once the form is submitted, the injected script will be executed when the page is loaded, demonstrating the cross-site scripting vulnerability.

Remediation

It is recommended to sanitize user input by using functions like htmlspecialchars() before outputting data to the user. Additionally, implementing a Content Security Policy (CSP) can help mitigate the risk of script execution.

Added: Jun 9, 2025, 7:46 PM
Updated: Jun 9, 2025, 7:46 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
5.4
exploitability
6.3
remediation
0.0
relevance
0.0
threat
6.4
urgency
2.9
incentive
1.7

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.