Skip to content

CKAN MCP Server: MQA server allowlist bypass via unanchored regex (`isValidMqaServer`)

Moderate severity GitHub Reviewed Published Jul 9, 2026 in ondata/ckan-mcp-server • Updated Sep 2, 2026

Package

npm @aborruso/ckan-mcp-server (npm)

Affected versions

< 0.4.112

Patched versions

0.4.112

Description

Summary

The ckan_get_mqa_quality and ckan_get_mqa_quality_details tools restrict their server_url argument to dati.gov.it via a regular expression. The regex is anchored only at the start and places no boundary after the host, so any URL whose host merely begins with dati.gov.it — or that uses dati.gov.it as URL userinfo before an @ — passes validation while actually targeting an attacker-controlled host.

Affected code

// src/tools/quality.ts
const ALLOWED_SERVER_PATTERNS = [
  /^https?:\/\/(www\.)?dati\.gov\.it/i        // <-- no end anchor / host boundary
];
export function isValidMqaServer(serverUrl: string): boolean {
  return ALLOWED_SERVER_PATTERNS.some(pattern => pattern.test(serverUrl));
}

All of the following return true:

URL Real host
https://dati.gov.it.attacker.com/x dati.gov.it.attacker.com (attacker)
http://dati.gov.it.evil.example/api dati.gov.it.evil.example (attacker)
https://dati.gov.it@attacker.com/x attacker.com (userinfo trick)

After passing this check, server_url flows into getMqaQuality/getMqaQualityDetails, which call makeCkanRequest(serverUrl, "package_show", { id }). The server therefore issues a request to the attacker-controlled host and returns its (parsed) response to the caller.

Impact

  • The intended "dati.gov.it only" trust boundary for the MQA tools is defeated; they can be driven against arbitrary external hosts.
  • The attacker host receives the request (including the dataset_id) and controls the response body that is surfaced back to the model/user — enabling response spoofing and, in an agentic setting, indirect prompt-injection content delivered under the guise of a trusted-portal tool.
  • Contributes to SSRF surface: while makeCkanRequest blocks private/internal IPs, this bypass removes the domain restriction that the code intends to enforce for these tools.

The @-userinfo variant is the most severe form because validation passes on a string whose actual host is fully attacker-chosen.

Proof of concept

poc/mqa-allowlist-poc.mjs runs the verbatim regex over benign and malicious URLs:

accepted  expected_legit  url
true      true            https://dati.gov.it/opendata          <- legit
true      false           https://dati.gov.it.attacker.com/x    <- BYPASS
true      false           http://dati.gov.it.evil.example/api   <- BYPASS
true      false           https://dati.gov.it@attacker.com/x    <- BYPASS

Remediation

Validate the parsed host, not the raw string. For example:

function isValidMqaServer(serverUrl) {
  let u; try { u = new URL(serverUrl); } catch { return false; }
  if (u.protocol !== "https:") return false;
  const h = u.hostname.toLowerCase();
  return h === "dati.gov.it" || h === "www.dati.gov.it";
  // or: h === "dati.gov.it" || h.endsWith(".dati.gov.it")
}

Anchoring the regex end-to-end (/^https:\/\/(www\.)?dati\.gov\.it(\/|$)/i) also closes the suffix trick, but URL-parsing + exact host comparison is the robust fix and also neutralizes the @-userinfo variant.

References

@aborruso aborruso published to ondata/ckan-mcp-server Jul 9, 2026
Published by the National Vulnerability Database Aug 14, 2026
Published to the GitHub Advisory Database Sep 2, 2026
Reviewed Sep 2, 2026
Last updated Sep 2, 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
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
Low
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:L/PR:N/UI:N/S:U/C:L/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.
(13th percentile)

Weaknesses

Improper Input Validation

The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. Learn more on MITRE.

Permissive Regular Expression

The product uses a regular expression that does not sufficiently restrict the set of allowed values. Learn more on MITRE.

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-73845

GHSA ID

GHSA-83x6-42hr-jc76

Credits

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