Описание
@dynatrace-oss/dynatrace-mcp-server has a workflow template injection via create_workflow_for_notification
Summary
A template injection vulnerability in the create_workflow_for_notification tool lets a caller embed Jinja2 expressions that the Dynatrace workflow engine evaluates at runtime, exfiltrating event data to attacker-controlled destinations through a workflow that persists in the tenant after the MCP session ends.
Details
The create_workflow_for_notification tool interpolates three caller-supplied parameters (teamName, problemType, channel) directly into a Dynatrace Workflow definition. Dynatrace Workflows use Jinja2 templating: per the official documentation, {{ ... }} expressions in action inputs are evaluated at workflow runtime for every action except Run Javascript (which is carved out specifically to avoid code injection). A caller can therefore supply, for example, teamName = "{{ event() }}" and have the workflow engine evaluate that expression at runtime, serialising the full event object into the message body delivered to the Slack channel.
The vulnerable code is in src/capabilities/create-workflow-for-problem-notification.ts, lines 82-99:
The action used is dynatrace.slack:slack-send-message, which is not in the documented Jinja-expression exception list. Its inputs are evaluated at workflow runtime.
The schema in src/index.ts:1052-1070 registers teamName, problemType, and channel as z.string().optional() with no pattern validation. The isPrivate parameter has .default(false), so created workflows are visible tenant-wide unless the caller explicitly sets it.
The approval prompt at src/index.ts:1069-1072:
Renders {{ event() }} literally to the operator with no indication that it will be templated, and does not surface the workflow's visibility.
The workflow is persistent: it remains in the tenant after the MCP session ends, after the operator's MCP credentials are revoked, and after the MCP server is uninstalled. It fires on every matching problem until manually deleted from the Workflows app. The channel parameter is uniquely dangerous because it is interpolated inside an existing {{ "..." }} expression context - close the string with " and you can run arbitrary Jinja expressions in the destination field itself.
PoC
Tested end-to-end against a real Dynatrace tenant. The MCP server was run in stdio mode with the operator's Platform Token. A tools/call create_workflow_for_notification was sent with:
The operator approved the prompt (which read: "Create a workflow for notifying team {{ event() }} via #mcp-sec-poc about ERROR problems"). The MCP returned a workflow ID. Fetching the stored workflow body via the Dynatrace Automation API (GET /platform/automation/v1/workflows/<id>) showed the injected expression stored verbatim:
The workflow was then triggered manually via the "Run workflow" feature in the Dynatrace Workflows app, with a synthetic event payload {"display_id":"P-123","event.status":"OPEN","event.id":"abc-123"}. The execution log for the send_notification task shows the workflow engine evaluated the injected expressions at runtime. The "Input" tab for the executed action contains:
The injected {{ event() }} resolved to the actual event object before the Slack action was called. The Slack action then failed only because the workflow uses a hardcoded placeholder connectionId: 'slack-connection-id' that does not resolve to any real connection. If a real Slack connector had been configured, the message would have been delivered with the serialized event data in place of {{ event() }}.
This is end-to-end confirmation of the Jinja-evaluation chain.
Impact
A workflow created with a malicious template payload acts as a persistent exfiltration channel:
- It fires on every matching problem indefinitely.
- The injected template is evaluated at runtime and resolves to whatever the Jinja function returns (
event()gives the full event object,environment()gives tenant metadata, plus other available functions per the Dynatrace Workflows documentation). - The resolved output is delivered to a destination the attacker controls (the
channelparameter is also templated, and is even more dangerous because it is interpolated inside an existing{{ "..." }}expression context). - The workflow persists in the tenant after the MCP session, operator credentials, and MCP server are gone.
- With
isPrivate=false(the default), the workflow is visible to all tenant users.
Exploitation requires either prompt injection (an LLM under the MCP server's control is reading attacker-controlled data and follows an injection that calls create_workflow_for_notification with the malicious arguments) or operator carelessness (the approval prompt shows the raw team name literal and the operator clicks Approve without recognising {{ event() }} as a template fragment). Both are realistic in practice.
Ссылки
- https://github.com/dynatrace-oss/dynatrace-mcp/security/advisories/GHSA-xrmj-5g4g-8987
- https://github.com/dynatrace-oss/dynatrace-mcp/pull/547
- https://github.com/dynatrace-oss/dynatrace-mcp/commit/64dfcb1095823d0fb43013635446288a6ff60e29
- https://github.com/dynatrace-oss/dynatrace-mcp/releases/tag/v2.0.0
Пакеты
@dynatrace-oss/dynatrace-mcp-server
< 2.0.0
2.0.0
4.2 Medium
CVSS3
Дефекты
4.2 Medium
CVSS3