Back to skill

Security audit

Keyapi Instagram Content Discovery

Security checks for vulnerabilities and agentic risk

Overview

This Instagram discovery skill is mostly purpose-related, but it gives a token-bearing runner broader and less constrained authority than the skill description suggests.

Review this before installing. Use an environment-injected KEYAPI_TOKEN rather than the interactive prompt, do not store the token in the skill directory, avoid setting KEYAPI_SERVER_URL unless you fully trust the endpoint, and treat .keyapi-cache as potentially sensitive collected social data. Install under a normal user account and consider pinning dependencies with a reviewed lockfile.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/run.js:251
Finding

Bearer Token Disclosure Through an Unrestricted Server URL Override

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/run.js:220
Finding

API Token Is Entered Visibly and Persisted in a Plaintext Project File

Content
View full analysis
.env" ); } const { createInterface } = await import("readline"); const rl = createInterface({ input: process.stdin, output: process.stderr }); return new Promise((resolve, reject) => { process.stderr.write("\nKEYAPI_TOKEN is required. Get yours at https://keyapi.ai/\n\n"); rl.question("Enter your token: ", (answer) => { rl.close(); const token = answer.trim(); if (!token) { reject(new Error("No token entered. Set KEYAPI_TOKEN and try again.")); return; } const envPath = join(ROOT, ".env"); writeFileSync(envPath, `KEYAPI_TOKEN=${token}\n`, "utf8"); log(`[token] Saved to ${envPath} — future runs will load it automatically`); process.env.KEYAPI_TOKEN = token; resolve(token); }); }); } ``` ### Technical Analysis `readline.question()` echoes user input to the terminal, so the API token is visible while it is entered. The code then automatically stores the token in a plaintext `.env` file inside the project directory. The `writeFileSync()` call does not explicitly request restrictive permissions. Effective permissions therefore depend on the process umask and existing file permissions. The audited project also contains no `.gitignore`, making accidental inclusion of `.env` in source control more likely. The credential is legitimately required to access KeyAPI, but visible input and automatic plaintext persistence are not req ...[truncated 1106 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
package.json:1
Finding

Mutable Dependency Range Without a Lockfile Prevents Reproducible Installation

Content
View full analysis
=18.0.0" }, "dependencies": { "@modelcontextprotocol/sdk": "^1.10.2" } } ``` The documentation directs users to perform a mutable installation: ```bash npm install ``` ### Technical Analysis The dependency is declared with the caret range `^1.10.2`, which allows npm to install later compatible releases rather than the exact version reviewed during this audit. No lockfile is present in the supplied project structure. As a result, two users installing the same Skill at different times may receive different dependency code. The MCP SDK executes in the same Node.js process that handles `KEYAPI_TOKEN`, network requests, tool parameters, cached responses, and local file operations. A compromised future release could therefore access those resources. This is a supply-chain hardening defect; the audit did not establish that the currently named package or version is malicious. ### Attack Path 1. A future compromised, malicious, or otherwise unsafe release is published within the version range accepted by `^1.10.2`. 2. A user follows the documented `npm install` instruction. 3. With no committed lockfile, npm resolves and installs the newer unaudited release. 4. Package lifecycle behavior may execute during installation, and dependency code executes when `scripts/run.js` imports the SDK. 5. Malicious dependency code can read process environment variables, including `KEYAPI_TOKEN`, inspect local project data, or initiate network requests under the user's account. This path depends on compromise or malicious publication of an accepted dependency release; no such compromise was proven in the audited artifact. ### Impact Assessme ...[truncated 413 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (30)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared description suggests a specialized Instagram content exploration capability. However, the supplied code does not implement Instagram-specific search or discovery features itself. Instead, it is a general-purpose runner for any KeyAPI MCP tool on any supported platform, with the default platform set to TikTok and examples including YouTube. This is a materially different primary purpose and broader capability set than declared. The extra features like caching and pagination are supporting details, but the major mismatch is that the code is a platform-agnostic tool invoker rather than an Instagram-focused content discovery skill.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/run.js --platform instagram --list-tools

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/run.js --platform instagram --list-tools

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/run.js --platform instagram --list-tools

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/run.js --platform instagram --list-tools

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/run.js --platform instagram --list-tools

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/run.js --platform instagram --list-tools

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/run.js --platform instagram --list-tools

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/run.js --platform instagram --list-tools

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/run.js --platform instagram --list-tools

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/run.js --platform instagram --list-tools

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/run.js --platform instagram --list-tools

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/run.js --platform instagram --list-tools

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/run.js --platform instagram --list-tools

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/run.js --platform instagram --list-tools

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/run.js --platform instagram --list-tools

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · scripts/run.js (reported line 45)May include surrounding context.

