Back to skill

Security audit

Phy Openapi Sec Audit

Security checks for vulnerabilities and agentic risk

Overview

This OpenAPI scanner is mostly purpose-aligned, but its URL scanning can fetch arbitrary HTTP/HTTPS locations from the agent's environment without safeguards or a clear warning.

Review this before installing if you will scan URLs from a CI runner, cloud VM, corporate network, or agent environment with access to internal services. Prefer local spec files, avoid scanning untrusted URLs, and use network egress controls or a sandbox if remote URL scanning is needed. Install PyYAML in an isolated environment and pin dependencies where reproducibility matters.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:258
Finding
Unrestricted Remote Specification Fetching Enables Server-Side Request Forgery<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 258–266 **Vulnerability Type**: Server-Side Request Forgery (SSRF) and unrestricted outbound network access **Risk Level**: High ### Vulnerable Code ```python if source.startswith("http://") or source.startswith("https://"): try: import urllib.request with urllib.request.urlopen(source, timeout=10) as r: content = r.read().decode() except Exception as e: sys.exit(f"Cannot fetch spec from URL: {e}") ``` ### Technical Analysis The scanner accepts an arbitrary user-controlled HTTP or HTTPS URL and passes it directly to `urllib.request.urlopen`. It does not validate the destination hostname, resolved IP address, port, URL credentials, or redirect target. Although fetching public OpenAPI specifications is part of the declared functionality, unrestricted access to arbitrary network locations exceeds the minimum privileges necessary. The implementation does not: - Require HTTPS. - Restrict requests to public Internet addresses. - Block loopback, private, link-local, reserved, or cloud metadata addresses. - Revalidate destinations after DNS resolution or HTTP redirects. - Restrict destination ports. - Impose a maximum response-body size. - Reject URLs containing embedded credentials or sensitive query parameters. The ten-second timeout limits request duration but does not prevent SSRF or memory exhaustion from a large response delivered within that period. Because redirects are followed by the standard URL handler, an initially public URL may redirect to an internal address. ### Attack Path 1. An attacker supplies a scanner input such as a loopback URL, private-network URL, cloud metadata URL, or attacker-controlled public redirect. 2. The Skill invokes `load_spec` with that URL. 3. `urllib.request.urlopen` connects from the agent's execution environment without destination validation. 4. The request reaches services that may be inaccessible to th ...[truncated 1361 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Make local-file scanning the default and require an explicit option such as `--allow-remote` before enabling network access. 2. Permit only HTTPS unless the user explicitly authorizes an exceptional development use case. 3. Parse URLs with `urllib.parse.urlsplit` and reject: - Embedded usernames or passwords. - Unsupported schemes. - Empty or malformed hostnames. - Unexpected destination ports. 4. Resolve the hostname before connecting and reject every address classified by `ipaddress` as loopback, private, link-local, multicast, reserved, or unspecified. 5. Explicitly block known metadata destinations, including `169.254.169.254` and equivalent IPv6 addresses. 6. Disable automatic redirects or validate the scheme, hostname, resolved addresses, and port after every redirect. 7. Protect against DNS rebinding by connecting only to the validated resolved address while preserving safe TLS hostname verification. 8. Use an allowlist when remote sources are expected to come from known registries or domains. 9. Stream the response in bounded chunks and enforce a conservative maximum size before parsing it. 10. Set connection and read timeouts and limit the number of redirects. 11. Avoid printing complete URLs when they may contain sensitive query parameters; redact credentials and token-like values. 12. Run remote fetching in a sandbox with restricted egress and no access to metadata endpoints or internal networks. ]]>

T08 · Insecure Dependencies

