Back to skill

Security audit

CareMax Auth

Security checks for vulnerabilities and agentic risk

Overview

This skill authenticates to a health API but also gives broad medical-data read/write tools and stores or prints tokens in ways users should review before installing.

Install only if you are comfortable with this skill doing more than login: it can use CareMax tokens to read and write health data, upload and OCR medical files, download files, and delete upload sessions. Review the scripts first, avoid custom base URLs except trusted local development endpoints, and treat any command output as sensitive because it may include tokens.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (4)

T03 · Remote Payload Retrieval and Execution

Error
Location
scripts/auth-flow.sh:43
Finding

Remote API responses are interpolated into executable Python source

Content
View full analysis
/dev/null; then # 保存 credentials mkdir -p "$HOME/.caremax" python3 -c " import json from datetime import datetime, timedelta resp = json.loads('''$TOKEN_RESPONSE''') creds = { 'access_token': resp['access_token'], 'refresh_token': resp['refresh_token'], 'expires_at': (datetime.utcnow() + timedelta(seconds=resp['expires_in'])).isoformat() + 'Z', 'scope': resp['scope'], 'base_url': '$BASE_URL' } json.dump(creds, open('$CREDS_FILE', 'w'), indent=2) print(json.dumps({'status': 'authorized', 'access_token': resp['access_token'], 'base_url': '$BASE_URL'})) " ``` `scripts/refresh-token.sh:18-34`: ```bash if echo "$RESPONSE" | python3 -c "import sys,json; d=json.load(sys.stdin); assert 'access_token' in d" 2>/dev/null; then python3 -c " import json from datetime import datetime, timedelta resp = json.loads('''$RESPONSE''') creds = json.load(open('$CREDS_FILE')) creds['access_token'] = resp['access_token'] creds['expires_at'] = (datetime.utcnow() + timedelta(seconds=resp['expires_in'])).isoformat() + 'Z' json.dump(creds, open('$CREDS_FILE', 'w'), indent=2) print(json.dumps({ 'status': 'refreshed', 'access_token': resp['access_token'], 'base_url': creds.get('base_url', 'https://api.caremax.ai') })) " ``` ### Technical Analysis Both scripts retrieve JSON from a remote endpoint and first confirm that the response parses as JSON and contains an `access_token`. They subsequently interpolate the original, untrusted response directly into the source text passed to `python3 -c`. JSON validation does not make this interpolation safe. A valid JS ...[truncated 2276 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/auth-flow.sh:44
Finding

OAuth credentials are stored without explicit restrictive permissions

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/check-token.sh:25
Finding

Authentication scripts expose raw access and refresh tokens through standard output

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:14
Finding

Unrestricted custom base URLs can receive credentials and sensitive medical data over untrusted transports

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
Findings (61)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

File upload workflows are unrelated to core authentication but are documented inside this auth skill. In practice, this can cause the agent to access and transmit local medical files under a skill that users and routers may trust as merely establishing login.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

File upload workflows are unrelated to core authentication but are documented inside this auth skill. In practice, this can cause the agent to access and transmit local medical files under a skill that users and routers may trust as merely establishing login.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

File upload workflows are unrelated to core authentication but are documented inside this auth skill. In practice, this can cause the agent to access and transmit local medical files under a skill that users and routers may trust as merely establishing login.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

File upload workflows are unrelated to core authentication but are documented inside this auth skill. In practice, this can cause the agent to access and transmit local medical files under a skill that users and routers may trust as merely establishing login.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

File upload workflows are unrelated to core authentication but are documented inside this auth skill. In practice, this can cause the agent to access and transmit local medical files under a skill that users and routers may trust as merely establishing login.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

File upload workflows are unrelated to core authentication but are documented inside this auth skill. In practice, this can cause the agent to access and transmit local medical files under a skill that users and routers may trust as merely establishing login.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