js
const __dirname = dirname(fileURLToPath(import.meta.url));
const ROOT = resolve(__dirname, "..");

// ── .env loader ───────────────────────────────────────────────────────────────

(function loadDotenv() {
  const envPath = join(ROOT, ".env");

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · scripts/run.js (reported line 106)May include surrounding context.

js
const __dirname = dirname(fileURLToPath(import.meta.url));
const ROOT = resolve(__dirname, "..");

// ── .env loader ───────────────────────────────────────────────────────────────

(function loadDotenv() {
  const envPath = join(ROOT, ".env");

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · scripts/run.js (reported line 240)May include surrounding context.

js
const __dirname = dirname(fileURLToPath(import.meta.url));
const ROOT = resolve(__dirname, "..");

// ── .env loader ───────────────────────────────────────────────────────────────

(function loadDotenv() {
  const envPath = join(ROOT, ".env");

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · scripts/run.js (reported line 247)May include surrounding context.

js
const __dirname = dirname(fileURLToPath(import.meta.url));
const ROOT = resolve(__dirname, "..");

// ── .env loader ───────────────────────────────────────────────────────────────

(function loadDotenv() {
  const envPath = join(ROOT, ".env");

Credential Access

High
Category
Privilege Escalation
Confidence
74% confidence
Finding

The .env loader reads secrets from a local file into process.env. While common, it broadens credential exposure within the process and can enable unintended use of locally stored tokens, especially in a generic tool runner that connects to remote services.

Content

Scanner excerpt · scripts/run.js (reported line 48)May include surrounding context.

js
// ── .env loader ───────────────────────────────────────────────────────────────

(function loadDotenv() {
  const envPath = join(ROOT, ".env");
  if (!existsSync(envPath)) return;
  for (const line of readFileSync(envPath, "utf8").split("\n")) {
    const m = line.match(/^\s*([A-Z_][A-Z0-9_]*)\s*=\s*(.*)$/);

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · scripts/run.js (reported line 248)May include surrounding context.

js
"  → Register at https://keyapi.ai/ to obtain a free token, then either:\n" +
      "    export KEYAPI_TOKEN=your_token_here\n" +
      "  → Or create a .env file in the skill directory:\n" +
      "    echo \"KEYAPI_TOKEN=your_token_here\" > .env"
    );
  }
  const { createInterface } = await import("readline");

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

This line writes the supplied KEYAPI_TOKEN directly to a plaintext .env file in the project directory. If the directory is shared, backed up, or accidentally committed, the credential can be disclosed and abused to make unauthorized API calls under the user's account.

Content

Scanner excerpt · scripts/run.js (reported line 262)May include surrounding context.

js
reject(new Error("No token entered. Set KEYAPI_TOKEN and try again."));
        return;
      }
      const envPath = join(ROOT, ".env");
      writeFileSync(envPath, `KEYAPI_TOKEN=${token}\n`, "utf8");
      log(`[token] Saved to ${envPath} — future runs will load it automatically`);
      process.env.KEYAPI_TOKEN = token;

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill requires access to the KEYAPI_TOKEN environment variable but does not declare an explicit tool scope such as allowed tools or permissions boundaries. That weakens least-privilege guarantees and makes it harder for a host or reviewer to constrain what the skill can access or execute, especially since the workflow invokes a Node-based runner that can make outbound requests using the token.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill explicitly instructs users to cache API responses under a local .keyapi-cache directory, including post details, comments, replies, likes, and other engagement data, but does not prominently warn users in the description or prerequisites that potentially sensitive third-party data will be stored on disk. This can lead to unintended retention, local disclosure to other users/processes, and accidental inclusion of collected social data in backups or source-control uploads.

Content

No source excerpt is available for this finding.