Back to skill

Security audit

logseq

Security checks for vulnerabilities and agentic risk

Overview

This Logseq skill is mostly coherent documentation, but it teaches an overbroad unauthenticated bridge that could expose private notes and destructive graph actions.

Review before installing or following the examples. Avoid creating the documented generic HTTP/IPC bridge as written; use an authenticated, localhost-only, allowlisted bridge and require confirmation or backups before delete, move, Git, or bulk update actions.

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

T09 · Insecure Skill Coding Practices

Error
Location
references/examples.md:20
Finding

Unrestricted Dynamic Dispatch in the Recommended Logseq HTTP Bridge

Content
View full analysis

Vulnerability Details

File Location: references/examples.md, lines 20-34
Vulnerability Type: Unauthenticated and unrestricted privileged API dispatch
Risk Level: High

Vulnerable code:

javascript
// bridge-plugin/index.js
import '@logseq/libs';

logseq.ready({
  async call({ method, namespace, args }) {
    const proxy = logseq[namespace];
    if (!proxy || !proxy[method]) {
      throw new Error(`Unknown method: ${namespace}.${method}`);
    }
    return await proxy[method](...args);
  }
}).then(() => {
  // Listen on HTTP or expose IPC
  console.log('Bridge ready');
});

Technical Analysis

The recommended bridge accepts attacker-controlled namespace, method, and args values and dynamically invokes the selected Logseq API without an authorization check or an allowlist. The example also recommends exposing this dispatcher through HTTP or IPC, but does not require authentication, origin validation, request integrity protection, or loopback-only binding.

This design exposes more than the editing operations described as the bridge's intended purpose. Depending on the APIs available in the installed Logseq version, a caller could access graph content, modify or delete blocks and pages, read graph configuration and filesystem metadata, or invoke privileged namespaces such as logseq.Git.

Checking whether a property exists is not an access-control mechanism. It only prevents calls to nonexistent methods and permits every available method, including destructive or unexpectedly privileged operations.

Attack Path

  1. A user follows the example and connects call() to an HTTP or IPC endpoint.
  2. The endpoint is reachable by an untrusted local process, another host, or potentially browser-originated requests, depending on its binding and CORS configuration.
  3. An attacker submits a request selecting a privileged namespace and method, with attacker-controlled arguments.

...[truncated 1176 chars]

Remediation
View remediation

Remediation Suggestions

  • Do not dynamically dispatch arbitrary namespace and method names.
  • Define a minimal, explicit allowlist of required operations, such as read-only block retrieval methods.
  • Exclude destructive APIs, configuration mutation, Git command execution, UI injection, and any unnecessary namespace.
  • Require strong authentication using a randomly generated secret stored with restrictive permissions.
  • Bind the service exclusively to a Unix domain socket or 127.0.0.1; do not listen on all interfaces.
  • For HTTP transports, reject untrusted Origin values, disable permissive CORS, require an appropriate content type, and mitigate DNS rebinding.
  • Validate argument count, types, lengths, UUID formats, page names, and operation-specific constraints.
  • Apply request-size limits, rate limiting, timeouts, and structured security logging.
  • Introduce explicit user confirmation for destructive operations.
  • Return sanitized errors rather than internal exception details.
  • Document the bridge's trust boundary and provide a complete secure transport example rather than leaving security-sensitive transport behavior unspecified.

T08 · Insecure Dependencies

Note
Location
SKILL.md:182
Finding

Unpinned npm Dependency Installation in Setup Guidance

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 182-185
Vulnerability Type: Floating third-party dependency version
Risk Level: Low

Vulnerable code:

bash
npm install @logseq/libs

Associated guidance:

markdown
### Option 2: Node.js Script with @logseq/libs
For automation scripts, use the `@logseq/libs` package:

Technical Analysis

The installation command does not pin a reviewed package version or require lockfile-based installation. It therefore resolves whichever release is current under the configured npm registry at installation time.

This makes installations non-reproducible and allows dependency behavior to change after the skill has been audited. If a future release or transitive dependency is compromised, malicious, or incompatible, users following the documented command could install and execute it in the plugin development environment.

No evidence in the audited files shows that @logseq/libs is currently malicious. The confirmed issue is the unsafe, floating dependency practice rather than a confirmed compromise of that package.

Attack Path

  1. A user follows the setup instructions at a later date.
  2. npm resolves the then-current @logseq/libs release and its transitive dependencies.
  3. A compromised publisher account, registry, package release, or transitive dependency supplies altered code.
  4. npm installs the changed dependency; package lifecycle behavior may execute during installation where present.
  5. The dependency is imported into a Logseq plugin or automation script and executes with that process's privileges.

Impact Assessment

A successful supply-chain compromise could execute code with the privileges of the user running npm or the resulting plugin. Potential impact includes theft or modification of local development files, Logseq graph data, credentials available to the process, and arbitrary behavior within the plugin environ ...[truncated 227 chars]

Remediation
View remediation

Remediation Suggestions

  • Pin @logseq/libs to an explicitly reviewed version rather than installing the floating latest release.
  • Commit a lockfile and use npm ci for reproducible installations.
  • Review the resolved dependency tree and lockfile before publishing updates.
  • Enable automated dependency vulnerability and integrity monitoring.
  • Update dependencies through a controlled review process.
  • Consider using npm install --ignore-scripts where lifecycle scripts are unnecessary, while verifying that this does not break the required installation.
  • Document the expected package registry and avoid untrusted registry overrides.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
Findings (6)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation highlights deletePage(pageName) as a key method without warning that deletion may be irreversible or difficult to recover depending on the user's setup. In an agent skill, surfacing destructive deletion as an ordinary capability without guardrails materially raises the risk of accidental or unauthorized data loss.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The skill advertises access to getUserConfigs(), getCurrentGraph(), and file-listing capabilities without warning that these can reveal local graph paths, configuration details, filenames, and other sensitive metadata. In the context of a locally running personal knowledge base, such metadata can expose private project names, filesystem structure, and user preferences that users may not expect to share with an automation skill.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill presents write workflows such as page creation, block insertion, and block updates as routine usage but does not warn that these actions directly modify the user's knowledge base and may overwrite or restructure important content. In a local-agent context, missing safety guidance increases the chance of unintended destructive changes through automation, especially when users assume the skill is informational rather than state-changing.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documented bridge plugin exposes a generic handleAPICall({ method, args }) pattern that forwards arbitrary method names into logseq.Editor without any allowlist, validation, or authentication. In practice, this can enable any local process or webpage able to reach the bridge to perform broad read/write actions against the user's Logseq graph, including content modification and deletion, expanding the skill from local automation into a dangerous RPC surface.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The bridge example exposes a generic dispatcher that allows arbitrary Logseq API namespaces and methods to be invoked from an external interface. If that interface is reachable by other local processes or accidentally exposed over HTTP, it becomes a capability-escalation layer for reading, modifying, or reorganizing the entire local knowledge graph, far beyond narrowly scoped local automation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

These automation examples perform bulk page tagging, task archiving, and content generation that can modify or move many notes without confirmation, preview, or rollback guidance. In a local notes environment, this can cause unintended data corruption, destructive reorganization, or mass content changes from a user running example code without understanding its scope.

Content

No source excerpt is available for this finding.