Open Redirect via Backslash Normalization in OAuth Redirect URI Validation
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 74/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, security
Hướng nghiên cứu
Bắt đầu trong src/asfquart/generics.py tại các vị trí xác thực và sử dụng redirect của login và logout, sau đó xem lại tests/generics.py quanh các dòng 53-58. Chạy các kiểm thử generics hiện có và bổ sung coverage cho dấu gạch chéo ngược dạng thô và được mã hóa URL trong cả hai luồng. Hoàn tất khi các redirect dựa trên dấu gạch chéo ngược bị từ chối, trong khi các redirect tương đối hợp lệ vẫn tiếp tục hoạt động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Issue: FINDING-114 - Open Redirect via Backslash Normalization in OAuth Redirect URI Validation
Labels: bug, security, priority:medium, asvs-level:L2
ASVS Level(s): [L2-only]
Description:
Summary
The OAuth redirect URI validation in the login and logout flows rejects URIs that don't start with '/' or that start with '//', but does not account for the WHATWG URL Standard backslash normalization. Per the spec (§4.4 'relative slash' state), when a URL parser encounters '' after an initial '/' in a special URL scheme (http/https), it treats '' identically to '/'. Thus '' acts as a path separator, and '/\evil.com' is parsed as '//evil.com', a protocol-relative URL pointing to evil.com. The validation passes '/\evil.com' because it starts with '/' and doesn't start with '//', but browsers normalize this to '//evil.com', causing an open redirect.
Details
Affected locations:
src/asfquart/generics.pylines 48-53: Login redirect validationsrc/asfquart/generics.pylines 69-75: Login redirect usagesrc/asfquart/generics.pylines 113-119: Logout redirect validationsrc/asfquart/generics.pylines 164-172: Logout redirect usagetests/generics.pylines 53-58: Tests don't cover backslash case
Impact includes post-authentication phishing where users complete OAuth login and are then redirected to an attacker's site mimicking the application.
Recommended Remediation
Add backslash normalization check to redirect URI validation. Create a helper function _is_safe_redirect:
def _is_safe_redirect(uri: str) -> bool:
"""Validate redirect URI is safe (relative, same-origin only)."""
if not uri.startswith("/"):
return False
if uri.startswith("//"):
return False
# Block backslash and URL-encoded backslash
if "\\" in uri or "%5c" in uri.lower() or "%5C" in uri:
return False
# Verify no netloc present after parsing
parsed = urllib.parse.urlsplit(uri)
if parsed.netloc:
return False
return True
Add test cases in tests/generics.py to verify rejection of '/%5Cevil.com' and '/\evil.com' for both login and logout flows.
Acceptance Criteria
- Backslash-based open redirects are blocked
- URL-encoded backslashes are blocked
- Test cases verify backslash rejection
- Both login and logout flows are protected
- Unit test verifying the fix
References
- Source reports: L2:3.5.4.md
- Related findings: None
- ASVS sections: 3.5.4
Priority
Medium
- Ngôn ngữ chính
- Python
- Star
- 7
- Fork
- 14
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
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
-
bug priority
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Document external service endpoints and failure behaviorCó thể đã có người làm @AnKiT-GaRG2 đã nhận 3 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
-
Document OAuth callback consistency rulesCó thể đã có người làm @Marrshal15 đã nhận 21 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 ·
-
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 ·
-
Triage and track asfquart issuesCó thể đã có người làm @sbp đã nhận 20 ngày trước. Đang mở
apache/infrastructure-asfquart#134 · 1 người được giao ·
Tất cả issue của apache/infrastructure-asfquart
Issue tương tự
-
The changelog workflow excludes otelbot but not dependabot, so every Dependabot pull request fails the changelog checkCó thể đã có người làm @ocelotl đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
open-telemetry/opentelemetry-python#5825 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
cuga-project/cuga-agent#1020 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
microsoft/playwright#43640 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
stac-utils/stac-fastapi-elasticsearch-opensearch#965 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày