SourceCodester Pharmacy Sales and Inventory System Cross-Site Scripting Vulnerability

Vulnerability

A cross-site scripting (XSS) vulnerability has been identified in SourceCodester Pharmacy Sales and Inventory System version 1.0. The issue arises in the 'create_medicine_name' function within the '/ShowForm/create_medicine_name/main' file. The vulnerability allows remote attackers to inject malicious scripts through the 'medicine_name' parameter, which are then executed in the context of the user's browser. This exploitation can lead to unauthorized actions being performed on behalf of the user, such as stealing cookies or session tokens.

Impact

Exploitation of this vulnerability allows for cross-site scripting, where injected scripts are executed in the user's browser. This could be used to steal cookies, session tokens, or other sensitive information, perform actions on behalf of the user, deface web pages, redirect users to malicious sites, or gain control of the user's browser.

Reproduction

To reproduce this vulnerability, send a request to the '/ShowForm/create_medicine_name/main' endpoint with a 'medicine_name' parameter that includes a script tag, such as '<script>alert(/xss/);</script>'. This will trigger the cross-site scripting vulnerability by executing the injected script in the browser.

Remediation

To address this vulnerability, implement output encoding for user inputs before displaying them on the web page. Validate and filter input data to reject or escape potentially malicious content. Consider using a Content Security Policy to restrict script execution sources. For sensitive cookies, set the HttpOnly and Secure flags. Regular security audits can help identify and fix such vulnerabilities.

Added: Jun 1, 2026, 11:25 AM
Updated: Jun 1, 2026, 11:25 AM

Vulnerability Rating

Custom Algorithm
spread
0.3
impact
1.7
exploitability
7.2
remediation
0.0
relevance
9.7
threat
6.4
urgency
2.9
incentive
0.0

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