Back to skill

Security audit

eml to sqlite indexer

Security checks for vulnerabilities and agentic risk

Overview

This email-indexing skill matches its stated purpose, but it needs review because it handles sensitive mail data and includes weak admin/security controls that could expose or delete files.

Install only in a controlled local environment, change the admin password before use, avoid exposing the Flask server beyond trusted hosts, and treat all indexed emails and restored backups as untrusted. Review or patch the XSS, default-credential, restore validation, resource-limit, and file-deletion path-containment issues before using it on important mail archives.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (6)

T09 · Insecure Skill Coding Practices

Error
Location
templates/index.html:232
Finding

Stored DOM-Based Cross-Site Scripting Through Indexed Email Metadata

Content
View full analysis
{ const row = document.createElement('tr'); row.className = 'email-row'; let html = ` ${email.sent_time} ${email.sender} ${email.subject} `; if (showAdmin) { html += `🗑️`; } row.innerHTML = html; resultsBody.appendChild(row); }); ``` ### Technical Analysis The sender, subject, and date values originate in EML headers and are stored without content sanitization. The search API returns these fields as JSON, after which the browser interpolates them into an HTML string and assigns that string to `innerHTML`. JSON encoding does not make values safe for insertion into an HTML parsing context. A malicious EML header containing HTML event handlers or other executable markup will therefore be parsed and executed by the browser. The detail template uses Jinja autoescaping, but that protection does not apply to this client-side `innerHTML` operation. ### Attack Path 1. An attacker sends or supplies an EML file with a malicious `Subject`, `From`, or `Date` header. 2. `indexer.py` parses the header and stores the malicious value in SQLite. 3. A permitted user or administrator opens the search page. 4. The `/search` endpoint returns the malicious value in JSON. 5. The page inserts it into `row.innerHTML`. 6. The payload executes in the EML indexer's browser origin. 7. If the victim has entered administrator Basi ...[truncated 570 chars]
Remediation
View remediation
{ window.open(`/email/${encodeURIComponent(email.id)}`, '_blank'); }); row.appendChild(senderCell); ``` ]]>

T09 · Insecure Skill Coding Practices

Error
Location
app.py:21
Finding

Known Default Administrator Credential Transmitted Using Cleartext HTTP Basic Authentication

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
app.py:287
Finding

Physical File Deletion Is Not Confined to an Authorized Email Directory

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
app.py:245
Finding

CSV Formula Injection Through Exported Email Fields

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
app.py:349
Finding

Unbounded Search, Export, and Restore Operations Permit Resource Exhaustion

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Third-Party Dependencies Are Not Version-Pinned

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (32)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The supplied code chunk does implement part of the declared purpose: indexing EML files into an SQLite database with deduplication. However, the description claims several major capabilities not present in this code, including a web interface, search/management operations, Excel export, file deletion, IP-based access control, and JSON automated backup/restore. The actual code is a standalone indexer script invoked from the command line and does not expose those features. Therefore, the declared description materially overstates what this code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The supplied code chunk is a third-party Bootstrap JavaScript library file, not application logic for indexing EML files or managing an email database. Its purpose is to provide reusable browser UI behaviors and event handling. While such a library could support a web interface, this chunk does not implement the declared functionality and instead has a materially different primary purpose. Therefore, the description does not accurately represent what this specific code chunk actually does.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file states that an administrator can delete a message from the web UI, removing both the database record and the physical disk file. Although the behavior is described, there is no explicit warning that this action is destructive and may be irreversible, which is important for user safety in markdown documentation.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill describes capabilities that inherently require reading and writing local files, but it does not declare any explicit tool scope or permission boundaries. This creates a transparency and least-privilege problem: operators cannot easily assess what filesystem access the skill expects, and a deployment system may grant broader access than necessary.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The documentation advertises deletion of physical email files but does not clearly warn about irreversible data loss or describe safeguards such as confirmation prompts, backups, or scope restrictions. In a management interface, destructive actions against disk files can lead to accidental or unauthorized loss of evidence, records, or business data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Restore functionality can overwrite current indexed data, reintroduce stale or tampered records, or destroy existing state if used incorrectly, yet the documentation does not warn about overwrite and data-loss risks. Because restore is exposed through a web interface, misuse becomes more dangerous in operational environments where non-expert users may trigger it.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The delete endpoint removes the database record first and then attempts to delete whatever absolute .eml path is stored for that record, without constraining deletion to an application-owned mail store directory. If an attacker or corrupted restore inserts an arbitrary absolute path ending in .eml, an authenticated localhost admin action can delete unrelated files on disk, making this a real destructive capability beyond simple indexing.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This route deletes a database record and may also remove the underlying .eml file from disk, which is a destructive and potentially irreversible operation. Although the endpoint is admin-protected, there is no confirmation prompt, user-visible warning, logging statement, or explanatory docstring/comment that clearly discloses the deletion impact to the user.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code treats any existing absolute path ending in .eml as deletable and only blocks simple '..' patterns, which is not a sufficient filesystem boundary. Because restored JSON can populate file_path and deletion later trusts that value, this creates an arbitrary file deletion path for any .eml file reachable by the process.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The restore endpoint accepts an uploaded ZIP, writes it to a fixed filename on disk, and imports untrusted JSON into the database with minimal validation. In this app's context, restored data can influence later behavior such as file deletion targets and can also enable local disk clobbering/race issues because all restores use the same temp_restore.zip path.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code includes user-visible strings and instructional text entirely in Traditional Chinese, such as docstrings and console output, without offering any language selection or documenting a locale-specific constraint. That creates a natural-language policy issue if the skill is expected to be generally usable rather than explicitly region-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The markdown describes that users can upload a ZIP backup to restore data, but it does not warn that restoration may overwrite current indexed data or otherwise alter existing records. Because this is a data-affecting operation in a markdown skill description, a user-facing warning about the impact to existing data should be present.

