Skip to content

Reflected XSS and Unauthorized Access in /admin/class schedule/delete_batch.php #242

@duckpigdog

Description

@duckpigdog

Reflected XSS and Unauthorized Access in /admin/class schedule/delete_batch.php

Describe the bug
The class schedule deletion endpoint /admin/class schedule/delete_batch.php lacks proper administrator permission checks (unauthorized access vulnerability). Additionally, the batch parameter from the POST request is directly concatenated into the HTML response without any HTML escaping (e.g., htmlspecialchars), leading to a reflected Cross‑Site Scripting (XSS) vulnerability.

Steps to reproduce

  1. Access the system (no login is required to trigger the vulnerability, but the endpoint is located in the admin directory; however, the absence of permission checks allows unauthorized access).
  2. Send the following POST request using a tool like Burp Suite, curl, or Postman:

POST /admin/class%20schedule/delete_batch.php HTTP/1.1
Host: 127.0.0.1:3000
Content-Type: application/x-www-form-urlencoded

batch=<script>alert('XSS_POC')</script>

  1. The server responds with an HTML page containing the injected script: Batch '<script>alert('XSS_POC')</script>' schedules deleted successfully. The script executes in the browser, confirming both unauthorized access and reflected XSS.

Describe the solution

  1. Add authentication and authorization: Verify that the current user has administrator privileges before processing the deletion request. For example, check session data or a valid token.
  2. Escape output: Use htmlspecialchars() to encode any user‑supplied data before including it in HTML output.

Screenshots

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions