Skip to content

hardening(quicktree): sanitize location parameter before header() redirects #8

Closed

Description

@somethingwithproof

Summary

get_nfilter_request_var('location') returns the raw, unfiltered request value. At quicktree.php:208 and quicktree.php:336 that value is embedded directly in header('Location: ...') calls without stripping CRLF characters or URL-encoding the output. A location value containing \r\n injects arbitrary HTTP response headers. PHP 8.x throws ValueError on CRLF in header(), but PHP 7.x deployments are silently exploitable.

Details

Field Value
File quicktree.php
Lines 208, 336
Auth required Yes — authenticated Cacti user
CWE CWE-93
// Before
header('Location: quicktree.php?location=' . get_nfilter_request_var('location'));

// After
header('Location: quicktree.php?location=' . rawurlencode(
    str_replace(["\r", "\n"], '', (string) get_nfilter_request_var('location'))
));

Fix applied at both sites in branch security/quicktree-sanitize-location-header.

Acceptance criteria

  • CRLF characters stripped before header() at both sites
  • Value URL-encoded before embedding in Location header
  • Regression test in tests/Security/QuicktreeXssTest.php

Activity

  1. changed the title [-]hardening(quicktree): sanitize location parameter to prevent header injection in redirects[/-] [+]hardening(quicktree): sanitize location parameter before header() redirects[/+] on Mar 10, 2026
  2. somethingwithproof commented on Mar 10, 2026

    @somethingwithproof
    MemberAuthor

    Closing public issue — moving to private security advisory per responsible disclosure policy.

  3. somethingwithproof commented on Oct 24, 2026

    @somethingwithproof
    MemberAuthor

    The location value is now restricted to 'console' or 'tab' before it is used (#47). This is on main and not in a tagged release yet. Verified on main (d560051).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions