Skip to content

path traversal #931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bradymd opened this issue Apr 11, 2025 · 1 comment
Open

path traversal #931

bradymd opened this issue Apr 11, 2025 · 1 comment

Comments

@bradymd
Copy link

bradymd commented Apr 11, 2025

Is your feature request related to a problem? Please describe.

It seems path traversal allows people to steal my passwd file

curl -k https://example.com:8443//static/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd

Describe the solution you'd like

Look it could be me, something overlooked. If not can we block path traversals for a start.

Describe alternatives you've considered

Copilot suggested a wrapper to uwsgi which I have done and worked.

In my config.yaml
#wsgi = pywb.apps.wayback
wsgi = wayback_wrapper:app

Additional context

#!/usr/local/pywb/venv/bin/python3
from pywb.apps.wayback import application

def block_malicious_requests(env, start_response):
path = env.get('PATH_INFO', '')
print(f"Processing path: {path}") # Debug statement
if '..' in path or '%2e%2e' in path or '/static/' in path and 'passwd' in path:
print("Blocked path traversal attempt") # Debug statement
start_response('451 Unavailable', [('Content-Type', 'text/plain')])
return [b'Access Denied']
return application(env, start_response)
app = block_malicious_requests


I have one installation. I am no expert or that experienced with it. What do you think?
It gets found by security scanners.

@ato
Copy link
Contributor

ato commented Apr 15, 2025

Can reproduce this when running with either uwsgi or the pywb CLI but needed to add the --path-as-is option to curl.

ato added a commit to nla/pywb that referenced this issue Apr 15, 2025
ato added a commit to nla/pywb that referenced this issue Apr 15, 2025
ikreymer pushed a commit that referenced this issue Apr 16, 2025
Prevents the path traversal attack reported in #931
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants