Unit/System Tests PR-6.2-dev Pending

User tests: Successful: Unsuccessful:

avatar ManoharPaturi
ManoharPaturi
4 Oct 2026

Pull Request resolves #

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

When Uri::getInstance() builds the current request URI from the server variables it already neutralises the characters ', ", < and > with a comment describing this as protection against injections through the Host header. Control characters, however, are passed through untouched. A hostile or misbehaving upstream layer can place raw CR, LF or NUL bytes into HTTP_HOST or REQUEST_URI, and those bytes then travel into every URL the CMS derives from the request URI, including links rendered into pages and values used by the routing.

Control characters are never valid inside a URL, so there is no legitimate input that this change could alter. The PR extends the existing cleanup step with a removal of the C0 control range and DEL, applied to the whole assembled URI before it is parsed:

$theURI = str_replace(["'", '"', '<', '>'], ['%27', '%22', '%3C', '%3E'], $theURI);
$theURI = (string) preg_replace('/[\x00-\x1F\x7F]/', '', $theURI);

A unit test builds the server URI with a CRLF suffix on the host and a NUL byte inside the request path and asserts the resulting URI no longer contains them. The test fails against the previous code.

Testing Instructions

Run the Uri unit tests:

libraries/vendor/bin/phpunit tests/Unit/Libraries/Cms/Uri/UriTest.php

The full unit suite passes with the change applied as well.

Actual result BEFORE applying this Pull Request

http://www.example.com\r\n/joomla/index.php\0?var=value 10 is what reaches the parser; control characters from the server variables survive inside the Uri instance and everything derived from it.

Expected result AFTER applying this Pull Request

The parsed URI is http://www.example.com/joomla/index.php?var=value 10; no control characters remain anywhere in the instance.

Link to documentations

  • No documentation changes for guide.joomla.org needed
  • No documentation changes for manual.joomla.org needed
avatar ManoharPaturi ManoharPaturi - open - 4 Oct 2026
avatar ManoharPaturi ManoharPaturi - change - 4 Oct 2026
Status New ⇒ Pending
avatar joomla-cms-bot joomla-cms-bot - change - 4 Oct 2026
Category ⇒ Libraries Unit Tests
avatar ManoharPaturi
ManoharPaturi - comment - 3 Nov 2026

Hi @laoneo, @richard67 @muhme could you take a look at #48561 when you have a chance? This patch focuses on rejecting malformed remember-me cookies. I am happy to make changes or add tests if that would help. Thanks for your time!

avatar richard67 richard67 - change - 15 Nov 2026
Title
…
[5.4] Strip control characters from the URI built from server variables
[6.2] Strip control characters from the URI built from server variables
avatar richard67 richard67 - edited - 15 Nov 2026
avatar richard67 richard67 - change - 15 Nov 2026
Labels Added: Unit/System Tests PR-6.2-dev
avatar richard67
richard67 - comment - 15 Nov 2026

This pull request has been rebased to 6.2-dev. Joomla! 5.4 is now in security only support mode and so doesn't get bug fixes.

Add a Comment

Login with GitHub to post a comment