Warning
Location
SKILL.md:153
Finding
Unpinned PyYAML Installation Creates a Mutable Supply-Chain Dependency<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 153–157 and 280–283 **Vulnerability Type**: Unpinned third-party dependency installation **Risk Level**: Medium ### Vulnerable Code Installation guidance: ```bash # Optional: YAML support (JSON specs work without it) pip install pyyaml ``` Runtime error guidance: ```python except ImportError: sys.exit( "PyYAML required for YAML specs. Install: pip install pyyaml\n" "Or convert your spec to JSON first: python -c \"import yaml,json; print(json.dumps(yaml.safe_load(open('spec.yaml').read()), indent=2))\" > spec.json" ) ``` ### Technical Analysis The Skill directs users to install `pyyaml` without a version constraint, lock file, integrity hash, or approved package-index configuration. Consequently, installation resolves to whatever release and distribution artifact the configured package index serves at installation time. The implementation correctly uses `yaml.safe_load`, which reduces unsafe YAML object-deserialization risk. The finding concerns dependency acquisition rather than the parser API. An unpinned installation is mutable and cannot be reliably reproduced or verified against the version reviewed during the Skill audit. This does not demonstrate that the current PyYAML package is malicious. The risk arises if an upstream release, package repository, mirror, DNS path, or local pip configuration becomes compromised or serves an incompatible artifact. ### Attack Path 1. A user attempts to scan a YAML OpenAPI document without PyYAML installed. 2. The scanner instructs the user to run `pip install pyyaml`. 3. Pip queries its configured package index and selects the latest matching artifact because no version or hash is specified. 4. A compromised index, mirror, upstream release, or package-resolution configuration supplies a malicious or unreviewed distribution. 5. Package installation code executes with the privileges of the user or automation environmen ...[truncated 933 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin PyYAML to a reviewed version or narrowly controlled compatible range. 2. Provide a lock file or requirements file containing cryptographic hashes, for example: ```text PyYAML==<reviewed-version> \ --hash=sha256:<verified-distribution-hash> ``` 3. Install with hash enforcement: ```bash python -m pip install --require-hashes -r requirements.txt ``` 4. Review and update the pinned version through a controlled dependency-update process. 5. Configure CI and production environments to use an approved package index or internal artifact mirror. 6. Prefer isolated virtual environments and avoid administrator-level installation. 7. Generate and retain a software bill of materials for released versions. 8. Add dependency vulnerability and provenance checks to CI. 9. Update both the installation section and runtime error message so they reference the pinned requirements file rather than an unconstrained `pip install pyyaml` command. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (4)

Tool Parameter Abuse

High
Category
Tool Misuse
Content
============================================================

── CRITICAL (1) ────────────────────────────────────────────
🔴 OS008 [CRITICAL] DELETE /admin/users/{id}
   Admin/internal path '/admin/users/{id}' has no authentication requirement.
   CWE: CWE-285: Improper Authorization
   Fix: Add strict authentication + scope requirement to this endpoint.
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Unbounded Output

Medium
Category
Output Handling
Content
### OS008 — Admin/Internal Path Without Auth (CRITICAL)
Flags paths matching `/admin`, `/internal`, `/debug`, `/_internal`, `/_debug`, `/management`, `/actuator`, `/metrics`, `/health/detail`, `/swagger-ui`, `/api-docs` that have no security requirement. These are the most exploited endpoints in API breaches.

### OS009 — File Upload Without Size Limit
`multipart/form-data` and `application/octet-stream` endpoints where binary fields lack `maxLength` or `maximum`. An unbound upload endpoint is a trivial denial-of-service vector.

### OS010 — Wildcard OAuth Scope
Confidence
75% confidence
Finding
Output size or generation rate is not bounded. Unbounded output enables denial-of-service through resource exhaustion, log flooding, or context-window stuffing.

Unrestricted Tool Access

Medium
Category
Excessive Agency
Content
check_id="OS010",
                    severity="HIGH",
                    path=f"securitySchemes/{name}/scopes/{scope}",
                    message=f"OAuth scope '{scope}' is overly broad. A compromised client with this scope has unrestricted API access.",
                    cwe="CWE-272: Least Privilege Violation",
                    fix="Replace wildcard scopes with specific resource:action scopes (e.g. 'users:read', 'orders:write'). Never grant * or bare admin scope.",
                ))
Confidence
85% confidence
Finding
Skill grants unrestricted tool access without appropriate constraints. An agent with unfettered tool access can perform arbitrary actions including file modification, network requests, and code execution.

Missing User Warnings

Low
Confidence
92% confidence
Finding
The skill explicitly supports fetching OpenAPI specs from arbitrary HTTP/HTTPS URLs, which causes an outbound network request to attacker-controlled destinations. While this is expected functionality for a scanner, failing to clearly warn users about the network contact can enable unintended requests to internal, sensitive, or monitored endpoints and may expose requester metadata.

Static analysis

No suspicious patterns detected.