Back to skill

Security audit

Space Duck 0.10.5

Security checks for vulnerabilities and agentic risk

Overview

ClawScan marks this skill suspicious because it reports multiple security weaknesses involving credentials, inbound message handling, file sharing, installation, and background activity; its scan was partial, so the evidence is incomplete.

Consider the reported risks before installing, especially if you would provide credentials, share private workspace files, enable message handling, or allow background services and automatic updates. The scan covered 94% of components and was marked partial: some static analysis and reference checks were incomplete. Treat the suspicious verdict as a reason to review the flagged behaviors and installation instructions before deciding.

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

Warning
Location
scripts/peck_listener.py
Finding

Unauthenticated push webhook permits sender impersonation and local side effects

Content
View full analysis

Impact

Attackers can impersonate peers, insert inbox records, overwrite records with known IDs, and trigger configured downstream processing without proving platform or sender identity.

T09 · Insecure Skill Coding Practices

Error
Location
scripts/peck_responder.py
Finding

Responder inbox self-write allows path traversal through raw webhook input

Content
View full analysis

Impact

A peck_id such as '../config' writes the attacker-controlled envelope to ~/.space-duck/config.json rather than the inbox. Absolute IDs or additional traversal can target other writable JSON paths whose parent directories exist. This can corrupt or replace application configuration; it is not evidence of unrestricted file-content writing or direct code execution.

T09 · Insecure Skill Coding Practices

Error
Location
scripts/_apiguard.py
Finding

Attacker-selected attachment URL can send the Beak Key over cleartext HTTP

Content
View full analysis

Impact

A URL such as http://beak.spaceduckling.com/ passes validation and causes the initial request to include the Beak Key without TLS. An observer or active attacker on that network path can obtain the credential if the connection succeeds. A later HTTPS redirect cannot protect the initial transmission.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/workspace_bridge.py
Finding

Automatic snapshots bypass workspace exclusions and follow out-of-workspace file symlinks

Content
View full analysis

Impact

An in-workspace public.md symlink can cause a readable external file to be uploaded to the platform snapshot endpoint. Markdown under excluded locations such as .history is also uploaded. This transfers content outside the intended workspace-sharing boundary; unauthorized access to the resulting server-side snapshots was not established.

Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (318)

