Back to skill

Security audit

Don't download

Security checks for vulnerabilities and agentic risk

Overview

This Bria image skill mostly does what it claims, but it handles reusable credentials and image uploads in ways that need review before installation.

Review this before installing. Use it only if you are comfortable sending chosen images and prompts to Bria.ai, and avoid sensitive images unless you understand Bria's data handling. Keep credentials on a private machine, prefer a secure secret store or tightly permissioned file for ~/.bria/credentials, and do not run it in an environment where BRIA_API_BASE or response URLs could be influenced by untrusted code.

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

T09 · Insecure Skill Coding Practices

Error
Location
references/code-examples/bria_client.sh:14
Finding

Environment-Controlled API Base Can Exfiltrate Credentials and Image Data

Content
View full analysis
"$payload" elif printf '%s' "$image" | grep -qE '^https?://'; then if [ "$key" = "images" ]; then printf '{"images": ["%s"]' "$image" > "$payload" else printf '{"%s": "%s"' "$key" "$image" > "$payload" fi else [ ! -f "$image" ] && { echo "ERROR: File not found: $image" >&2; return 1; } if [ "$key" = "images" ]; then printf '{"images": ["' > "$payload" else printf '{"%s": "' "$key" > "$payload" fi base64 < "$image" | tr -d '\n' >> "$payload" if [ "$key" = "images" ]; then printf '"]' >> "$payload" else printf '"' >> "$payload" fi fi ``` ```bash http_code=$(curl -s -o "$result" -w '%{http_code}' -X POST \ "${BRIA_API_BASE}${endpoint}" \ -H "api_token: $BRIA_API_KEY" \ -H "Content-Type: application/json" \ -H "User-Agent: $BRIA_USER_AGENT" \ -d @"$payload") ``` ### Technical Analysis The helper permits the inherited `BRIA_API_BASE` environment variable to replace the expected Bria API origin without validating its scheme, hostname, or port. The same destination then receives the `BRIA_API_KEY` authentication header and the complete request payload. For local files, the payload includes a base64 representation of the selected image. It may also include user prompts, editing instructions, image URLs, masks, and other user-provided data. Sending those values to the actual Bria API is necessary for the declared functionality, but allowing the credential-bearing destination to be changed arbitrarily is not. This vulnerability is exploitable when an attacker can influence the environment from which the Skill is invoked, such as through ...[truncated 1046 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
references/code-examples/bria_client.sh:91
Finding

API Key Is Forwarded to an Unvalidated Polling URL

Content
View full analysis
&2; return 1 fi ``` ### Technical Analysis The helper extracts `status_url` from the API response and passes it directly to `curl`. It attaches the Bria API key regardless of the URL’s scheme or origin. A response-provided polling URL can legitimately simplify asynchronous APIs, but a credential must not be forwarded to an arbitrary origin. If the initial endpoint is compromised, redirected through the separate configurable-base flaw, or otherwise returns malicious response content, the polling request becomes a credential-exfiltration mechanism. An `http://` polling URL could additionally transmit the key without transport encryption. The polling URL can also target local or internal HTTP services reachable from the host. Although the fixed `api_token` header limits the shape of such requests, the behavior still creates an attacker-directed network request primitive. ### Attack Path 1. The initial API endpoint returns JSON containing a malicious `status_url`. 2. The helper extracts that value without validating its scheme or hostname. 3. The polling loop requests the supplied URL. 4. The helper adds `api_token: $BRIA_API_KEY` to the request. 5. An attacker-controlled destination records the API key, or an internal destination receives an unintended authenticated-header request. 6. The attack ...[truncated 506 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:108
Finding

Access, Refresh, and API Tokens Are Persisted Without Restrictive Permissions

