Back to skill

Security audit

Kagi Enrich

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a real Kagi search helper, but it can download and run an unverified GitHub binary, so it should be reviewed before installation.

Install only if you are comfortable with the skill running a local native binary and contacting Kagi with your search queries. Prefer building from the included Go source yourself, or manually verify a pinned release and checksum before running the downloaded binary; avoid accepting the automatic latest-release download on sensitive machines.

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-enrich.sh:43
Finding
Unverified Remote Binary Download and Execution<![CDATA[ ## Vulnerability Details **File Location**: `kagi-enrich.sh:43-87` **Vulnerability Type**: Remote payload retrieval and execution without cryptographic integrity verification **Risk Level**: High ### Vulnerable Code ```bash if [[ ! -x "$BIN" ]]; then OS="$(uname -s | tr '[:upper:]' '[:lower:]')" ARCH="$(uname -m)" case "$ARCH" in x86_64) ARCH="amd64" ;; aarch64|arm64) ARCH="arm64" ;; 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 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-enrich_${TAG}_${OS}_${ARCH}" URL="https://github.com/joelazar/kagi-skills/releases/download/${TAG}/${BINARY}" echo "kagi-enrich 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 exec "$BIN" "$@" ``` ### Technical Analysis When a suitable locally built binary is unavailable, the wrapper queries a mutable `latest` release endpoint, constructs an a ...[truncated 2313 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Prefer building the executable from the audited local Go source instead of downloading a mutable prebuilt artifact. 2. If prebuilt binaries must be supported, pin an explicitly reviewed release version rather than resolving the mutable `latest` release at runtime. 3. Store the expected SHA-256 digest for every supported platform inside the reviewed skill package or obtain it through an independently authenticated trust channel. 4. Download the artifact to a securely created temporary file and verify its digest before granting execute permission or moving it into `.bin`. 5. Fail closed and delete the temporary artifact if verification fails, the expected digest is unavailable, or the platform is unsupported. 6. Install the verified artifact using an atomic rename so an interrupted download cannot leave a partially written executable at the final path. 7. Consider signed releases using a verifiable mechanism such as Sigstore or another signing system with a pinned maintainer identity. Verify the signature and identity before installation. 8. Do not treat a checksum file hosted alongside the binary as sufficient authentication if both can be replaced through the same compromised release channel. 9. Avoid executing an existing `.bin/kagi-enrich` solely because it has an executable bit. Record and revalidate its trusted digest before each execution or when installation state changes. ]]>
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)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The declared behavior is search, but the documented installation and runtime path includes fetching release metadata from GitHub, downloading executable code, optionally compiling from source, and running a local binary. This mismatch can mislead users and agents into approving code execution and software installation they did not expect from a search skill.

Context-Inappropriate Capability

High
Confidence
98% confidence
Finding
The script downloads an executable from a GitHub release and then marks it executable for later execution, without any cryptographic verification of integrity or publisher authenticity beyond TLS. If the release, repository, API response, or network trust boundary is compromised, this becomes arbitrary code execution on the user's machine.

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill invokes shell commands, reads environment variables, downloads binaries, and may build/execute code, but it declares no tool scope or permission boundaries. That increases the chance an agent or user invokes capabilities broader than expected, especially for a skill presented as a simple search helper.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill discusses API usage and billing but does not clearly warn that user queries are sent to Kagi's external service. Users may enter sensitive prompts assuming a local enrichment function, causing inadvertent disclosure of proprietary or personal information to a third party.

Session Persistence

Medium
Category
Rogue Agent
Content
Requires a Kagi account with API access enabled. Uses the same `KAGI_API_KEY` as all other kagi-* skills.

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.

External Transmission

Medium
Category
Data Exfiltration
Content
aarch64|arm64) ARCH="arm64" ;;
esac

TAG=$(curl -fsSL "https://api.github.com/repos/joelazar/kagi-skills/releases/latest" | grep '"tag_name"' | cut -d'"' -f4)
BINARY="kagi-enrich_${TAG}_${OS}_${ARCH}"

mkdir -p {baseDir}/.bin
Confidence
96% confidence
Finding
The installation flow makes outbound requests to GitHub API and downloads a release asset selected from the latest tag at runtime. Pulling executable code from a mutable external source without strict pinning or robust verification creates a supply-chain risk if the account, release process, or network path is compromised.

Description-Behavior Mismatch

Medium
Confidence
96% confidence
Finding
The wrapper does more than invoke a search tool: it conditionally builds code and, failing that, fetches and installs a prebuilt executable from GitHub at runtime. That creates a software supply-chain and unexpected code-execution path that is not aligned with the stated search-only purpose, and users may execute unreviewed code simply by running the skill.

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.

Static analysis

No suspicious patterns detected.