Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

fetch_page web tool performs unrestricted server-side HTTP fetch of agent-supplied URLs (SSRF)

Đang mở
#1,018 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@SiyuanChenToDo đang làm issue này rồi.

Từ ngày 19/10/2026.

  • #1020 của @SiyuanChenToDo — đang mở

Đá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
45/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ệ
python
Lĩnh vực
backend, security

Hướng nghiên cứu

Start in ms_agent/tools/jina_reader.py by reading _is_direct_http_allowed() and the direct fetch and redirect handling described in the issue; then trace how ms_agent/tools/search/websearch_tool.py exposes fetch_page. Identify how destination addresses and redirect targets are validated, and define completion by preventing requests to internal or metadata endpoints while preserving allowed public page fetches. The issue provides no reproduction steps or named tests, so first locate the relevant tests.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Affected version/commit: modelscope/ms-agent @ a56afcc73f0049ba822af9569fd413a2e90677eb (branch main)

Summary

The fetch_page tool exposed by WebSearchTool (ms_agent/tools/search/websearch_tool.py) takes an arbitrary url string argument directly from the LLM/agent tool-call and fetches it server-side with no restriction on destination host or IP range. The only validation performed, _is_direct_http_allowed() in ms_agent/tools/jina_reader.py, checks that the URL scheme is http/https and that netloc is non-empty - it does not block loopback, link-local, private, or cloud-metadata address ranges, and does not check redirect destinations. This allows the agent process to be used to reach internal network services and cloud instance-metadata endpoints, with the response body returned into the agent's conversation context.

Details

WebSearchTool._get_tools_inner() registers a fetch_page tool whose only parameter is a free-form url string, described as "Fetch and parse a single web page by URL." call_tool() routes fetch_page calls to fetch_page(**tool_args), which flows to _fetch_content_sync(url) -> self._content_fetcher.fetch(url) -> fetch_single_text_with_meta(url, config) in jina_reader.py. That function tries the external Jina Reader service first, then falls back to a direct in-process fetch via _fetch_direct_http_pair(), gated only by:

def _is_direct_http_allowed(url: str) -> bool:
    try:
        parsed = urlparse(url)
        if parsed.scheme not in ('http', 'https'):
            return False
        if not parsed.netloc:
            return False
        return True
    except Exception:
        return False

urlopen() is then called directly on the supplied URL from within the ms-agent process. There is no denylist/allowlist for 127.0.0.1, 169.254.169.254 (cloud metadata), RFC1918 ranges, link-local IPv6, or any other internal address, and no check on redirect targets a server could issue after the initial request is accepted. Because the url argument is model-controlled - chosen directly by the LLM in response to a user prompt, or indirectly steered by content encountered during web search/browsing (prompt injection from a fetched page) - this gives any content the agent processes a path to make the host perform arbitrary internal HTTP requests and have the response text returned into the agent's own context.

Steps To Reproduce

(available upon request)

Impact

Server-side request forgery from the agent host. An attacker who can influence the agent's tool-call arguments (directly as a user, or indirectly via content the agent reads during browsing/search, i.e. prompt injection) can cause the host running ms-agent to issue HTTP requests to internal-only services and cloud metadata endpoints and have the response content returned into the conversation, potentially leaking credentials/tokens or enabling further internal pivoting.

Ngôn ngữ chính
Python
Star
4.4k
Fork
532
Merge trung bình
18 giờ 26 phút
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của modelscope/ms-agent

Tất cả issue của modelscope/ms-agent

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.