Back to skill

Security audit

小龙虾备忘录

Security checks for vulnerabilities and agentic risk

Overview

This is a real memo app, but it exposes memo data through an unauthenticated network service and includes risky system-level setup guidance.

Review before installing. Run it only on a trusted machine and network unless you first bind the service to localhost, add authentication, remove wildcard CORS, and fix tag escaping in the web UI. Do not copy the nginx commands blindly, especially the command that removes the default site, and treat memo deletion as permanent unless you have backups.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/server.js:11
Finding

Unauthenticated Network-Wide Access to Memo Data and Administrative Operations

Content
View full analysis
{ res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE,OPTIONS'); res.header('Access-Control-Allow-Headers', 'Content-Type'); if (req.method === 'OPTIONS') return res.sendStatus(200); next(); }); ``` All memo operations are exposed without an authentication or authorization middleware: ```js app.get('/api/memos', (req, res) => { const { page, pageSize, search, tag } = req.query; const result = listMemos({ page: parseInt(page) || 1, pageSize: Math.min(parseInt(pageSize) || 20, 100), search, tag }); res.json({ ok: true, ...result }); }); app.get('/api/memos/:id', (req, res) => { const memo = getMemo(parseInt(req.params.id)); if (!memo) return res.status(404).json({ ok: false, error: '没找到这条备忘录' }); res.json({ ok: true, memo }); }); app.post('/api/memos', (req, res) => { const { title, content, tags } = req.body; if (!content && !title) { return res.status(400).json({ ok: false, error: '标题或内容至少要有一个' }); } const memo = createMemo({ title, content, tags }); res.status(201).json({ ok: true, memo }); }); app.put('/api/memos/:id', (req, res) => { const { title, content, tags, pinned } = req.body; const memo = updateMemo(parseInt(req.params.id), { title, content, tags, pinned }); if (!memo) return res.status(404).json({ ok: false, error: '没找到这条备忘录' }); res.json({ ok: true, memo }); }); app.delete('/api/memos/:id', (req, res) => { const ok = deleteMemo(parseInt(req.params.id)); if (!ok) return res.status(404).json({ ok: false, error: '没找到这条备忘录' }); res.json({ ok: true }); }); ``` The service is bound to all availa ...[truncated 2317 chars]
Remediation
View remediation
{ console.log(`Memo service started at http://127.0.0.1:${PORT}`); }); ``` 2. Require authentication before every memo API endpoint. For deployments involving multiple users, enforce authorization at the record level rather than merely checking whether a user is logged in. 3. Replace wildcard CORS with an explicit allowlist. If the Web UI is served from the same origin, disable CORS entirely unless there is a demonstrated cross-origin requirement. ```js const allowedOrigins = new Set(['http://127.0.0.1:3377']); app.use((req, res, next) => { const origin = req.get('Origin'); if (origin && allowedOrigins.has(origin)) { res.setHeader('Access-Control-Allow-Origin', origin); res.setHeader('Vary', 'Origin'); } next(); }); ``` 4. Reject disallowed preflight origins instead of returning success unconditionally. 5. If cookie-based authentication is introduced, use `HttpOnly`, `Secure`, and appropriate `SameSite` cookie attributes and add CSRF protection for state-changing requests. 6. Place the service behind a firewall or authenticated reverse proxy as defense in depth. Do not rely on a reverse proxy alone while leaving port 3377 publicly reachable. 7. Document clearly whether the application is local-only or network-accessible and provide secure deployment defaults matching that model. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/public/index.html:72
Finding

Stored Cross-Site Scripting Through Unescaped Memo Tags

Content
View full analysis
{ const tags=(m.tags||[]).filter(Boolean) return '
'+ '
'+ '#'+m.id+''+ ''+new Date(m.created_at).toLocaleString('zh-CN',{month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit'})+''+ '
'+ (m.title&&m.title!=='add'?'
'+esc(m.title)+'
':'')+ '
'+linkify(esc(m.content||''))+'
'+ (tags.length?'
'+tags.map(t=>'#'+t+'').join('')+'
':'')+ '
' }).join('') ``` The creation endpoint accepts `tags` directly from a request without validating their type, length, or content: ```js app.post('/api/memos', (req, res) => { const { title, content, tags } = req.body; if (!content && !title) { return res.status(400).json({ ok: false, error: '标题或内容至少要有一个' }); } const memo = createMemo({ title, content, tags }); res.status(201).json({ ok: true, memo }); }); ``` ### Technical Analysis Tag values are persisted in SQLite and later returned by `/api/memos`. In the browser, each value is interpolated into an HTML string without passing through the existing `esc()` function. The resulting string is assigned to `app.innerHTML`. Because HTML parsing occurs after interpolation, a tag can close the intended `` element and introduce arbitrary HTML elements or event-handler attributes. This is a persistent vulnerability: the malicious value remains in the database and executes whenever a user loads the memo page. ...[truncated 1777 chars]
Remediation
View remediation
' + tags.map(t => '#' + esc(String(t)) + '').join('') + '' : '') ``` 2. Prefer constructing elements through safe DOM APIs and assigning untrusted values through `textContent`: ```js const tagElement = document.createElement('span'); tagElement.className = 'tag'; tagElement.textContent = `#${tag}`; ``` 3. Validate request data on the server. Require `tags` to be an array containing only bounded strings, and reject nested objects, HTML markup where it is not needed, excessive element counts, and oversized values. ```js if ( tags !== undefined && (!Array.isArray(tags) || tags.length > 20 || tags.some(tag => typeof tag !== 'string' || tag.length > 100)) ) { return res.status(400).json({ ok: false, error: 'Invalid tags' }); } ``` Apply equivalent validation to update requests. 4. Add a restrictive Content Security Policy as defense in depth, for example by disallowing inline scripts and inline event handlers. The current inline script should first be moved to a separate JavaScript file so a policy such as `script-src 'self'` can be used. 5. Add regression tests using payloads containing element delimiters, quotation marks, event handlers, and encoded variants. Verify that they are displayed only as text and never create executable DOM nodes. 6. Treat output encoding as the primary control. Input validation and Content Security Policy should supplement, not replace, context-appropriate output encoding. ]]>
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (33)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