Content

No source excerpt is available for this finding.

Unbounded Resource Access

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.

Content

Scanner excerpt · static/js/bootstrap.bundle.min.js (reported line 6)May include surrounding context.

js
* Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).bootstrap=e()}(this,function(){"use strict";const t=new Map,e={set(e,i,n){t.has(e)||t.set(e,new Map);const s=t.get(e);s.has(i)||0===s.size?s.set(i,n):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(s.keys())[0]}.`)},get:(e,i)=>t.has(e)&&t.get(e).get(i)||null,remove(e,i){if(!t.has(e))return;const n=t.get(e);n.delete(i),0===n.size&&t.delete(e)}},i="transitionend",n=t=>(t&&window.CSS&&window.CSS.escape&&(t=t.replace(/#([^\s"#']+)/g,(t,e)=>`#${CSS.escape(e)}`)),t),s=t=>null==t?`${t}`:Object.prototype.toString.call(t).match(/\s([a-z]+)/i)[1].toLowerCase(),o=t=>{t.dispatchEvent(new Event(i))},r=t=>!(!t||"object"!=typeof t)&&(void 0!==t.jquery&&(t=t[0]),void 0!==t.nodeType),a=t=>r(t)?t.jquery?t[0]:t:"string"==typeof t&&t.length>0?document.querySelector(n(t)):null,l=t=>{if(!r(t)||0===t.getClientRects().length)return!1;const e="visible"===getComputedStyle(t).getPropertyValue("visibility"),i=t.closest("details:not([open])");if(!i)return e;if(i!==t){const e=t.closest("summary");if(e&&e.parentNode!==i)return!1;if(null===e)return!1}return e},c=t=>!t||t.nodeType!==Node.ELEMENT_NODE||!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")),h=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?h(t.parentNode):null},d=()=>{},u=t=>{t.offsetHeight},f=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,p=[],m
...[truncated 27 chars]

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · templates/index.html (reported line 101)May include surrounding context.

html
<div class="card-container">
                            <h5 class="mb-3">🛡️ IP 存取控制</h5>
                            <p class="text-muted small">設定允許存取此網頁的 IP 位址。Localhost 永遠被允許。</p>
                            <div id="ipList" class="mb-3"></div>
                            <div class="input-group">
                                <input type="text" id="newIp" class="form-control" placeholder="輸入新 IP (例如 192.168.1.10)">
                                <button id="addIpBtn" class="btn btn-success">➕ 新增</button>

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · templates/index.html (reported line 257)May include surrounding context.

html
<div class="card-container">
                            <h5 class="mb-3">🛡️ IP 存取控制</h5>
                            <p class="text-muted small">設定允許存取此網頁的 IP 位址。Localhost 永遠被允許。</p>
                            <div id="ipList" class="mb-3"></div>
                            <div class="input-group">
                                <input type="text" id="newIp" class="form-control" placeholder="輸入新 IP (例如 192.168.1.10)">
                                <button id="addIpBtn" class="btn btn-success">➕ 新增</button>

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · templates/index.html (reported line 262)May include surrounding context.

html
<div class="card-container">
                            <h5 class="mb-3">🛡️ IP 存取控制</h5>
                            <p class="text-muted small">設定允許存取此網頁的 IP 位址。Localhost 永遠被允許。</p>
                            <div id="ipList" class="mb-3"></div>
                            <div class="input-group">
                                <input type="text" id="newIp" class="form-control" placeholder="輸入新 IP (例如 192.168.1.10)">
                                <button id="addIpBtn" class="btn btn-success">➕ 新增</button>

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · templates/index.html (reported line 263)May include surrounding context.

html
<div class="card-container">
                            <h5 class="mb-3">🛡️ IP 存取控制</h5>
                            <p class="text-muted small">設定允許存取此網頁的 IP 位址。Localhost 永遠被允許。</p>
                            <div id="ipList" class="mb-3"></div>
                            <div class="input-group">
                                <input type="text" id="newIp" class="form-control" placeholder="輸入新 IP (例如 192.168.1.10)">
                                <button id="addIpBtn" class="btn btn-success">➕ 新增</button>

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · templates/index.html (reported line 270)May include surrounding context.

html
<div class="card-container">
                            <h5 class="mb-3">🛡️ IP 存取控制</h5>
                            <p class="text-muted small">設定允許存取此網頁的 IP 位址。Localhost 永遠被允許。</p>
                            <div id="ipList" class="mb-3"></div>
                            <div class="input-group">
                                <input type="text" id="newIp" class="form-control" placeholder="輸入新 IP (例如 192.168.1.10)">
                                <button id="addIpBtn" class="btn btn-success">➕ 新增</button>

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · templates/index.html (reported line 284)May include surrounding context.

html
<div class="card-container">
                            <h5 class="mb-3">🛡️ IP 存取控制</h5>
                            <p class="text-muted small">設定允許存取此網頁的 IP 位址。Localhost 永遠被允許。</p>
                            <div id="ipList" class="mb-3"></div>
                            <div class="input-group">
                                <input type="text" id="newIp" class="form-control" placeholder="輸入新 IP (例如 192.168.1.10)">
                                <button id="addIpBtn" class="btn btn-success">➕ 新增</button>

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · templates/index.html (reported line 325)May include surrounding context.

html
<div class="card-container">
                            <h5 class="mb-3">🛡️ IP 存取控制</h5>
                            <p class="text-muted small">設定允許存取此網頁的 IP 位址。Localhost 永遠被允許。</p>
                            <div id="ipList" class="mb-3"></div>
                            <div class="input-group">
                                <input type="text" id="newIp" class="form-control" placeholder="輸入新 IP (例如 192.168.1.10)">
                                <button id="addIpBtn" class="btn btn-success">➕ 新增</button>

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code wires the restore button directly to file selection and posts the chosen ZIP to /api/restore, then reloads the page, but provides no warning that restoring may overwrite existing data or change system state. For a safety-critical restore action, the UI should disclose the impact before the upload begins.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

Exporting original file paths can disclose sensitive host information such as usernames, mount points, project names, or directory structures, but the documentation does not warn users about this privacy exposure. While lower severity than destructive actions, path disclosure can aid reconnaissance and unintentionally leak internal environment details when CSVs are shared externally.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

The file structure labels SKILL.md specifically as 'Skill documentation (English)', while a Traditional Chinese version is placed separately in references. This suggests a default language requirement rather than presenting language choice up front, which may conflict with language/locale flexibility expectations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

Multiple user-visible strings, comments, and responses are written exclusively in Traditional Chinese, and the application does not provide any language selection or opt-in behavior. Under the policy, forcing a specific language without user choice is a natural-language policy violation unless the locale restriction is clearly documented and justified.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The manifest mentions IP access control and integrated backup/restore, but the code also provides a mutable admin configuration API that can change the administrator password, backup schedule, retention, and network allowlist at runtime. That capability is an operational control plane rather than an obvious requirement of indexing EML messages itself.

Content

No source excerpt is available for this finding.