File upload workflows are unrelated to core authentication but are documented inside this auth skill. In practice, this can cause the agent to access and transmit local medical files under a skill that users and routers may trust as merely establishing login.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

File upload workflows are unrelated to core authentication but are documented inside this auth skill. In practice, this can cause the agent to access and transmit local medical files under a skill that users and routers may trust as merely establishing login.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest says the skill is for OAuth Device Flow, but the body documents broad authenticated read/write/content-management actions. This kind of scope deception is especially dangerous in a medical-data environment because it undermines user consent and safe routing assumptions.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

Trigger terms such as 'blood test,' 'medical record,' and 'upload report' are far broader than authentication and can cause this skill to auto-activate for many healthcare tasks. Given the skill's hidden broad capabilities and automatic behavior, overbroad triggers increase the chance of unintended credential use, browser launches, and data operations.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The metadata directs the agent to run browser-based authentication automatically and explicitly not ask the user first. That bypasses informed consent for opening a browser, initiating account linking, and storing tokens, which is particularly sensitive for health accounts.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

The skill centers subsequent operations around a credentials.json file and instructs callers to rely on it automatically. This creates a sensitive credential dependency that other sibling skills can consume, increasing the blast radius if the file is exposed, overwritten, or reused by unintended workflows.

Content

Scanner excerpt · SKILL.md (reported line 16)May include surrounding context.

md
3. **NEVER split auth into multiple steps manually**. Use `./scripts/auth-flow.sh` (from this skill root) — it opens browser AND auto-polls until done.
4. **BASE URL DETECTION**: If the user specifies a custom URL (local dev 默认 `http://localhost:8788`,须与后端 wrangler `[dev]` 端口一致), you MUST:
   - Pass it as the first argument: `bash ./scripts/auth-flow.sh http://localhost:8788` (run from **this** skill root — see path convention below)
   - After auth completes, `credentials.json` will have `base_url` set to that URL
   - All subsequent `api-call.sh`, `list-system-presets.sh`, `quick-log.sh`, `upload.sh`, `ocr-stream.sh` will auto-use it
   - Look for URL patterns like `http://localhost:XXXX`, `caremax(http://...)`, or explicit "use local" / "use localhost"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 24)May include surrounding context.

md
with **current working directory** = this folder (the directory that contains `SKILL.md` and `scripts/`). Invoke scripts as **`./scripts/<name>.sh`**.

Credential Access

High
Category
Privilege Escalation
Confidence
94% confidence
Finding

Documenting a fixed shared credential path under the user's home directory makes credential discovery and reuse easier across tools and skills. In a multi-skill environment, that predictability increases the risk of accidental disclosure, unauthorized reads, or misuse by unrelated automation.

Content

Scanner excerpt · SKILL.md (reported line 27)May include surrounding context.

md
- **This skill (`caremax-auth`):** run commands with **current working directory** = this folder (the directory that contains `SKILL.md` and `scripts/`). Invoke scripts as **`./scripts/<name>.sh`**.
- **Other `caremax-*` skills** sit as **sibling directories** next to `caremax-auth` (e.g. `skills/caremax-indicators/` and `skills/caremax-auth/` in the repo, or `~/.agents/skills/<name>/` after install). From those folders, call auth as **`../caremax-auth/scripts/<name>.sh`**.

Credentials file location is unchanged: **`~/.caremax/credentials.json`** (not under any product’s config dir).

### api-call.sh — Make authenticated API calls (PRIMARY TOOL)

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

Saving OAuth tokens to ~/.caremax/credentials.json is a sensitive credential-storage behavior, especially because this skill is designed to run silently and support medical-data access. If that file is readable by other processes or mishandled, attackers or unrelated tools could reuse the bearer token to access protected health information.

Content

Scanner excerpt · SKILL.md (reported line 110)May include surrounding context.

md
1. Requests device code from the API
2. Opens the user's browser to the authorize page
3. **Automatically polls every 5 seconds** until the user approves (up to 15 min)
4. Saves token to `~/.caremax/credentials.json`