The README includes a destructive root command that force-removes '/etc/nginx/sites-enabled/default'. Although presented as setup guidance, it can cause unintended service disruption or overwrite assumptions on systems already using nginx, especially if users execute instructions without understanding their environment.

Content

Scanner excerpt · README.md (reported line 47)May include surrounding context.

bash
sudo cp memos.nginx.conf /etc/nginx/sites-available/memos
sudo ln -sf /etc/nginx/sites-available/memos /etc/nginx/sites-enabled/
sudo rm -f /etc/nginx/sites-enabled/default
sudo systemctl reload nginx

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared purpose is a lightweight memo tool, but the documented behavior includes service lifecycle management, Node.js server startup, PID/log handling, and nginx integration. This mismatch is security-relevant because users and reviewers may approve a low-risk note-taking skill without realizing it persists processes and exposes a networked management surface.

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

md
node scripts/memo.js list # 查看所有

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/memo.js list # 查看所有

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/memo.js list # 查看所有

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/memo.js list # 查看所有

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · README.md (reported line 84)May include surrounding context.

GET /api/memos # 获取列表 POST /api/memos # 创建 PUT /api/memos/:id # 更新 DELETE /api/memos/:id # 删除

text

## 管理

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

GET /api/memos # 获取列表 POST /api/memos # 创建 PUT /api/memos/:id # 更新 DELETE /api/memos/:id # 删除

text

## 管理

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The markdown file documents a delete feature for memos, but does not include any warning that deletion is destructive or may permanently remove stored notes. Under the markdown-specific warning criterion, behaviors affecting user data should be accompanied by a user-facing caution.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · README.md (reported line 45)May include surrounding context.

3. 配置 nginx(可选)

bash
sudo cp memos.nginx.conf /etc/nginx/sites-available/memos
sudo ln -sf /etc/nginx/sites-available/memos /etc/nginx/sites-enabled/
sudo rm -f /etc/nginx/sites-enabled/default
sudo systemctl reload nginx

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · README.md (reported line 46)May include surrounding context.