Content
View full analysis
"$HOME/.bria/credentials" echo "AUTHENTICATED" break fi ``` ```bash BRIA_API_KEY=$(printf '%s' "$INTROSPECT" | sed -n 's/.*"api_token" *: *"\([^"]*\)".*/\1/p') if [ -n "$BRIA_API_KEY" ]; then grep -v '^api_token=' "$HOME/.bria/credentials" > "$HOME/.bria/credentials.tmp" 2>/dev/null || true printf 'api_token=%s\n' "$BRIA_API_KEY" >> "$HOME/.bria/credentials.tmp" mv "$HOME/.bria/credentials.tmp" "$HOME/.bria/credentials" fi ``` ### Technical Analysis The documented authentication procedure writes access tokens, refresh tokens, and the Bria API key to plaintext files without setting a restrictive umask or explicitly enforcing directory and file permissions. With a common `umask` of `022`, a newly created credential file may be mode `0644`, making it readable by other local users when the parent directories are traversable. The `~/.bria` directory may similarly be created as mode `0755`. The update procedure also uses the predictable path `~/.bria/credentials.tmp`, follows symbolic links during redirection, and does not create the replacement file securely. Reading a dedicated Bria credential file is consistent with the Skill’s authentication function. Persisting reusable tokens without minimum filesystem protections, however, exceeds the security requirements of that functionality. ### Attack Path 1. The authentication flow receives an access token and refresh token. 2. The shell creates `~/.bria/credentials` according to the caller’s current umask. 3. Under a permissive umask and ...[truncated 873 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
references/code-examples/bria_client.sh:34
Finding

Predictable Temporary Files Permit Local Disclosure and File-Race Attacks

Content
View full analysis
"$payload" elif printf '%s' "$image" | grep -qE '^https?://'; then if [ "$key" = "images" ]; then printf '{"images": ["%s"]' "$image" > "$payload" else printf '{"%s": "%s"' "$key" "$image" > "$payload" fi else [ ! -f "$image" ] && { echo "ERROR: File not found: $image" >&2; return 1; } if [ "$key" = "images" ]; then printf '{"images": ["' > "$payload" else printf '{"%s": "' "$key" > "$payload" fi base64 < "$image" | tr -d '\n' >> "$payload" if [ "$key" = "images" ]; then printf '"]' >> "$payload" else printf '"' >> "$payload" fi fi if [ -n "$extra" ]; then if [ -z "$image" ]; then printf '%s' "$extra" >> "$payload" else printf ', %s' "$extra" >> "$payload" fi fi printf '}' >> "$payload" # --- API call --- result="/tmp/bria_result_$$.json" http_code=$(curl -s -o "$result" -w '%{http_code}' -X POST \ "${BRIA_API_BASE}${endpoint}" \ -H "api_token: $BRIA_API_KEY" \ -H "Content-Type: application/json" \ -H "User-Agent: $BRIA_USER_AGENT" \ -d @"$payload") body=$(cat "$result") rm -f "$payload" "$result" ``` ### Technical Analysis The helper constructs payload and response filenames directly under the shared `/tmp` directory using only the process ID. Process IDs are observable or guessable, and shell redirection does not provide exclusive secure creation. If an attacker creates a matching file or symbolic link before the victim opens it, writes may affect an unintended file or the request may use attacker-modified content. The payload may contain complete base64-encoded user images, source URLs, prompts, and editing instructions. The response ma ...[truncated 1479 chars]
Remediation
View remediation
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
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (13)

Vague Triggers

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The frontmatter description instructs the agent to use this skill for nearly any image-related request, which is overly broad routing guidance. Over-triggering can cause the agent to invoke external APIs, authentication flows, and file/network operations even when a simpler or safer local capability would suffice.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The rule 'If the user mentions images, photos, visuals, or any visual content creation — use this skill' is excessively permissive and can hijack a broad class of requests. In context, this is more dangerous because the skill performs authentication, persistent credential storage, and outbound API calls, so misrouting has real security and privacy consequences.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

The skill explicitly instructs the agent to read existing credentials from ~/.bria/credentials, including access_token and api_token values. Accessing locally stored secrets is sensitive behavior and becomes more dangerous here because the same skill also performs outbound network requests and token transformation, creating a full credential handling pipeline.

Content

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

md
## Setup — Authentication

Before making any API call, you need a valid Bria access token.

### Step 1: Check for existing credentials

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% 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).

Content

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

md
fi
ACTIVE=$(printf '%s' "$INTROSPECT" | sed -n 's/.*"active" *: *\([^,}]*\).*/\1/p' | tr -d ' ')
if [ "$ACTIVE" = "false" ]; then
  rm -f ~/.bria/credentials
  echo "TOKEN_EXPIRED"
fi
BRIA_API_KEY=$(printf '%s' "$INTROSPECT" | sed -n 's/.*"api_token" *: *"\([^"]*\)".*/\1/p')

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill includes extensive shell-based behavior (credential checks, curl auth flows, file writes, sourcing local scripts) but declares no explicit tool scope or allowed-tools boundary. Without clear scoping, an agent may invoke shell capabilities more broadly than intended, increasing the chance of unintended command execution and unsafe side effects.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

