gpt-researcher
- Type
- MCP server
- Scanned
- Nov 17, 2026
- Version
- ddd4db36208d
- Files read
- 819
GPT Researcher is an AI tool...
Findings
-
CriticalDrive-by and network remote code execution via unauthenticated WebSocket MCP configuration
backend/server/server_utils.py:434
The /ws WebSocket endpoint accepts connections in websocket_manager.py without authentication or an Origin header check (which FastAPI CORSMiddleware does not enforce on WebSockets). When a client sends a start message, extract_command_data reads client-supplied mcp_configs and passes them to MCPClientManager in gpt_researcher/mcp/client.py, which spawns config['command'] with config['args'] and config['env'] as a local stdio subprocess. Although SECURITY.md notes that the server lacks authentication and should only be run locally, any malicious website the user visits in their browser while the server is running on localhost:8000 (or anyone on the LAN via 0.0.0.0:8000) can open ws://localhost:8000/ws and immediately run arbitrary OS commands.
Fix: Validate the WebSocket Origin header against a strict local allowlist, require authentication on /ws, and disable client-supplied stdio MCP command/args over the network so MCP servers can only be defined in trusted server-side configuration.
-
HighBackend server binds to 0.0.0.0:8000 by default with unauthenticated file and API endpoints
Running main.py (as well as backend/run_server.py and the Docker images) binds the FastAPI server to 0.0.0.0:8000 instead of 127.0.0.1, exposing unauthenticated endpoints (/report/, /api/chat, /api/reports, /upload/, /files/{filename}, and /outputs) to everyone on the local network. In addition, POST /upload/ accepts multipart/form-data (a CORS simple request that browsers send cross-origin without a preflight), letting any visited website upload documents into DOC_PATH to poison local/hybrid research, and ALLOWED_ORIGINS trusts https://app.gptr.dev with credentials by default.
Fix: Bind uvicorn to 127.0.0.1 by default, require an API key or session token on all HTTP and WebSocket routes, require a non-simple header or CSRF token on /upload/, and remove external domains from default ALLOWED_ORIGINS.
-
HighSSRF protection bypassed by unvalidated HTTP redirects during scraping and document loading
gpt_researcher/scraper/beautiful_soup/beautiful_soup.py:84
Scraper.extract_data_from_url and OnlineDocumentLoader._download_and_process call validate_url() on the initial URL to block loopback, private network, and cloud metadata addresses (such as 169.254.169.254). However, BeautifulSoupScraper (the default scraper), PyMuPDFScraper, WebBaseLoaderScraper, and OnlineDocumentLoader perform HTTP GET requests with default redirect following enabled and never validate redirect Location targets. Any public webpage returned in search results can respond with a 302 redirect to an internal service or cloud metadata endpoint, causing GPT Researcher to fetch the internal response and include it in the research context and final report.
Fix: Disable automatic redirect following (allow_redirects=False) across all HTTP clients and re-run validate_url() on each redirect Location URL before following it, while also pinning resolved public IPs at connection time.
-
HighLocal file disclosure and SSRF in PDF generation via unsanitized HTML and WeasyPrint
When generating PDF reports (enabled by default in cli.py, POST /report/, and WebSocket /ws runs), write_md_to_pdf passes the LLM-generated report Markdown through md2pdf into WeasyPrint with base_url set to the current working directory and no custom url_fetcher, after _preprocess_images_for_pdf also joins /outputs/... paths without checking for '..' traversal. Because markdown2 preserves raw HTML tags, prompt injection in a scraped webpage (or a direct unauthenticated /report/ request) that causes the report to contain tags such as <link rel='attachment' href='.env'> or internal http:// URLs makes WeasyPrint read sensitive local files like .env or internal network resources and embed them into the downloadable PDF.
Fix: Sanitize HTML before passing it to WeasyPrint, pass a custom WeasyPrint url_fetcher that rejects file:// URLs and validates http(s) URLs with validate_url(), and verify that resolved image paths stay inside the outputs/images directory.
-
HighDOM cross-site scripting (XSS) in static frontend chat responses and history panel
While addAgentResponse and writeReport sanitize untrusted Markdown/HTML with DOMPurify, addChatMessage converts AI chat responses to HTML using Showdown and assigns the result directly to messageEl.innerHTML without calling sanitizeHtml(). Similarly, renderHistoryEntries interpolates entry.prompt and download links directly into innerHTML. If a scraped source injects raw HTML/JavaScript into an AI chat reply (or a user imports a crafted history JSON file), arbitrary JavaScript executes in the user's browser on the backend origin, from where it can access reports, local files, and the /ws endpoint.
Fix: Wrap converter.makeHtml(message) in sanitizeHtml() inside addChatMessage, and build history entry DOM nodes using textContent and validated URL attributes instead of raw innerHTML interpolation.
-
MediumTLS certificate verification disabled on SSL errors in PDF scraper and WebBaseLoader scraper
gpt_researcher/scraper/pymupdf/pymupdf.py:53
PyMuPDFScraper is used by default for all .pdf links (and whenever a response resembles raw PDF bytes), and upon catching requests.exceptions.SSLError it automatically retries the download with verify=False. Likewise, WebBaseLoaderScraper unconditionally sets verify=False for all requests. An active network attacker (such as on shared Wi-Fi) can present an invalid certificate for any HTTPS PDF source to force an unverified retry and inject tampered document text or prompt injections into the research context.
Fix: Remove the verify=False retry in PyMuPDFScraper and the verify=False override in WebBaseLoaderScraper so invalid TLS certificates fail closed unless the operator explicitly opts out.
-
LowOptional Selenium browser scraper disables Chrome sandbox and opens remote debugging port
gpt_researcher/scraper/browser/browser.py:122
When SCRAPER is set to 'browser', BrowserScraper.setup_driver launches Chrome with --no-sandbox on all platforms while visiting untrusted third-party URLs from search results, disabling browser renderer isolation. On Linux, it also passes --remote-debugging-port=9222, exposing an unauthenticated Chrome DevTools debugging port on localhost while scraping.
Fix: Remove --no-sandbox (or make it an explicit container-only opt-in) and remove --remote-debugging-port=9222 so Chrome does not expose a fixed debugging listener.
-
LowDocker Compose overrides non-root image user with root while mounting host folders
Although the main Dockerfile creates a dedicated non-root user (USER gpt-researcher) for security, docker-compose.yml overrides it with 'user: root' while publishing port 8000 on all host interfaces and bind-mounting ./my-docs, ./outputs, and ./logs read-write. Users following the documented docker-compose setup therefore run the unauthenticated backend server as root inside the container with write access to host directories.
Fix: Remove 'user: root' from docker-compose.yml so the container runs as the non-root gpt-researcher user configured in the Dockerfile, and bind the published port to 127.0.0.1:8000:8000.
-
LowPath traversal via backslash in /report/{research_id} on Windows hosts
The GET /report/{research_id} endpoint builds a file path directly from the URL parameter without calling os.path.basename or sanitize_filename. On Windows hosts, URL-encoded backslashes (%5c) are passed through in research_id and treated as directory separators by os.path.join, allowing unauthenticated callers to download arbitrary .docx files outside the outputs directory.
Fix: Validate research_id with os.path.basename and verify that pathlib.Path(docx_path).resolve() is strictly inside pathlib.Path('outputs').resolve() before returning FileResponse.
-
LowAutomatic runtime pip install of unpinned packages without user confirmation
gpt_researcher/llm_provider/generic/base.py:521
Both GenericLLMProvider._check_pkg and Scraper._check_pkg automatically execute 'pip install -U <package>' at runtime if an optional provider or scraper dependency is missing. Installing unpinned latest versions from PyPI on the fly modifies the live Python environment without user approval, version constraints, or hash verification.
Fix: Raise an ImportError instructing the user which optional extra or pinned package version to install instead of invoking pip dynamically at runtime.
-
LowMCP_ALLOWED_ROOT_PATHS security setting is defined in config but never enforced
gpt_researcher/config/variables/default.py:47
DEFAULT_CONFIG and BaseConfig expose MCP_ALLOWED_ROOT_PATHS as a list of allowed root paths for local file access, but nothing in gpt_researcher/mcp/ or the rest of the codebase ever reads or enforces cfg.mcp_allowed_root_paths. An operator who sets this variable expecting GPT Researcher to restrict MCP filesystem access receives no protection.
Fix: Either enforce mcp_allowed_root_paths against MCP server arguments and tool calls before execution, or remove the unused setting so operators do not rely on an inactive control.
-
LowTerraform files pull unpinned external modules and disable ECR image scanning
terraform/ecr-setup/main.tf:19
The deployment templates under terraform/ fetch Terraform modules from an external GitHub organization (Gravity-Global) pinned only to the mutable 'main' branch, set 'scan_on_push = false' on the ECR repository, and default to hardcoded third-party AWS account IDs and Secrets Manager ARNs.
Fix: Pin Terraform module sources to an immutable commit SHA or release tag, enable 'scan_on_push = true', and remove organization-specific AWS account defaults.