3. 配置 nginx(可选)

bash
sudo cp memos.nginx.conf /etc/nginx/sites-available/memos
sudo ln -sf /etc/nginx/sites-available/memos /etc/nginx/sites-enabled/
sudo rm -f /etc/nginx/sites-enabled/default
sudo systemctl reload nginx

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · README.md (reported line 48)May include surrounding context.

3. 配置 nginx(可选)

bash
sudo cp memos.nginx.conf /etc/nginx/sites-available/memos
sudo ln -sf /etc/nginx/sites-available/memos /etc/nginx/sites-enabled/
sudo rm -f /etc/nginx/sites-enabled/default
sudo systemctl reload nginx

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The README instructs users to copy config into /etc/nginx, replace enabled sites, remove the default site, and reload nginx, but does not warn that these actions require sudo and can affect existing web server configuration or availability. For markdown files, system-integrity-impacting behavior should be clearly disclosed.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
87% confidence
Finding

This command instructs users to delete the default nginx site as root using a force flag, which can disrupt unrelated services or existing web configuration on the host. In a README for a memo app, removing a global default site is broader than necessary and creates avoidable operational risk if copied blindly.

Content

Scanner excerpt · README.md (reported line 47)May include surrounding context.

bash
sudo cp memos.nginx.conf /etc/nginx/sites-available/memos
sudo ln -sf /etc/nginx/sites-available/memos /etc/nginx/sites-enabled/
sudo rm -f /etc/nginx/sites-enabled/default
sudo systemctl reload nginx

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill advertises and documents network-facing behavior, including a local web service on port 8080 and optional nginx reverse proxying, but does not declare any explicit tool scope or permissions. This weakens reviewability and containment because a memo skill can start exposing data over HTTP without transparent capability declaration.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The documentation explicitly includes deletion capability for memos but provides no warning that the operation is irreversible. In a note-taking context, accidental or automated invocation could cause user data loss, and the absence of cautionary UX/documentation increases that risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The installation instructions direct users to copy nginx config into system directories, create enabled-site symlinks, and reload nginx, all of which are privileged system changes. Without safety warnings, validation guidance, or rollback steps, users may unintentionally alter host-wide web server configuration and expose the memo service more broadly than intended.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The rm/delete branch issues an HTTP DELETE to remove a memo and only prints 已删除 after the action completes. There is no confirmation prompt before deletion, and the top-of-file usage comments do not warn that this command permanently deletes data.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This shell script presents its user-facing description and status messages exclusively in Chinese, including the usage text and operational feedback. That can violate language/locale policy requirements when no user opt-in or documented region-specific justification is provided.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · scripts/memos.sh (reported line 17)May include surrounding context.

sh
exit 0
    fi
    cd "$DIR"
    nohup node server.js > "$LOG_FILE" 2>&1 &
    echo $! > "$PID_FILE"
    sleep 1
    if kill -0 $! 2>/dev/null; then

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The document declares lang="zh-CN", and the UI text throughout the page is Chinese-only, indicating the skill forces a specific language/locale. Under the policy, locale constraints should either be optional for the user or clearly documented as region-specific and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The call to toLocaleString('zh-CN', ...) hard-codes Chinese locale formatting for displayed timestamps. This enforces a specific locale regardless of user preference, which matches the natural-language locale policy violation criteria.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The server enables unrestricted CORS with Access-Control-Allow-Origin: * and exposes create, read, update, and delete memo endpoints without any authentication or authorization checks. This means any website or local process that can reach the service can issue cross-origin requests to read or modify the user's memo data, which is broader than expected for a personal note-taking skill and increases the chance of unauthorized access or tampering.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This code contains multiple natural-language comments, log messages, and API error responses in Chinese only, such as the route comments and error text. Because the file does not indicate that the skill is region-specific or provide any user opt-in or language selection, it violates the language/locale policy for natural-language content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
75% confidence
Finding

The natural-language instructions and usage documentation are presented only in Chinese, which can amount to forcing a specific language without user opt-in. The file does not indicate that the skill is region-specific or provide an alternative language option.

Content

No source excerpt is available for this finding.