Output when done: `{"status":"authorized","access_token":"sk-caremax-...","base_url":"..."}`

Context Leakage

High
Category
Data Exfiltration
Confidence
85% confidence
Finding

Code or instructions that leak agent conversation context to external services, potentially exposing sensitive user interactions.

Content

Scanner excerpt · SKILL.md (reported line 159)May include surrounding context.

Upload + OCR (save medical reports from images)

This is a session-based multi-step workflow. One upload session groups all files + reports together.

Step 1: Upload → creates a session

bash

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

Destructive deletion and report-saving capabilities exceed what an authentication-only skill should do. Because the skill is positioned as a silent prerequisite, these state-changing actions are more dangerous: they may be reachable through an unexpectedly trusted path and can alter or remove medical records.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
91% confidence
Finding

The documented DELETE operation accepts a session_id parameter and can remove a session, files, and reports atomically. In a skill already suffering from scope confusion and broad routing, exposing destructive parameterized shell/API calls increases the risk of accidental or manipulated deletion of medical data.

Content

Scanner excerpt · SKILL.md (reported line 225)May include surrounding context.

Delete session (undo entire upload)

bash
bash ./scripts/api-call.sh DELETE /api/skill/sessions/<session_id>

Deletes the session + all files + all reports atomically.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

This script is not limited to authentication; it accepts arbitrary HTTP methods, paths, and optional bodies, then sends authenticated requests with the CareMax bearer token. In the context of a skill described as an auth prerequisite, this broad post-auth capability materially expands scope and could be abused by downstream prompts or tools to access, modify, or exfiltrate health data under the user's session.

Content

No source excerpt is available for this finding.

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · scripts/auth-flow.sh (reported line 12)May include surrounding context.

sh
CREDS_FILE="$HOME/.caremax/credentials.json"

# Step 1: 申请设备码
DEVICE_RESPONSE=$(curl -s -X POST "$BASE_URL/api/auth/device" \
  -H "Content-Type: application/json" \
  -d '{"client_id":"caremax-agent","scope":"read:indicators read:records read:members write:upload write:ocr search:records"}')

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · scripts/auth-flow.sh (reported line 38)May include surrounding context.

sh
for i in $(seq 1 $MAX_ATTEMPTS); do
  sleep "$INTERVAL"

  TOKEN_RESPONSE=$(curl -s -X POST "$BASE_URL/api/auth/device/token" \
    -H "Content-Type: application/json" \
    -d "{\"device_code\":\"$DEVICE_CODE\",\"grant_type\":\"device_code\"}")

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The script prints the access token to stdout after successful authorization, which can leak credentials into terminal scrollback, logs, orchestration output, agent traces, or other monitoring systems. In this skill context, that is especially dangerous because the skill is designed for automatic invocation and handles health-data scopes, so a leaked bearer token may immediately expose sensitive records and permit API actions.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script emits the OAuth access token when the credential file is still valid, and emits the refresh token when the access token is expired. Any caller, logger, downstream skill, or transcript layer that captures stdout can obtain bearer credentials and reuse them to access CareMax APIs, which is especially sensitive in a health-data context. The skill metadata also says auth should run automatically without asking the user, which increases the chance of silent token harvesting or accidental disclosure.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script performs file download and local write operations even though the skill is described as authentication-only. In an agent setting, this scope expansion is dangerous because it enables retrieval of remote health/session content and persistence to disk without being clearly disclosed, increasing the chance of unauthorized access to sensitive medical data.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill is described as authentication-only, but this script performs OCR session processing and streams OCR results from the backend. That mismatch expands the skill's effective capabilities beyond what the user and orchestrator would expect, creating a covert data-processing path for sensitive medical documents. In a health-data context, hidden OCR/report retrieval is especially risky because it can transmit or expose PHI without clear user intent or proper gating.

Content

No source excerpt is available for this finding.