Skip to main content

CVE-2024-9300: Railway Reservation System XSS Vulnerability

CVE-2024-9300 is a cross-site scripting flaw in Oretnom23 Railway Reservation System affecting the contact form that enables attackers to inject malicious scripts. This article covers technical details, affected versions, security impact, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-9300 Overview

CVE-2024-9300 is a stored cross-site scripting (XSS) vulnerability in SourceCodester Online Railway Reservation System 1.0. The flaw resides in the contact_us.php file within the Message Us Form component. Attackers can inject malicious script payloads through the fullname, email, or message parameters. The application stores these inputs without proper sanitization or output encoding, causing the payloads to execute in the browsers of users who later view the submitted messages. The vulnerability is categorized under [CWE-79] and can be exploited remotely without authentication or user interaction at submission time.

Critical Impact

Remote unauthenticated attackers can inject persistent JavaScript that executes in administrator and user browsers, enabling session hijacking, credential theft, and defacement.

Affected Products

  • SourceCodester Online Railway Reservation System 1.0
  • Oretnom23 Railway Reservation System (CPE: cpe:2.3:a:oretnom23:railway_reservation_system:1.0)
  • contact_us.php Message Us Form component

Discovery Timeline

  • 2024-09-28 - CVE-2024-9300 published to the National Vulnerability Database
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-9300

Vulnerability Analysis

The vulnerability is a stored (persistent) cross-site scripting flaw. The Message Us Form on contact_us.php accepts user-supplied values for fullname, email, and message and writes them into the backend datastore. When an administrator or another user renders the stored data in the application interface, the browser interprets injected <script> payloads as executable code.

Because the payload persists server-side, a single submission compromises every subsequent view of that record. Attackers can leverage this to steal session cookies, pivot into administrative functions, deliver browser-based exploits, or perform actions on behalf of authenticated users. The Online Railway Reservation System is a PHP-based open source booking application; deployments are typically small business or academic, but exposed instances face internet-facing risk.

Root Cause

The root cause is missing input validation and output encoding on user-controlled form fields. The application neither sanitizes inbound parameters with a function such as htmlspecialchars() nor applies context-aware escaping when rendering stored content. The fullname, email, and message fields flow directly from $_POST into persistent storage and back into HTML output without a filter.

Attack Vector

An unauthenticated remote attacker submits the public contact form with a JavaScript payload in one of the three vulnerable fields. The payload is stored server-side. When a moderator or administrator opens the message backlog, the payload executes in their authenticated session. Refer to the GitHub XSS Vulnerability Report and VulDB entry #278794 for the disclosed proof of concept.

No verified code examples are available from the vendor. The vulnerability mechanism is documented in prose only; see the technical references for reproduction details.

Detection Methods for CVE-2024-9300

Indicators of Compromise

  • POST requests to /contact_us.php containing HTML tags such as <script>, <img onerror=, <svg onload=, or javascript: schemes in the fullname, email, or message parameters.
  • Stored database records in the messages table with embedded HTML or JavaScript payloads.
  • Outbound requests from administrator browsers to unfamiliar domains after viewing contact messages, indicating exfiltration of cookies or tokens.
  • Anomalous administrative actions performed shortly after opening the message queue.

Detection Strategies

  • Deploy web application firewall (WAF) rules that inspect POST bodies to contact_us.php for XSS signatures and known evasion patterns.
  • Review application logs for form submissions with abnormally long values or encoded script fragments in the three affected parameters.
  • Perform authenticated dynamic scanning against the Message Us Form using tools that test for stored XSS.

Monitoring Recommendations

  • Alert on any HTTP request to contact_us.php matching XSS pattern libraries.
  • Monitor administrator session activity for unexpected cookie exports or cross-origin requests originating from the admin console.
  • Baseline normal contact form volume and flag spikes that may indicate mass exploitation attempts.

How to Mitigate CVE-2024-9300

Immediate Actions Required

  • Take the Message Us Form offline or restrict access via IP allowlisting until a patch is applied.
  • Purge stored messages that contain HTML or JavaScript payloads from the database.
  • Rotate administrator session tokens and credentials in case existing sessions were compromised.
  • Apply a WAF rule to block script tags and event handler attributes in contact_us.php POST parameters.

Patch Information

At the time of publication, no vendor patch is listed in the NVD advisory or vendor references. Administrators should monitor the SourceCodester website and the VulDB advisory for updates. In the absence of an official fix, apply the code-level workarounds below.

Workarounds

  • Modify contact_us.php to validate each input against an allowlist and apply htmlspecialchars($input, ENT_QUOTES, 'UTF-8') before storing values.
  • Apply context-aware output encoding wherever fullname, email, or message are rendered in HTML, attribute, or JavaScript contexts.
  • Implement a strict Content Security Policy (CSP) header that disallows inline scripts and restricts script sources.
  • Where feasible, replace the vulnerable Online Railway Reservation System 1.0 with a maintained booking platform.
bash
# Example Apache header configuration to reduce XSS blast radius
Header set Content-Security-Policy "default-src 'self'; script-src 'self'; object-src 'none'; base-uri 'self'"
Header set X-Content-Type-Options "nosniff"
Header set Referrer-Policy "no-referrer"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.