Back to skill

Security audit

clawsec-scanner

Security checks for vulnerabilities and agentic risk

Overview

This security scanner is not clearly malicious, but it needs review because its continuous hook can inject untrusted scan findings as system-level messages and some security coverage claims do not match the code.

Install only after reviewing the hook behavior. Prefer the signed manual installation path or exact pinned package versions, keep the continuous hook disabled until system-role reporting is fixed, set CLAWSEC_SCANNER_TARGET to a narrow path, and treat DAST results as static inspection rather than runtime validation.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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 (2)

T01 · Skill Instruction Hijacking

Error
Location
hooks/clawsec-scanner-hook/handler.ts:303
Finding

Untrusted Scan Results Are Injected into the System-Message Trust Boundary

Content
View full analysis
0) { const alertMessage = buildAlertMessage(dedupedReport, outputFormat); event.messages?.push({ role: "system", content: `🔍 ClawSec Scanner detected ${dedupedReport.vulnerabilities.length} new vulnerabilities:\n\n${alertMessage}`, }); } ``` ### Technical Analysis The scanner report can contain data derived from an untrusted scan target, including package names, advisory titles, descriptions, hook names, file paths, and metadata. `buildAlertMessage` serializes or formats these values without establishing a trust boundary or neutralizing instruction-like content. The resulting report is appended to the conversation with the privileged `system` role. Consequently, text controlled by a scanned project can cross from an untrusted data context into the Agent's highest instruction tier. A malicious package or hook can use crafted metadata resembling Agent instructions, and those instructions may subsequently be interpreted as authoritative system guidance. This is an indirect prompt-injection vulnerability. Escaping for Markdown alone would not be sufficient because the underlying problem is the assignment of an inappropriate message role to untrusted content. ### Attack Path 1. An attacker publishes or places a malicious Skill or project inside the directory monitored by ClawSec. 2. The project includes instruction-like text in metadata that can appear in a scanner finding, such as a package name, hook name, advisory description, or source-analysis message. 3. The periodic scanner processes the malicious project and includes the attacker-controlled value in a vulnerability report. 4. `buildAlertMessage` formats ...[truncated 1056 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:124
Finding

Documented Installation Command Executes a Mutable Third-Party npm Package

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (30)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The code broadly matches a vulnerability-scanning orchestrator, but it materially differs from the declared description in two ways. First, it explicitly runs DAST/dynamic analysis (dast_runner.mjs) and exposes --skip-dast, while the description mentions only dependency scanning, CVE lookup, SAST, and static hook inspection. Dynamic security testing is an undeclared capability. Second, the declared CVE behavior is stronger and more specific than what this chunk shows: there is no explicit orchestration of OSV/NVD/GitHub Advisory lookups here, and the script comments say enrichment is done inline by scan_dependencies.mjs with future enhancement for broader enrichment. So the description overstates the visible CVE-lookup capability in this supplied code chunk.

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 356)May include surrounding context.

md
node test/dependency_scanner.test.mjs

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node test/dependency_scanner.test.mjs

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node test/cve_integration.test.mjs

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node test/cve_integration.test.mjs

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node test/sast_engine.test.mjs

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node test/sast_engine.test.mjs

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node test/dast_harness.test.mjs

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node test/dast_harness.test.mjs

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
Update `scripts/sast_analyzer.mjs` to include custom rules:

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The file advertises dynamic security testing that will execute real hook handlers and validate runtime behavior, but the implementation explicitly performs static-only inspection and even records informational findings stating the hook was not executed. In a security scanner, this mismatch can create false assurance that malicious or unsafe runtime behavior was tested when it was not, causing users to trust incomplete results and miss real hook-based vulnerabilities.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The inline documentation claims runtime validation of malicious-input resilience, timeout behavior, output bounds, and event mutation safety, yet the code path uses static inspection and explicitly avoids importing, transpiling, or invoking the target handler. For a vulnerability scanner, deceptive or inaccurate security claims are dangerous because they undermine operator decision-making and can leave exploitable behavior untested in agent hook code.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The 0.0.4 security note states the scanner was changed to use static hook source inspection so runs never import, transpile, or invoke untrusted handler code. However, the earlier 0.0.2 entries explicitly describe real OpenClaw hook execution, isolated per-hook execution, and timeout enforcement, which directly contradict the absolute 'never ... invoke' claim if read as describing current behavior history or intent.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The README instructs users to run npx skills add ... without pinning an exact package version, which can cause the latest published package and its transitive dependencies to be fetched and executed. If the upstream package is compromised, typo-squatted, or a malicious update is published, users may execute unreviewed code during installation.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill documents substantial capabilities including shell execution, network access, and environment-variable use, but does not declare an explicit tool scope such as permissions or allowed-tools. This creates an authorization transparency gap: users and platforms cannot easily constrain or review the operational surface before installation, which is especially risky for a scanner that executes subprocesses and sends network requests.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
92% confidence
Finding

Using npx skills without pinning an exact package version allows installation-time execution of whatever package version is current at resolution time. This introduces supply-chain risk because a compromised or breaking upstream release could execute arbitrary code during install.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The continuous monitoring hook automatically scans targets on events and posts findings into the conversation, but the documentation does not give a prominent warning that this creates automated inspection and reporting behavior. In agent environments, this can surprise users and may expose sensitive file paths, package names, or vulnerability details in shared chat context.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

Utilities

jq --version curl --version

text

### Option A: Via clawhub (recommended)

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding

The documentation recommends npx clawhub@latest, which is explicitly floating to the newest release. A malicious or compromised upstream publication could cause arbitrary code execution on user systems at install time.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

md
rm -rf "$DEST"
unzip -q "$TEMP_DIR/$ZIP_NAME" -d "$INSTALL_ROOT"

chmod 600 "$DEST/skill.json"
find "$DEST" -type f ! -name "skill.json" -exec chmod 644 {} \;

echo "Installed clawsec-scanner v${VERSION} to: $DEST"

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

md
unzip -q "$TEMP_DIR/$ZIP_NAME" -d "$INSTALL_ROOT"

chmod 600 "$DEST/skill.json"
find "$DEST" -type f ! -name "skill.json" -exec chmod 644 {} \;

echo "Installed clawsec-scanner v${VERSION} to: $DEST"
echo "Next step: Run a scan or set up continuous monitoring"

Rp1

Medium
Category
MCP Rug Pull
Confidence
85% confidence
Finding

npx eslint . is a development-time command rather than core runtime behavior, but it still pulls and executes potentially unpinned code if eslint is not already installed locally. This is a weaker but real supply-chain exposure in contributor workflows.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding

A second unpinned npx clawhub@latest installation path repeats the same supply-chain risk as the earlier finding. Because this skill is a security scanner, users may over-trust installation instructions, making floating installer references more dangerous in context.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/query_cve_databases.mjs (reported line 13)May include surrounding context.

js
* @returns {Promise<import('../lib/types.ts').Vulnerability[]>}
 */
export async function queryOSV(packageName, ecosystem, version = undefined) {
  const url = 'https://api.osv.dev/v1/query';

  const requestBody = {
    package: {

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script advertises CVE enrichment across OSV, NVD, and GitHub Advisory, but the implementation never performs that step and only leaves a no-op placeholder. In a security scanner, overstating coverage is dangerous because users may rely on incomplete results and miss known vulnerabilities they believe were checked.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dangerous_exec, suspicious.env_credential_access

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
lib/utils.mjs:24

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/dast_runner.mjs:169

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/setup_scanner_hook.mjs:17

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
test/dast_harness.test.mjs:285

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
test/reviewer_regressions.test.mjs:31

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
scripts/query_cve_databases.mjs:65