Tainted flow: 'req' from os.environ.get (line 153, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/doctor_fix.py (reported line 156)May include surrounding context.

python
req = urllib.request.Request(
            f"{api}/beak/spaceducks?duckling_id={cfg.get('duckling_id', '')}",
            headers={'Accept': 'application/json', 'X-Beak-Key': cfg.get('beak_key', '')})
        with urllib.request.urlopen(req, timeout=10) as r:
            rows = json.loads(r.read())
        rows = rows.get('agents', rows.get('spaceducks', []))
        mine = next((s for s in rows if s.get('spaceduck_id') == cfg.get('spaceduck_id')), None)

Tainted flow: 'port' from os.environ.get (line 390, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/doctor_fix.py (reported line 322)May include surrounding context.

python
time.sleep(3)
    ok = False
    try:
        with urllib.request.urlopen(f'<redacted-url>', timeout=5) as r:
            ok = json.loads(r.read()).get('ok') is True
    except Exception:
        pass

Tainted flow: 'req' from os.environ.get (line 502, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/mcp_server.py (reported line 507)May include surrounding context.

python
headers={"Content-Type": "application/json",
                                              "Authorization": "Bearer " + (s or "")},
                                     data=b'{"jsonrpc":"2.0","id":1,"method":"ping"}')
        with urllib.request.urlopen(req, timeout=3) as r:
            up = r.status == 200
    except Exception:
        up = False

Tainted flow: 'req' from os.environ.get (line 278, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/pair.py (reported line 285)May include surrounding context.

python
headers={'Content-Type': 'application/json'},
    )
    try:
        with urllib.request.urlopen(req, timeout=15) as r:
            return r.status, json.loads(r.read())
    except urllib.error.HTTPError as e:
        try:

Tainted flow: 'cmd' from sys.stdin.read (line 108, user input) → subprocess.run (code execution)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

External input (network, user) flows to a code execution sink. This enables remote code execution or command injection.

Content

Scanner excerpt · scripts/peck_critic.py (reported line 113)May include surrounding context.

python
try:
        # cwd pinned: a deleted inherited cwd makes the CLI exit 1 before it
        # reads the prompt, which fails the critic CLOSED and holds every reply.
        out = subprocess.run(cmd, capture_output=True, text=True,
                             timeout=TIMEOUT, cwd=safe_cwd())
    except subprocess.TimeoutExpired:
        _log('claude CLI timed out — HOLD (fail closed)')  # [HARDEN-073]

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

Critical
Category
YARA Match
Confidence
85% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · scripts/peck_listener.py (reported line 38)May include surrounding context.

python
This rail bypasses the per-duck bot
             entirely — outages there don't break local delivery.
  slack      Slack incoming-webhook URL. SPACEDUCK_FWD_SLACK_WEBHOOK env, or
             {"slack":{"webhook_url":"https://hooks.slack.com/…"}} in
             forward.json.
  discord    Discord webhook URL. SPACEDUCK_FWD_DISCORD_WEBHOOK env, or
             {"discord":{"webhook_url":"https://discord.com/api/webhooks/…"}}
             in forward.json.
  email      SMTP. SPACEDUCK_FWD_SMTP_HOST/PORT/USER/PASS + EMAIL_FROM/TO env,
             or {"email":{"smtp_host":"…","smtp_port":587,"smtp_user":"…",
             "smtp_pass":"…","from_addr":"…","to_addr":"…","use_tls":true}}
             in forward.json.

Lambda variant (drop-in handler) — sketch at the bottom of this file.

Usage:
  # DEFAULT onboarding path (0.4.19+) — zero tunnel/domain/webhook setup.
  # Polls the platform mailbox with adaptive cadence: fast (--interval, 3s)
  # while a peck session is active

Tainted flow: 'req' from os.environ.get (line 331, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/peck_listener.py (reported line 337)May include surrounding context.

python
headers={'Content-Type': 'application/x-www-form-urlencoded'},
    )
    try:
        with urllib.request.urlopen(req, timeout=8) as r:
            return (True, 'sent') if r.status == 200 else (False, f'http_{r.status}')
    except urllib.error.HTTPError as e:
        snippet = e.read()[:120].decode('utf-8', 'ignore')

Tainted flow: 'req' from os.environ.get (line 349, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/peck_listener.py (reported line 354)May include surrounding context.

python
headers={'Content-Type': 'application/json'},
    )
    try:
        with urllib.request.urlopen(req, timeout=8) as r:
            return (True, 'sent') if 200 <= r.status < 300 else (False, f'http_{r.status}')
    except urllib.error.HTTPError as e:
        snippet = e.read()[:120].decode('utf-8', 'ignore')

Tainted flow: 'req' from os.environ.get (line 291, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/peck_responder.py (reported line 294)May include surrounding context.

python
req = urllib.request.Request(api, data=payload,
            headers={'Content-Type': 'application/json'}, method='POST')
        try:
            urllib.request.urlopen(req, timeout=8)
            _log(f'silent-skip TG notify ok: reason={reason!r} sender={sender!r}')
        except Exception as _se:
            # 0.9.7 [RESP-D] LEG B — TG send failed: also buffer durably so a

Tainted flow: 'req' from os.environ.get (line 334, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/peck_responder.py (reported line 336)May include surrounding context.

python
url = f'{api}/beak/connection/permissions?sender_spaceduck_id={sender_sd}&target_spaceduck_id={my_sd}'
    req = urllib.request.Request(url, headers={'X-Beak-Key': beak_key})
    try:
        with urllib.request.urlopen(req, timeout=10) as r:
            data = json.loads(r.read())
    except urllib.error.HTTPError as e:
        return False, f'http_{e.code}', {}

Tainted flow: 'prompt' from sys.stdin.read (line 593, user input) → subprocess.run (code execution)

Critical
Category
Data Flow
Confidence
95% confidence
Finding

Passing prompt text through stdin is not direct operating-system command injection. The real issue is agent-mediated prompt injection: remote peer text reaches Claude Code while tool unavailability is asserted only in instructions rather than enforced by the invocation.

Content

Scanner excerpt · scripts/peck_responder.py (reported line 581)May include surrounding context.

python
(e.g. "organisation access to Claude Code is disabled"), timeout, or empty
    output. err never contains secrets."""
    try:
        out = subprocess.run(cmd, input=prompt, capture_output=True,
                             text=True, timeout=DEFAULT_TIMEOUT, cwd=_cwd)
        # 0.8.7 — RESP-C: one optional lookup round. If the model asked for
        # facts instead of a reply, run the allowlisted lookups and re-prompt

Tainted flow: 'prompt' from sys.stdin.read (line 593, user input) → subprocess.run (code execution)

Critical
Category
Data Flow
Confidence
95% confidence
Finding

The follow-up prompt still contains untrusted peer input and runs through the same insufficiently restricted Claude Code invocation. This is a duplicate exposure of the agent prompt-injection issue, not evidence that stdin is executed directly by subprocess.run.

Content

Scanner excerpt · scripts/peck_responder.py (reported line 597)May include surrounding context.

python
'from your own host)\n' + _res +
                          '\n\nNow compose your reply using these facts. '
                          'Do not request further lookups.')
                out = subprocess.run(cmd, input=prompt, capture_output=True,
                                     text=True, timeout=DEFAULT_TIMEOUT,
                                     cwd=_cwd)
        if out.returncode != 0:

Tainted flow: 'payload' from sys.stdin.read (line 787, user input) → subprocess.run (code execution)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

External input (network, user) flows to a code execution sink. This enables remote code execution or command injection.

Content

Scanner excerpt · scripts/peck_responder.py (reported line 793)May include surrounding context.

python
'connection': perms,
    })
    try:
        out = subprocess.run(['python3', str(script)],
                             input=payload,
                             capture_output=True, text=True, timeout=60)
        if out.returncode != 0:

Tainted flow: 'cmd' from sys.stdin.read (line 829, user input) → subprocess.run (code execution)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

External input (network, user) flows to a code execution sink. This enables remote code execution or command injection.

Content

Scanner excerpt · scripts/peck_responder.py (reported line 834)May include surrounding context.

python
'--message', handoff_text,
           '--purpose', 'handoff']
    try:
        out = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
        if out.returncode != 0:
            _log(f'handoff send_peck exit {out.returncode}: {out.stderr[:300]}')
            return False

Tainted flow: 'cmd' from sys.stdin.read (line 1052, user input) → subprocess.run (code execution)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

External input (network, user) flows to a code execution sink. This enables remote code execution or command injection.

Content

Scanner excerpt · scripts/peck_responder.py (reported line 1063)May include surrounding context.

python
if peck_meta.get('current_round') is not None: cmd.extend(['--current-round', str(peck_meta['current_round'])])
        if peck_meta.get('max_rounds'):    cmd.extend(['--max-rounds', str(peck_meta['max_rounds'])])
    try:
        out = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
        if out.returncode != 0:
            # 0.3.15 — send_peck.py prints user-facing errors via print() to
            # STDOUT (not stderr). Pre-0.3.15 we only logged stderr → Wayne

Tainted flow: 'req' from os.environ.get (line 509, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/telegram_listener.py (reported line 515)May include surrounding context.

python
headers={'Content-Type': 'application/json',
                     'Authorization': f'Bearer {beak_key}'},
            method='POST')
        with urllib.request.urlopen(req, timeout=15) as r:
            if r.status != 200:
                return ''
            d = json.loads(r.read())

Tainted flow: 'req' from os.environ.get (line 836, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/telegram_listener.py (reported line 838)May include surrounding context.

python
url = f'{api_base.rstrip("/")}/beak/agent/byob-status?spaceduck_id={sd_id}'
        req = urllib.request.Request(
            url, headers={'Authorization': f'Bearer {beak_key}'}, method='GET')
        with urllib.request.urlopen(req, timeout=8) as r:
            d = json.loads(r.read())
        # 0.4.17 — the endpoint returns `binding_state` (never `state`);
        # reading `state` made preflight report UNKNOWN even when VERIFIED.

Tainted flow: 'req' from os.environ.get (line 979, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/telegram_listener.py (reported line 984)May include surrounding context.

python
headers={'Content-Type': 'application/json',
                     'Authorization': f'Bearer {beak_key}'},
            method='POST')
        urllib.request.urlopen(req, timeout=3).close()
    except Exception:
        pass

Tainted flow: 'req' from os.environ.get (line 48, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/telegram_poll.py (reported line 51)May include surrounding context.

python
req = urllib.request.Request(
        f'https://api.telegram.org/bot{token}/{method}',
        data=data, headers={'Content-Type': 'application/json'}, method='POST')
    with urllib.request.urlopen(req, timeout=timeout) as r:
        resp = json.load(r)
    if not resp.get('ok'):
        raise RuntimeError(f'{method}: {resp}')

Tainted flow: 'req' from os.environ.get (line 64, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/telegram_poll.py (reported line 74)May include surrounding context.

python
'X-SpaceDuck-Idempotency-Key': nonce,
                 'X-SpaceDuck-Signature': f'sha256={sig}',
                 'X-SpaceDuck-Binding-State': 'VERIFIED'})
    with urllib.request.urlopen(req, timeout=15) as r:
        return r.status

Tainted flow: 'req' from os.environ.get (line 130, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
94% confidence
Finding

The platform request attaches the Beak key to an API base selectable through SPACE_DUCK_API, --api, or the function argument without validating that effective destination here. If an attacker influences that setting, the request can disclose the credential and message to their server; the configuration check does not receive the actual api_base argument and is bypassed when callers supply a key.

Content

Scanner excerpt · scripts/tg_send.py (reported line 137)May include surrounding context.

python
method='POST',
    )
    try:
        with urllib.request.urlopen(req, timeout=15) as r:
            return r.status, json.loads(r.read())
    except urllib.error.HTTPError as he:
        try:

Tainted flow: 'req' from os.environ.get (line 200, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
94% confidence
Finding

The platform callback request likewise sends x-beak-key to the caller-supplied or environment-derived api_base without checking the effective origin. An attacker able to influence that base can capture the reusable credential; supplying beak_key directly also skips _load_config and its guard.

Content

Scanner excerpt · scripts/tg_send.py (reported line 207)May include surrounding context.

python
method='POST',
    )
    try:
        with urllib.request.urlopen(req, timeout=8) as r:
            return r.status, json.loads(r.read())
    except urllib.error.HTTPError as he:
        try:

Tainted flow: 'req' from os.environ.get (line 925, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/workspace_bridge.py (reported line 933)May include surrounding context.

python
'X-Beak-Signature': sig,
                },
            )
            with urllib.request.urlopen(req, timeout=3) as r:
                _ = json.loads(r.read())
                state = 'up'
                detail['http_status'] = 200

Tainted flow: 'req' from os.environ.get (line 925, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/workspace_bridge.py (reported line 998)May include surrounding context.

python
'Authorization': f'Bearer {bk}'},
                method='POST',
            )
            with urllib.request.urlopen(req, timeout=10) as r:
                print(f'# reported: HTTP {r.status}', file=sys.stderr)
        except Exception as e:
            print(f'# warn: report failed: {e}', file=sys.stderr)

Self-Modification

High
Category
Rogue Agent
Confidence
90% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

Scanner excerpt · CHANGELOG.md (reported line 8)May include surrounding context.

md
- `peck_listener.py` — `update_request` system notices (MC "Queue update
  peck", Lambda v1106) are now exempt from the `--on-peck` auto-responder,
  same doctrine as grant notices: a system notice never draws a reply. The
  self-update trigger still fires first; the notice still lands in the inbox
  and forwards to the owner.
- `references/grants.md` — documents check→deny recovery: recoverable
  `allowed:false` reasons (consumed/expired/no_grant/scope_mismatch) carry a