Back to skill

Security audit

freshbooks-mcp

Security checks for vulnerabilities and agentic risk

Overview

This FreshBooks helper needs review because financial changes lack clear confirmation steps and its request wrapper can send your access token to another website.

Before connecting a live account, have the wrapper restricted to the FreshBooks HTTPS host with an allowlist of request options. For retrieval, grant only the necessary read permissions using [FreshBooks scopes](https://www.freshbooks.com/api/scopes). Require explicit confirmation of the account, records, amounts, and recipients before changes or emails, and replace numeric example IDs. Protect token output and credential files. Live permissions and the explicitly unverified recipes remain untested.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (30)

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The FreshBooks estimate resource is within the declared scope, but sending an estimate email is a consequential action not disclosed by the query-focused description. This is an undeclared capability, not merely a supporting implementation detail.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The description declares data querying, but the code uses an HTTP POST with a payment payload to create a payment record. This is an undeclared write capability. It records a payment; the snippet does not establish that funds are transferred.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Although time tracking is a declared resource, the description presents the skill as a data-query tool. The supplied code performs a write operation that creates a time entry, which is an undeclared capability.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared purpose describes data retrieval, but the supplied command submits an invoice creation request with a JSON payload. This is a write capability not disclosed by the query-only description.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared purpose describes data retrieval. The code instead sends a state-changing PUT request with action_accept set to true. Although estimates are a declared resource, accepting one is an undeclared write capability, not a supporting implementation detail of querying.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The description presents the skill as a way to query FreshBooks data. This code instead modifies FreshBooks by creating a client. Although the service and resource type match the description, the write capability is materially different from retrieval and is undeclared.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The description frames the skill as a way to query FreshBooks data. The supplied code instead sends an invoice payload using POST to the invoices endpoint, creating a new accounting record. This write capability is materially different from the declared retrieval purpose.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
FreshBooks has a real REST API reachable server-side — no browser bridge, no signed-in
tab, no `fpx`. Authentication is **OAuth2 only**: there is no API key and no personal
access token, so a one-time browser authorize flow is unavoidable.

## The two things that break naive clients

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/fb-token.sh (reported line 13)May include surrounding context.

sh
# FreshBooks refresh tokens are SINGLE-USE and rotate on every refresh: the token
# you just spent is dead, and if the replacement is not written to disk the account
# is locked out with no way back except re-running the browser authorize flow.
# So the helper caches the access token (to avoid burning refreshes) and persists
# the rotated refresh token immediately.
#
# This uses its OWN state file, deliberately separate from the freshbooks-mcp

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
`references/fb-token.sh`, which persists the rotation before returning, and never point

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
. references/fb-token.sh

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node references/fb-bootstrap.mjs url "$FRESHBOOKS_CLIENT_ID"

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node references/fb-bootstrap.mjs exchange "$FRESHBOOKS_CLIENT_ID" "$FRESHBOOKS_CLIENT_SECRET" \

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
| `invalid_client` on refresh | The refresh grant needs `client_secret` **and** `redirect_uri`, form-encoded — not JSON |
| `invalid_grant` on refresh | The token was already spent. Re-run the bootstrap |
| 404 on a valid-looking record | Wrong identifier for that URL family — run `fb_ids` |
| 401 on every call | Access token stale and refresh failing; check the state file |

See `references/recipes.md` for ready-to-run request bodies and `jq` recipes.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/fb-token.sh (reported line 35)May include surrounding context.

sh
chmod 600 "$FB_STATE"
}

