Skip to content

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

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

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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions