Back to skill

Security audit

Fda Guideline Search

Security checks for vulnerabilities and agentic risk

Overview

The skill needs Review because it presents fabricated FDA-looking guidance records as search results and allows broad file overwrites through its output option.

Treat this as a demo, not a trustworthy FDA research tool. Do not rely on its results for regulatory, clinical, legal, or submission decisions unless the implementation is changed to retrieve and verify real FDA/ICH documents, clearly label any mock mode, and restrict file outputs to a safe workspace directory.

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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/main.py:385
Finding

Unrestricted Output Path Allows Arbitrary File Overwrite

Content
View full analysis

Vulnerability Details

File Location: scripts/main.py, lines 336-339 and 385-387
Vulnerability Type: Unrestricted file write and overwrite
Risk Level: Medium

Vulnerable Code

python
parser.add_argument(
    "--output", "-o",
    help="Output file path (JSON format)"
)
python
if args.output:
    with open(args.output, 'w', encoding='utf-8') as f:
        f.write(json_output)

Technical Analysis

The user-controlled --output value is passed directly to open() in write mode without path validation or confinement. The implementation does not:

  • Restrict output to the project workspace or another approved directory.
  • Resolve and verify the canonical destination path.
  • Reject absolute paths or ../ traversal.
  • detect symbolic-link destinations.
  • Require explicit authorization before overwriting an existing file.
  • Use exclusive creation or another overwrite-resistant mechanism.

Opening the destination with mode w immediately truncates an existing file. Consequently, anyone who can control the command-line arguments can replace any file writable by the skill process.

This also conflicts with the security control documented in SKILL.md, which identifies restriction of output to the workspace as a required safeguard.

Attack Path

  1. An attacker gains control over, or influences, the arguments used to invoke the skill.
  2. The attacker supplies an absolute path, traversal path, or symlink-backed path through --output, such as a writable application configuration file.
  3. The script generates its JSON result.
  4. open(args.output, 'w') follows the supplied path and truncates the destination.
  5. The generated JSON replaces the destination file, causing data loss or configuration corruption.

Impact Assessment

The vulnerability grants file-write and file-overwrite capability within the operating-system permissions of the process. It does not independently elevate privileges, but its scope increases if the s ...[truncated 554 chars]

Remediation
View remediation

Remediation Suggestions

  1. Define a dedicated output directory under the project workspace.
  2. Resolve both the approved directory and requested destination with Path.resolve().
  3. Verify that the resolved destination remains beneath the approved directory.
  4. Reject absolute paths, traversal attempts, and symbolic-link destinations.
  5. Use exclusive creation mode (x) by default to prevent unintended overwrites.
  6. If overwrite support is required, expose an explicit --force option and validate the destination before replacing it.
  7. Write through a securely created temporary file in the destination directory and use an atomic rename.
  8. Run the skill with minimum filesystem permissions.

Example containment pattern:

python
OUTPUT_DIR = (Path(__file__).parent.parent / "outputs").resolve()
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)

requested = Path(args.output)
if requested.is_absolute():
    raise ValueError("Absolute output paths are not permitted")

destination = (OUTPUT_DIR / requested).resolve()
if OUTPUT_DIR not in destination.parents:
    raise ValueError("Output path must remain inside the output directory")
if destination.exists():
    raise FileExistsError("Refusing to overwrite an existing file")

with destination.open("x", encoding="utf-8") as f:
    f.write(json_output)

other

Warning
Location
scripts/main.py:169
Finding

Fabricated Guidance Records Are Presented as FDA Search Results

Content
View full analysis

Vulnerability Details

File Location: scripts/main.py, lines 169-170 and 208-221
Vulnerability Type: Regulatory data integrity failure and misleading output
Risk Level: Medium

Vulnerable Code

python
# Mock data for demonstration (in production, this would be real FDA data)
# Since FDA doesn't have a simple public API, we provide sample data structure

sample_guidelines = []
python
regular_guidelines = [
    {
        "title": f"Clinical Trial Considerations for {area.title()} Drug Development",
        "document_number": f"FDA-{datetime.now().year}-D-{1000 + i:04d}",
        "issue_date": f"{datetime.now().year - i % 3}-{(i % 12) + 1:02d}-15",
        "type": "Final" if i % 3 != 0 else "Draft",
        "therapeutic_area": area.title(),
        "pdf_url": f"{FDA_BASE_URL}/media/{12345 + i}/download",
        "keywords_matched": keywords[:2] if keywords else [area],
    }
    for i in range(min(remaining, 8))
]
sample_guidelines.extend(regular_guidelines)

Technical Analysis

The principal search flow does not retrieve actual FDA guidance records. Although the module contains a fetch_fda_guidelines_page() function, search_fda_guidelines() does not invoke it. Instead, it synthesizes plausible titles, document identifiers, issue dates, and FDA-looking download URLs.

The generated records are returned under a source identified as the FDA CDER/CBER Guidance Documents collection and are not marked as mock data in the output. This behavior conflicts with the skill's advertised purpose of searching and retrieving FDA guidance.

Because the output is structured and contains authoritative-looking document numbers and URLs, users and downstream automation may treat fabricated records as verified regulatory information. The --download option compounds the problem by attempting to request generated URLs as though they corresponded to the synthesized metadata.

Attack Path

  1. A user or automated agent invokes the skill to l ...[truncated 1575 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove fabricated records from the production search path.
  2. Connect search_fda_guidelines() to verified FDA and ICH sources.
  3. Parse actual metadata and preserve canonical source URLs.
  4. Validate document identifiers, dates, titles, and download URLs against authoritative pages before returning them.
  5. Fail closed when live retrieval is unavailable rather than silently generating plausible results.
  6. If demonstration mode is necessary:
    • Require an explicit --demo option.
    • Add a top-level "mock_data": true field.
    • Clearly prefix every sample record and source label with “Demonstration only.”
    • Disable downloads for generated records.
  7. Add automated tests ensuring that production results include verifiable source provenance.
  8. Update SKILL.md so the documented implementation and limitations accurately match runtime behavior.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (6)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The documented behavior diverges from the declared purpose by downloading remote PDFs to local storage and apparently relying on mock/sample results rather than guaranteed real FDA retrieval. Behavior mismatches are dangerous because they undermine user consent and reviewer expectations, and hidden download/write behavior expands the attack surface for unwanted content ingestion, storage abuse, or misleading regulatory outputs.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill advertises FDA guideline search/retrieval, but the primary execution path fabricates guidance records instead of obtaining authoritative FDA data. In a regulatory/compliance context, users may rely on these outputs for clinical, legal, or submission decisions, creating a serious integrity risk through misinformation rather than code execution.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill advertises network access and local file caching but does not declare any explicit tool scope such as permissions or allowed-tools. This creates an authorization gap where an agent may invoke file-write and network-capable components without clear least-privilege boundaries or reviewer-visible constraints.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The trigger conditions are broad enough to activate on many general regulatory-information requests, increasing the chance this higher-risk network/file-writing skill is selected when a simpler informational response would suffice. Over-broad routing can expose users to unnecessary external access, local writes, and misleading outputs in contexts not requiring this capability.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill documents downloading and caching PDFs locally but does not present a clear user-facing warning that invoking it may write files to disk. Undisclosed file writes are risky because they can surprise users, consume storage, retain untrusted remote content, and create persistence of externally sourced documents.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The comments acknowledge that real FDA/API integration is not implemented, yet the active code still returns plausible-looking mock guidance objects. This discrepancy increases the likelihood that operators or downstream systems will mistake fabricated compliance content for real regulatory guidance.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.