Bug 2189266 - get "you don't have permission to access" error when trying to access files with spaces in them
Summary: get "you don't have permission to access" error when trying to access files w...
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: httpd
Version: 7.9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Luboš Uhliarik
QA Contact: rhel-cs-infra-services-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-04-24 15:16 UTC by Brian Johnson
Modified: 2023-07-11 16:07 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-155561 0 None None None 2023-04-24 15:17:13 UTC

Description Brian Johnson 2023-04-24 15:16:08 UTC
Description of problem:
When trying to access a file that has a space in it, get "you don't have permission to access" Forbidden message even though the file name is properly formatted in the URL (with %20 in the place of spaces)

Version-Release number of selected component (if applicable):
2.4.6-98.el7_9.7.x86_64

How reproducible:
Consistently

Steps to Reproduce:
1.create 'file with a space.txt' in web accessible directory
2.go to https://<sitename>/file%20with%20a%20space.txt
3. get Forbidden error message

Actual results:
Forbidden: You don't have permission to access <file>

Expected results:
Access to file granted

Additional info:
Permissions have been checked on the directory on the server. Was able to copy the file to a name without spaces and had no issues getting to the file. Copied it to a different name with spaces and got forbidden error. Our customer who reported the issue said they didn't have problems prior (many of their files they use regularly have spaces in the name) and I checked and found that apache got updated last Thursday. Rolled back the upgrade to 2.4.6-98.el7_9.6 and no longer had an issue getting to the files

Comment 3 Brian Johnson 2023-05-17 14:39:42 UTC
Hi -- I was wondering if there is any movement on this issue. We have a customer who currently has to have apache versionlocked to deal with this problem, making their server vulnerable with an older version of apache. thanks.

Comment 4 Joe Orton 2023-06-27 15:19:43 UTC
Brian, can you file a customer ticket for it? It would help expedite it.

Comment 5 Brian Johnson 2023-06-27 17:44:32 UTC
hey Joe, no problem at all, I'll be glad to!
 
Case 03548836 has been submitted (https://access.redhat.com/support/cases/#/case/03548836)

Comment 6 Luboš Uhliarik 2023-07-11 10:04:23 UTC
Hello Brian,

have you tried newer package than httpd-2.4.6-98.el7_9.7.x86_64 ?

Comment 7 Brian Johnson 2023-07-11 16:07:01 UTC
(In reply to Luboš Uhliarik from comment #6)
> Hello Brian,
> 
> have you tried newer package than httpd-2.4.6-98.el7_9.7.x86_64 ?

Hi Luboš!

I did some testing for my support ticket with Red Hat and when I did the testing I was updating to 2.4.6-99.el7_9.1. The issue was still prevalent there. As it turns out, the person I was working with at Red Hat pointed me to https://access.redhat.com/solutions/7016850 which provided the explanation and the fix -- 

---
Root Cause
This is a change in behavior from the CVE-2023-25690 fix. The rewrite rule results in mod_rewrite seeing characters in the URI as a plain ' ' and the update rejects such a character for protection.

Resolution
Add the B flag to a proxy rewrite using a back reference to add a query string parameter to ensure any space or special character is escaped, for example:

RewriteRule "^/(.*)" "http://localhost:8080/app?param=$1" [P,L,QSA,B]

---

On the server we were having issues with, there was a line,

RewriteRule ^(.+)$ index.php?path=$1&%{QUERY_STRING} [L]

that was apparently causing the issue. By changing the line to:

RewriteRule ^(.+)$ index.php?path=$1&%{QUERY_STRING} [L,B]

Users were then able to download the files with spaces in them correctly. I believe this properly takes care of the issue.


Note You need to log in before you can comment on or make changes to this bug.