# Echo a valid access token, refreshing (and persisting the rotation) when stale.
fb_access_token() {
  fb_state_init || return 1
  local now exp tok

The manifest describes querying FreshBooks data, but the recipes include financial-record mutations and client-facing email actions.

High
Category
Excessive Agency
Confidence
99% confidence
Finding

The query-advertised skill includes executable recipes for creating financial records, accepting estimates, and sending client-facing email without an explicit approval boundary. Some examples contain concrete record IDs, so an agent treating them as operational steps could alter an existing record or communicate externally when the user expected retrieval only.

Content

No source excerpt is available for this finding.

Skill declares no tool scope ('permissions' or 'allowed-tools') but code capabilities were detected: network, shell.

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

| jq '.response.result.invoices[] | {id, invoice_number, amount, outstanding, status}'

text

`fb_curl <path> [curl args…]` attaches the bearer token and `Api-Version: alpha`;
everything after the path is passed to `curl`, so writes work too.

## Response envelopes differ per family

The manifest describes querying FreshBooks data, but the skill also provides instructions to create invoices.

Medium
Category
Excessive Agency
Confidence
98% confidence
Finding

The manifest at L003 frames the skill as a way to query and retrieve FreshBooks data. The executable example at L090-L092 instead sends a POST request that creates an invoice, modifying remote accounting records rather than merely retrieving them.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/fb-bootstrap.mjs (reported line 11)May include surrounding context.

js
process.stdout.on('error', (e) => { if (e.code === 'EPIPE') process.exit(0); throw e; });

const AUTHORIZE = 'https://auth.freshbooks.com/oauth/authorize/';
const TOKEN = 'https://api.freshbooks.com/auth/oauth/token';
const ME = 'https://api.freshbooks.com/auth/api/v1/users/me';
const DEFAULT_REDIRECT = 'https://localhost';

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/fb-bootstrap.mjs (reported line 12)May include surrounding context.

js
const AUTHORIZE = 'https://auth.freshbooks.com/oauth/authorize/';
const TOKEN = 'https://api.freshbooks.com/auth/oauth/token';
const ME = 'https://api.freshbooks.com/auth/api/v1/users/me';
const DEFAULT_REDIRECT = 'https://localhost';

const die = (msg) => { console.error(`error: ${msg}`); process.exit(1); };

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/fb-token.sh (reported line 51)May include surrounding context.

sh
local rt resp new_rt new_at expires_in created_at
  rt=$(jq -r '.refresh_token' "$FB_STATE")
  resp=$(curl -sS -X POST https://api.freshbooks.com/auth/oauth/token \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-urlencode "client_id=$FRESHBOOKS_CLIENT_ID" \
    --data-urlencode "client_secret=$FRESHBOOKS_CLIENT_SECRET" \

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
70% confidence
Finding

Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.

Content

Scanner excerpt · references/fb-token.sh (reported line 79)May include surrounding context.

sh
fi

  # Persist BEFORE returning: the old token is already dead upstream. umask in
  # a subshell so the temp file holding the tokens is never group/world-readable.
  (umask 077; jq -n --arg rt "$new_rt" --arg at "$new_at" --argjson exp "$((created_at + expires_in))" \
    '{refresh_token:$rt, access_token:$at, expires_at:$exp}' > "$FB_STATE.tmp") \
    && chmod 600 "$FB_STATE.tmp" && mv "$FB_STATE.tmp" "$FB_STATE" || {

External Transmission

Medium
Category
Data Exfiltration
Confidence
97% confidence
Finding

FreshBooks API traffic is expected, but the wrapper does not actually constrain the authenticated request destination. A path beginning with '@attacker.example/' changes the URL authority through userinfo syntax, and arbitrary additional curl arguments can supply another URL that receives the custom Authorization header.

Content

Scanner excerpt · references/fb-token.sh (reported line 89)May include surrounding context.

sh
printf '%s' "$new_at"
}

# curl against the FreshBooks API with auth attached. Args after the path are
# passed through to curl, so: fb_curl /path -X POST -d '{...}'
fb_curl() {
  local path="$1"; shift

The query-focused skill exposes authenticated FreshBooks write and delete operations.

Medium
Category
Excessive Agency
Confidence
92% confidence
Finding

The helper accepts arbitrary curl options, including methods and bodies that modify or delete financial records, despite the skill being advertised for querying. With write-capable OAuth scopes, an agent can exceed the expected read-only boundary without any approval check; actual impact depends on the token's permissions.

Content

No source excerpt is available for this finding.