Back to skill

Security audit

Even G2 Bridge

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly does what it says, but its public Worker can fail open without the G2 token and it forwards raw prompts/results to external services, so it needs careful review before installation.

Install only if you are comfortable with voice prompts and generated outputs leaving the glasses through the Gateway and, when configured, Telegram, Anthropic, and OpenAI. Before deploying, patch the Worker to fail closed when G2_TOKEN is missing, use a dedicated least-privilege Gateway token or agent instead of broad main-agent access, disable Telegram/image/fallback features you do not need, avoid sensitive prompts, and add rate limits or request-size limits for the public Worker.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/worker.js:38
Finding
Authentication Fails Open When G2_TOKEN Is Not Configured## Vulnerability Details **File Location**: `scripts/worker.js:38-41` **Vulnerability Type**: Fail-open authentication **Risk Level**: High ### Vulnerable Code ```js // Auth: G2 → Worker if (env.G2_TOKEN) { const auth = request.headers.get('Authorization'); if (auth !== `Bearer ${env.G2_TOKEN}`) return json({ error: 'Unauthorized' }, 401); } ``` ### Technical Analysis The Worker verifies the caller's bearer token only when `env.G2_TOKEN` is defined. If the secret is absent because of a deployment or configuration error, the authentication block is skipped and all POST requests are accepted without credentials. Although `G2_TOKEN` is documented as required, the implementation does not enforce that requirement. This creates a fail-open access-control boundary on a publicly reachable Cloudflare Worker. An unauthenticated caller can submit arbitrary OpenAI-compatible messages that the Worker forwards using its own privileged Gateway and third-party API credentials. The exposed operations include: - Sending arbitrary prompts to the OpenClaw Gateway with `GATEWAY_TOKEN`. - Invoking tools and capabilities available to the configured `main` agent. - Triggering the Anthropic fallback when the Gateway request fails. - Triggering OpenAI image generation through matching prompts. - Causing long-task results, supplied prompts, generated-image references, or errors to be delivered to the configured Telegram chat. The Telegram network behavior is otherwise consistent with the declared optional rich-content delivery feature. The primary vulnerability is that an omitted authentication secret allows unauthorized users to trigger it. ### Attack Path 1. The operator deploys the Worker but accidentally omits the `G2_TOKEN` Cloudflare secret. 2. The public `workers.dev` URL is discovered through enumeration, logs, documentation, or ordinary exposure. 3. An attacker sends a POST request containing an OpenAI Chat Completions-style message without an `Authorization` hea ...[truncated 1501 chars]
Remediation
## Remediation Suggestions Enforce authentication unconditionally and fail closed if the required secret is absent: ```js if (!env.G2_TOKEN) { return json({ error: 'Service not configured' }, 503); } const auth = request.headers.get('Authorization'); if (auth !== `Bearer ${env.G2_TOKEN}`) { return json({ error: 'Unauthorized' }, 401); } ``` Apply additional defense-in-depth controls: 1. Validate required secrets during deployment and include a deployment smoke test that confirms unauthenticated POST requests receive `401` or `503`. 2. Add per-client and global rate limits to reduce API-credit abuse and denial-of-service risk. 3. Enforce a maximum request-body size and maximum message length before parsing or forwarding input. 4. Restrict the Gateway token and the `main` agent to the minimum tools and permissions required by the glasses bridge. 5. Consider using a dedicated, least-privileged Gateway agent rather than the general-purpose `main` agent. 6. Add explicit authorization controls for expensive image-generation and long-running task routes. 7. Monitor repeated authentication failures, long-task invocation volume, and abnormal third-party API usage. 8. Rotate `G2_TOKEN` immediately if the glasses or configured endpoint details are exposed.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (17)

YARA rule 'agent_skill_credential_exfiltration_webhook': AI agent skill credential harvesting followed by webhook or external exfiltration [agent_skills]

Critical
Category
YARA Match
Content
onnects G2 smart glasses to OpenClaw Gateway.
 * Voice commands through glasses → full agent capabilities.
 * 
 * Setup: See SKILL.md for deployment instructions.
 * 
 * Secrets (set via `wrangler secret put`):
 *   GATEWAY_URL        — OpenClaw Gateway URL (required)
 *   GATEWAY_TOKEN      — Gateway auth token (required)
 *   G2_TOKEN           — Bearer token for G2 auth (required)
 *   ANTHROPIC_API_KEY  — Fallback when Gateway is down (recommended)
 *   TELEGRAM_BOT_TOKEN — For rich content delivery (optional)
 *   TELEGRAM_CHAT_ID   — Telegram chat ID (optional)
 *   OPENAI_API_KEY     — For image generation (optional)
 */

