Skip to content

Stored XSS through URL fields (Links and other _url fields) #401

Closed

Description

@caseysoftware

URLs entered by users are printed into href attributes without checking the scheme or escaping:

  • CLink::hook_preStore() (modules/links/links.class.php) only adds http:// when the URL contains no :, so any other scheme is stored as typed.
  • w2p_Output_ListTable builds the Links list's open icon with the raw value (case 'url' in classes/w2p/Output/ListTable.class.php).
  • w2p_url() (includes/main_functions.php), used for every _url field (project URL, staging URL, task URL and others), only adds http:// when the text http appears nowhere in the value, and escapes neither the URL nor the link text.
  • modules/links/view.php redirects to the stored URL.

A user who can add or edit links, projects or tasks can therefore store a script URL that runs in the browser of anyone who clicks it.

Fix:

  • Accept only http, https (and perhaps mailto/ftp) URLs when saving, in isValid() or hook_preStore(), and prefix or reject anything else.
  • Escape URLs and link text with htmlspecialchars(..., ENT_QUOTES) in w2p_url(), ListTable and the HTML helpers.
  • Check the scheme again before the redirect in links/view.php.

Activity

  1. added a commit that references this issue on Oct 21, 2026
    f7657af
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions