Back to skill

Security audit

Kagi Fastgpt

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it says, but its wrapper can download and run an unverified latest GitHub release binary, which is high-impact enough to require review before installation.

Install only if you are comfortable with a first-run path that may execute a prebuilt binary from the publisher's GitHub releases. Prefer building from the included Go source or independently verifying a pinned release artifact before running it, and do not send secrets, credentials, private URLs, or confidential internal text as FastGPT queries.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (1)

T03 · Remote Payload Retrieval and Execution

Error
Location
kagi-fastgpt.sh:43
Finding
Unverified Remote Binary Download and Execution<![CDATA[ ## Vulnerability Details **File Location**: `kagi-fastgpt.sh`, lines 43–87 **Vulnerability Type**: Unverified retrieval and execution of a mutable remote payload **Risk Level**: High ### Vulnerable Code ```bash if command -v curl >/dev/null 2>&1; then RELEASE_META="$(curl -fsSL "https://api.github.com/repos/joelazar/kagi-skills/releases/latest")" elif command -v wget >/dev/null 2>&1; then RELEASE_META="$(wget -qO- "https://api.github.com/repos/joelazar/kagi-skills/releases/latest")" else echo "Error: Neither curl nor wget found. Please download the binary manually from:" >&2 echo " https://github.com/joelazar/kagi-skills/releases/latest" >&2 exit 1 fi TAG="$(printf '%s\n' "$RELEASE_META" | grep -m1 '"tag_name"' | cut -d'"' -f4 || true)" if [[ -z "$TAG" ]]; then echo "Error: Could not resolve latest release tag from GitHub API." >&2 echo "Please download manually from: https://github.com/joelazar/kagi-skills/releases/latest" >&2 exit 1 fi BINARY="kagi-fastgpt_${TAG}_${OS}_${ARCH}" URL="https://github.com/joelazar/kagi-skills/releases/download/${TAG}/${BINARY}" echo "kagi-fastgpt binary not found. Download pre-built binary from GitHub releases?" >&2 echo " $URL" >&2 read -r -p "Download? [Y/n] " reply >&2 </dev/tty case "${reply:-Y}" in [Yy]*|"") ;; *) echo "Aborted. Install Go 1.26+ to build from source, or download manually:" >&2 echo " $URL" >&2 exit 1 ;; esac if command -v curl >/dev/null 2>&1; then curl -fsSL "$URL" -o "$BIN" else wget -qO "$BIN" "$URL" fi chmod +x "$BIN" fi fi exec "$BIN" "$@" ``` ### Technical Analysis When a suitable Go compiler or an existing executable is unavailable, the wrapper queries the mutable GitHub `latest` release endpoint, downloads the corresponding executable, grants it execution permission, and subsequently executes it. The downloaded artif ...[truncated 2544 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Prefer compiling the included, reviewed Go source rather than automatically retrieving an executable. 2. Pin downloads to an explicitly reviewed release version instead of resolving the mutable `latest` release at runtime. 3. Publish a cryptographic digest for every platform-specific artifact and pin the expected digest in reviewed local code or trusted release metadata. 4. Verify the downloaded file before granting executable permission or running it: - Download into a newly created temporary file. - Calculate its SHA-256 digest. - Compare the complete digest using an exact, fail-closed comparison. - Delete the file and abort if verification fails. 5. Do not rely solely on a checksum manifest downloaded from the same potentially compromised release. Authenticate the manifest with a trusted signing mechanism, such as a pinned public key or a verified Sigstore identity and transparency-log policy. 6. Move the verified artifact atomically into `.bin/kagi-fastgpt` only after all checks succeed. 7. Use restrictive file and directory permissions so other local users cannot replace the cached executable. 8. Remove the default affirmative download response or require an explicit opt-in that explains that native code will be executed. 9. In high-assurance deployments, disable runtime downloads entirely and require binaries to be installed through a controlled, integrity-verified build or package pipeline. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (9)

Context-Inappropriate Capability

High
Confidence
97% confidence
Finding
A question-answering skill is expected to call Kagi or process local inputs, but this wrapper also has the capability to retrieve and execute remote code from GitHub. That expands the trust boundary far beyond the stated purpose and means a simple invocation can become arbitrary code execution if the remote release is malicious or substituted.

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill explicitly relies on shell execution and environment secrets (`KAGI_API_KEY`), yet the manifest does not declare any tool scope such as `permissions` or `allowed-tools`. That omission weakens least-privilege controls and can cause the host agent to expose broader capabilities than users expect when running installation or wrapper commands.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill says it provides AI-generated answers with web sources, but it does not prominently warn that user prompts are sent to Kagi's external FastGPT service and trigger live web searches. Users may unknowingly transmit sensitive prompts, internal URLs, or proprietary data to a third party, creating a privacy and data-handling risk.

Session Persistence

Medium
Category
Rogue Agent
Content
Requires a Kagi account with API access enabled. Uses the same `KAGI_API_KEY` as the `kagi-search` skill.

1. Create an account at https://kagi.com/signup
2. Navigate to Settings → Advanced → API portal: https://kagi.com/settings/api
3. Generate an API Token
4. Add funds at: https://kagi.com/settings/billing_api
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.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The script can fetch a release artifact from GitHub at runtime and then immediately mark it executable and run it. That creates a software supply-chain risk because the downloaded binary is not pinned to a trusted digest or signature, so compromise of the GitHub account, release pipeline, network trust, or release selection path could result in arbitrary code execution.

External Transmission

Medium
Category
Data Exfiltration
Content
esac

    if command -v curl >/dev/null 2>&1; then
      RELEASE_META="$(curl -fsSL "https://api.github.com/repos/joelazar/kagi-skills/releases/latest")"
    elif command -v wget >/dev/null 2>&1; then
      RELEASE_META="$(wget -qO- "https://api.github.com/repos/joelazar/kagi-skills/releases/latest")"
    else
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
esac

    if command -v curl >/dev/null 2>&1; then
      RELEASE_META="$(curl -fsSL "https://api.github.com/repos/joelazar/kagi-skills/releases/latest")"
    elif command -v wget >/dev/null 2>&1; then
      RELEASE_META="$(wget -qO- "https://api.github.com/repos/joelazar/kagi-skills/releases/latest")"
    else
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
esac

    if command -v curl >/dev/null 2>&1; then
      RELEASE_META="$(curl -fsSL "https://api.github.com/repos/joelazar/kagi-skills/releases/latest")"
    elif command -v wget >/dev/null 2>&1; then
      RELEASE_META="$(wget -qO- "https://api.github.com/repos/joelazar/kagi-skills/releases/latest")"
    else
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Context-Inappropriate Capability

Low
Confidence
79% confidence
Finding
The manifest frames this skill as a FastGPT-based question-answering tool and does not mention handling local credentials or environment access. While the API key is needed to call Kagi, reading from environment variables is an additional capability that is not justified by the stated purpose alone under this rule set.

Static analysis

No suspicious patterns detected.