// Customize: patterns that trigger background processing (long tasks)
const LONG_TASK_PATTERNS = /寫.*文章|寫.*blog|寫.*部落格|寫.*程式|寫.*code|寫.*script|寫一[篇個段]|幫我寫|幫我做|幫我整理|幫我分析|幫我翻譯|幫我改|建一個|做一個|create.*file|write.*code|write.*article|修改.*程式|review.*code|�
Confidence
85% confidence
Finding
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Ae1

High
Category
analysis-evasion
Content
Copy `scripts/worker.js` to your project, then deploy:
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
Copy `scripts/worker.js` to your project, then deploy:
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
Copy `scripts/worker.js` to your project, then deploy:
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ssd 3

High
Confidence
97% confidence
Finding
This code sends both the original task content and the full model result to Telegram in plain text, creating a direct secondary exfiltration channel for any sensitive data in prompts or outputs. Because long-task triggers are broad and automatic, users may unintentionally cause confidential information, credentials, or proprietary material to be copied to Telegram.

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill clearly describes network-capable behavior including Cloudflare Worker deployment, Gateway API calls, Telegram delivery, and optional OpenAI/Anthropic use, but it does not declare an explicit tool scope such as permissions or allowed-tools. This weakens security review and user consent because the operational capabilities are broader than the manifest signals, making downstream policy enforcement and risk assessment harder.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The skill states that long-task results and generated images are sent to Telegram, and that fallback may use Anthropic/OpenAI services, but it does not prominently warn that user prompts, outputs, and possibly sensitive content may be transmitted to third-party providers. This creates a meaningful privacy and data-handling risk, especially because voice requests may include credentials, personal data, or internal work product.

External Transmission

Medium
Category
Data Exfiltration
Content
Verify:
```bash
curl -X POST https://YOUR_GATEWAY_URL/v1/chat/completions \
  -H "Authorization: Bearer YOUR_GATEWAY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model":"openclaw","messages":[{"role":"user","content":"hi"}]}'
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The background-task path sends the full user task text and resulting model output to Telegram, a third-party service, without any consent gate, redaction, or minimization in this file. That creates an avoidable data disclosure path for sensitive prompts, generated content, or secrets a user may include while using the glasses.

External Transmission

Medium
Category
Data Exfiltration
Content
// ─── Direct Claude (fallback) ───────────────────────────────────

async function directClaude(env, content) {
  const res = await fetch('https://api.anthropic.com/v1/messages', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
Confidence
70% 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
// ─── Direct Claude (fallback) ───────────────────────────────────

async function directClaude(env, content) {
  const res = await fetch('https://api.anthropic.com/v1/messages', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The image-generation flow forwards user-provided prompt content to Anthropic/OpenAI and then sends the generated image plus a caption containing the original prompt to Telegram. This multi-hop external sharing is not constrained or sanitized here, so sensitive user text can be propagated to additional third parties beyond the primary gateway.

External Transmission

Medium
Category
Data Exfiltration
Content
try {
    const enhanced = await directClaude(env,
      `Turn this into a concise DALL-E prompt in English. Output ONLY the prompt.\n\n${prompt}`);
    const imgRes = await fetch('https://api.openai.com/v1/images/generations', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${env.OPENAI_API_KEY}` },
      body: JSON.stringify({ model: 'dall-e-3', prompt: enhanced, n: 1, size: '1024x1024' })
Confidence
70% 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
try {
    const enhanced = await directClaude(env,
      `Turn this into a concise DALL-E prompt in English. Output ONLY the prompt.\n\n${prompt}`);
    const imgRes = await fetch('https://api.openai.com/v1/images/generations', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${env.OPENAI_API_KEY}` },
      body: JSON.stringify({ model: 'dall-e-3', prompt: enhanced, n: 1, size: '1024x1024' })
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
});
    const imgData = await imgRes.json();
    if (imgData.data?.[0]?.url) {
      await fetch(`https://api.telegram.org/bot${env.TELEGRAM_BOT_TOKEN}/sendPhoto`, {
        method: 'POST', headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ chat_id: env.TELEGRAM_CHAT_ID, photo: imgData.data[0].url,
          caption: `🕶️ G2 Image Gen\n🎨 "${prompt}"` })
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
});
    const imgData = await imgRes.json();
    if (imgData.data?.[0]?.url) {
      await fetch(`https://api.telegram.org/bot${env.TELEGRAM_BOT_TOKEN}/sendPhoto`, {
        method: 'POST', headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ chat_id: env.TELEGRAM_CHAT_ID, photo: imgData.data[0].url,
          caption: `🕶️ G2 Image Gen\n🎨 "${prompt}"` })
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Ssd 3

Medium
Confidence
93% confidence
Finding
The Telegram photo caption includes the user's original image prompt verbatim, which can leak private requests, internal project details, or personal information through a secondary messaging channel. Even if the image itself is intended for delivery, echoing the raw prompt expands exposure unnecessarily.

Static analysis

No suspicious patterns detected.