Dynamic OAuth Callback URL Constructed from Host Header
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- python
- Lĩnh vực
- authentication, backend, security
Hướng nghiên cứu
Bắt đầu bằng cách đọc các dòng 63-68 trong src/asfquart/generics.py và entry point setup_oauth() để theo dõi cách URL callback được tạo từ quart.request.host_url. Triển khai cấu hình OAUTH_CALLBACK_HOST cố định và cập nhật luồng OAuth, các test, tài liệu và hướng dẫn deployment được nêu trong các tiêu chí nghiệm thu. Công việc được hoàn tất khi header Host không thể thay đổi URL callback và URL cố định được bao phủ bởi các unit test và integration test.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Issue: FINDING-164 - Dynamic OAuth Callback URL Constructed from Host Header
Labels: bug, security, priority:medium, asvs-level:L1
ASVS Level(s): L1
Description:
Summary
The OAuth redirect_uri parameter is dynamically derived from the HTTP Host header (callback_host = quart.request.host_url.replace('http://', 'https://')). This violates ASVS 10.4.1 because: (1) The client sends a variable callback URL instead of a fixed, pre-registered one; (2) If the deployment violates the documented ProxyPreserveHost On assumption, an attacker controlling the Host header can craft an arbitrary callback URL; (3) If the authorization server uses pattern-based or prefix matching instead of exact string comparison, the authorization code could be redirected to an attacker-controlled domain. This could lead to authorization code theft and account takeover, contingent on AS redirect URI validation strictness and deployment configuration.
Details
The vulnerability exists in src/asfquart/generics.py lines 63-68, where the callback URL is constructed from quart.request.host_url. This creates a dynamic redirect URI that varies based on the incoming request's Host header.
Recommended Remediation
Pre-configure the callback host using an environment variable instead of deriving it from the request:
import os
import urllib.parse
# In configuration
CALLBACK_HOST = os.environ.get('OAUTH_CALLBACK_HOST', 'https://myapp.apache.org')
# Modify setup_oauth() to accept callback_host parameter
def setup_oauth(app, uri: str, callback_host: str):
@app.route(uri)
async def oauth_endpoint():
state = secrets.token_urlsafe(16)
# Use fixed callback_host instead of request.host_url
callback_url = urllib.parse.urljoin(callback_host, f'{uri}?state={state}')
# ... rest of implementation
This ensures the callback URL is fixed and can be pre-registered with exact string matching at the Authorization Server.
Acceptance Criteria
-
OAUTH_CALLBACK_HOSTenvironment variable added to configuration -
setup_oauth()modified to acceptcallback_hostparameter - Callback URL constructed from fixed configuration instead of Host header
- Unit tests verify callback URL is not affected by Host header
- Integration tests verify OAuth flow with fixed callback URL
- Documentation updated with required environment variable
- Deployment guide updated to emphasize fixed callback URL registration
References
- Source reports: L1:10.4.1.md
- Related findings: FINDING-273
- ASVS sections: 10.4.1
- CWE: CWE-601
Priority
Medium
- Ngôn ngữ chính
- Python
- Star
- 7
- Fork
- 14
- Merge trung bình
- 11 giờ 58 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/infrastructure-asfquart
-
Set connection and total timeouts for OAuth token exchangeCó thể đã có người làm @AnKiT-GaRG2 đã nhận 1 ngày trước. Đang mởbug priority
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/infrastructure-asfquart#130 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Document external service endpoints and failure behaviorCó thể đã có người làm @AnKiT-GaRG2 đã nhận 5 ngày trước. Đang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/infrastructure-asfquart#129 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Document OAuth callback consistency rulesCó thể đã có người làm @Marrshal15 đã nhận 23 ngày trước. Đang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
apache/infrastructure-asfquart#126 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ASVS priority
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
apache/infrastructure-asfquart#85 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Triage and track asfquart issuesCó thể đã có người làm @sbp đã nhận 21 ngày trước. Đang mở
apache/infrastructure-asfquart#134 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/infrastructure-asfquart
Issue tương tự
-
component:benchmark
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
agentic-os-org/ANOLISA#9177 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
distrochooser/distrochooser#520 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Status: Needs confirmation Status: Needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Published Docker images lack the redis extra: HEADROOM_COMPRESS_SESSION_STORE stops startupCó thể đã có người làm @AlessandroSpallina đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
headroomlabs-ai/headroom#4513 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
codespell-project/codespell#4060 ·
Maintainer thường phản hồi trong vòng 1 ngày