md
---
name: bria-ai
description: AI image generation, editing, and background removal API via Bria.ai — remove backgrounds to get transparent PNGs and cutouts, generate images from text prompts, and edit photos with natural language instructions. Also create product photography and lifestyle shots, replace or blur backgrounds, upscale resolution, restyle, and batch-generate visual assets. Use this skill whenever the user wants to remove a background, create transparent PNGs, generate, edit, modify, or transform any image — including hero images, banners, social media visuals, product photos, illustrations, icons, thumbnails, ad creatives, or marketing materials. Also triggers on cutout, inpainting, outpainting, object removal or addition, photo restoration, style transfer, image enhancement, relight, reseason, sketch-to-photo, or any visual content creation. Commercially safe, royalty-free. 20+ specialized endpoints for e-commerce, web design, and content pipelines.
license: MIT
homepage: https://bria.ai
metadata:

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

This step sends data to an external Bria authentication endpoint, initiating an outbound trust boundary crossing. While expected for an API integration, it is still security-relevant because it begins an auth flow with a third party and may expose account-linking context without an explicit upfront consent checkpoint.

Content

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

2a. Request a device code:

bash
DEVICE_RESPONSE=$(curl -s -X POST "https://engine.prod.bria-api.com/v2/auth/device/authorize" \
  -H "Content-Type: application/json")
echo "$DEVICE_RESPONSE"

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs the agent to store access, refresh, and API tokens in ~/.bria/credentials and reuse them later, but it does not prominently warn the user that credentials will persist on disk. Silent persistence of reusable secrets increases the risk of token theft, unintended reuse across sessions, and surprise retention on shared systems.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
98% confidence
Finding

This code creates ~/.bria and writes access_token and refresh_token values to ~/.bria/credentials, establishing persistent authenticated state on disk. Persisting reusable session material in plaintext can enable account takeover or long-term unauthorized API use if the host is shared, compromised, or improperly backed up.

Content

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

md
if [ -n "$ACCESS_TOKEN" ]; then
    BRIA_ACCESS_TOKEN="$ACCESS_TOKEN"
    REFRESH_TOKEN=$(printf '%s' "$TOKEN_RESPONSE" | sed -n 's/.*"refresh_token" *: *"\([^"]*\)".*/\1/p')
    mkdir -p ~/.bria
    printf 'access_token=%s\nrefresh_token=%s\n' "$BRIA_ACCESS_TOKEN" "$REFRESH_TOKEN" > "$HOME/.bria/credentials"
    echo "AUTHENTICATED"
    break

External Transmission

Medium
Category
Data Exfiltration
Confidence
95% confidence
Finding

The introspection request transmits the bearer access token to an external endpoint in order to retrieve billing status and the real API key. This is more sensitive than ordinary API traffic because it handles live authentication material and derives another reusable credential, so compromise of logs, process arguments, or surrounding tooling could expose secrets.

Content

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

Introspect the bearer token to check billing status and obtain the real API key for Bria API calls:

bash
INTROSPECT=$(curl -s -X POST "https://engine.prod.bria-api.com/v2/auth/token/introspect" \
  -d "token=$BRIA_ACCESS_TOKEN")
BILLING_STATUS=$(printf '%s' "$INTROSPECT" | sed -n 's/.*"billing_status" *: *"\([^"]*\)".*/\1/p')
if [ "$BILLING_STATUS" = "blocked" ]; then

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The reference instructs callers to send API credentials and user-supplied images to a third-party service but provides no privacy, retention, or user-consent guidance. In an agent skill context, this can cause silent exfiltration of potentially sensitive images and metadata to an external processor without the user's informed awareness.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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/code-examples/bria_client.sh (reported line 71)May include surrounding context.

sh
# --- API call ---
  result="/tmp/bria_result_$$.json"
  http_code=$(curl -s -o "$result" -w '%{http_code}' -X POST \
    "${BRIA_API_BASE}${endpoint}" \
    -H "api_token: $BRIA_API_KEY" \
    -H "Content-Type: application/json" \

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This shell helper sends payload data to a remote Bria API endpoint, including base64-encoded local image contents and an API token header. Although the file has implementation comments, it lacks a clear user-facing disclosure at the point of execution or confirmation prompt warning that local files and request data will be transmitted off-system.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.