Project

Profile

Help

Issue #7066

Denial of Service in pulp-content when CONTENT_PATH_PREFIX is followed by a `/`

Added by SimonPe 4 months ago. Updated 3 months ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
3. High
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 77
Quarter:

Description

when sending a request to ${CONTENT_PATH_PREFIX}/ (whatever CONTENT_PATH_PREFIX is set to, plus one extra slash) pulp-content enters an infinite loop. because:

>>> os.path.split('/path')
('/', 'path')
>>> os.path.split('/')
('/', '')

and hence the while loop in https://github.com/pulp/pulpcore/blob/master/pulpcore/content/handler.py#L152-L158 never reaches the exit condition of base being empty (it stays /)

Associated revisions

Revision 24498849 View on GitHub
Added by SimonPe 3 months ago

don't go into an infinite loop when CONTENT_PATH_PREFIX is followed by /

this would cause path to start with a / and because

>>> os.path.split('/path')
('/', 'path')
>>> os.path.split('/')
('/', '')

base would never end up as None but stay as / resulting in an infinite loop.

fixes #7066

Revision 19d9e6ac View on GitHub
Added by SimonPe 3 months ago

don't go into an infinite loop when CONTENT_PATH_PREFIX is followed by /

this would cause path to start with a / and because

>>> os.path.split('/path')
('/', 'path')
>>> os.path.split('/')
('/', '')

base would never end up as None but stay as / resulting in an infinite loop.

fixes #7066

(cherry picked from commit 244988496900843a412e42ebff95468a4e682635)

History

#2 Updated by daviddavis 4 months ago

I was able to reproduce this:

$ http :/pulp/content//

The content app hung for a while and then I saw this in the logs:

Jul 02 19:48:20 pulp3-source-fedora.crake.example.com gunicorn[28299]: [2020-07-02 19:48:20 +0000] [28299] [CRITICAL] WORKER TIMEOUT (pid:28312)
Jul 02 19:48:21 pulp3-source-fedora.crake.example.com gunicorn[28299]: [2020-07-02 19:48:21 +0000] [28337] [INFO] Booting worker with pid: 28337

#3 Updated by fao89 4 months ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 76

#4 Updated by daviddavis 4 months ago

  • Status changed from NEW to POST
  • Assignee set to SimonPe

#5 Updated by rchan 4 months ago

  • Sprint changed from Sprint 76 to Sprint 77

#6 Updated by SimonPe 3 months ago

  • Status changed from POST to MODIFIED

#7 Updated by dkliban@redhat.com 3 months ago

  • Sprint/Milestone set to 3.6.0

#8 Updated by pulpbot 3 months ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF