You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stored XSS through URL fields (Links and other _url fields) #401
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_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
Only link to http(s), ftp and mailto URLs, and escape them