Back to skill

Security audit

archmap

Security checks for vulnerabilities and agentic risk

Overview

The architecture scanner is mostly coherent, but it also directs the agent to use unreviewed external helper tools and save reusable advice that can influence future runs.

Install only if you are comfortable with a project-source analyzer that writes reports under the target project's archmap directory and with its expert-router/internalization workflow. Review or disable the external expert-router, gate-switch, internalizations.jsonl reuse, and global skill promotion steps before use; install dependencies in an isolated environment with pinned versions if possible.

Vulnerability Patterns
  • 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
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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 (3)

T01 · Skill Instruction Hijacking

Error
Location
SKILL.md:336
Finding

Mandatory External Workflow Can Redirect Agent Goals and Control Task Completion

Content
View full analysis
" --top 6 3. Every advice card must receive a decision. Silent omission is prohibited. 4. Append the decisions to /archmap/expert_advice.jsonl. 5. Accepted advice must be referenced by expert_id in the delivery summary. Completion is prohibited when accepted advice has not produced an approved internalizations.jsonl record. The result of the external gate-switch command must be copied into the response. ``` The snippet is an English rendering of the mandatory directives at the cited source lines. The executable command and affected paths are preserved. ### Technical Analysis The Skill text requires the Agent to invoke an external component located outside the reviewed package, process its recommendations, incorporate accepted recommendations into the analysis, and modify the final delivery to reference external expert identifiers. It also prohibits completion until another external gate approves the resulting state. These directives exceed what is required for static architecture analysis. Because `/Users/xujin/.agents/skills/expert-router/` and the gate-switch specifications are outside this package, their contents can be changed independently after this Skill has been reviewed. Loading the Skill therefore delegates part of the current session's goals and completion criteria to mutable, separately controlled local components. The instructions also state that advice may not be silently ignored. This reduces the Agent's ability to reject irrelevant or malicious recommendations and creates an in ...[truncated 1536 chars]
Remediation
View remediation

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:367
Finding

External Advice Is Persisted and Promoted into Future Agent Behavior

Content
View full analysis
/archmap/internalizations.jsonl Before the same type of task is run again, search internalizations.jsonl by problem_family and reuse matching records. A matching specialized skill becomes the execution mainline and its steps, parameters, and pitfalls must be followed. Mature skill cards may be passed to retro-skill-dispatcher in GENERATE mode for registration in the global skill library. ``` The snippet is an English rendering of the persistent-memory directives at the cited source lines. The relevant filenames, fields, and promotion target are preserved. ### Technical Analysis The Skill does not merely save factual architecture results. It requires recommendations from an external expert-routing process to be transformed into reusable behavioral records in `internalizations.jsonl`. Later runs must consult those records, and matching specialized records are elevated into the primary execution workflow. The instructions additionally provide a path for promoting these records into a global Skill library through `retro-skill-dispatcher`. This changes project-local, externally influenced content into cross-project Agent behavior. There is no demonstrated authenticity check, trusted-author allowlist, user approval step, expiration policy, or semantic validation that limits stored records to inert factual data. An attacker who controls external recommendations or can modify the project-local JSONL file can therefore inject durable rules that affect later sessions. ### Attack Path 1. An attacker compromises the external expert-advice source or gains write access to `/archmap/internalizations.jsonl`. 2. The attacker supplies a record with a broad `problem_family` so that it matches many future tasks. 3. The Skill ins ...[truncated 1146 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
requirements.txt:5
Finding

Unpinned Dependencies Permit Mutable and Non-Reproducible Package Resolution

Content
View full analysis
=6.0 numpy>=1.24.0 scipy>=1.10.0 sentence-transformers>=2.2.0 ``` The installation instructions direct users to install this manifest with: ```bash pip3 install -r requirements.txt ``` ### Technical Analysis Every dependency is specified with only a minimum version. The resolver may therefore install any later release available from the configured package index. The effective dependency set can change over time without any modification to the reviewed project. No lock file, exact version constraints, package hashes, or trusted-index restrictions are present in the audited manifest. As a result, installations are not reproducible and cannot be reliably tied to the versions that were reviewed or tested. The optional `sentence-transformers` package introduces a comparatively large transitive dependency graph. Although the launcher configures Hugging Face model loading for offline operation, those environment settings do not protect the preceding package-installation step. Installation still obtains packages from the configured Python package source unless users separately enforce an offline or trusted installation process. ### Attack Path 1. A user follows the documented `pip3 install -r requirements.txt` instruction. 2. `pip` queries the configured package index and resolves the newest versions satisfying the lower bounds. 3. A dependency or transitive dependency is compromised, maliciously replaced, or publishes a future incompatible release. 4. The resolver downloads and installs that release because no exact version or hash rejects it. 5. Malicious installation hooks or imported package code executes with the privileges of the user running `pip` or ArchMap. 6. The compromised dependency can access data available to that user, including source code scanned ...[truncated 803 chars]
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (67)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

声明描述的是一个更高层、更通用的架构测绘与增量分析 Agent,强调调用模式分流、需求文本驱动的影响面分析、sync/diff 两类操作以及变更留痕。给定代码却是单一模块 etl_profiler.py,核心行为是:检测 ETL 项目目录;从注册表获取规则;解析源码行号;读取 YAML 配置参数;扫描配置契约;然后把结果写成多份 Markdown/JSON 报告。虽然“生成报告/影响说明/风险清单”与“架构测绘”有部分相关性,但缺失声明中的关键能力与触发语义,且实际作用域限定在 ETL 规则探查,不是所述的零参自动分流增量分析 Agent。因此属于明显描述与行为不一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

声明描述的是一个面向项目架构测绘和变更影响分析的 Agent,重点能力应包括模式分流、基线判断、增量分析、同步重生成报告、diff 影响与测试选择、历史留痕等。提供的代码却是纯后端数据/规则定义模块:它维护 ETL 规则清单(RULES)、关键词检索索引(KEYWORD_INDEX)、配置契约(CONFIG_CONTRACTS)、配置读取映射(CONFIG_READS),并实现 Registry / get_registry / _validate_registry_json 等函数,用于加载和校验项目自定义 ETL 注册表。该代码主要处理 ETL 规则元数据管理与 JSON 结构校验,而不是执行架构扫描、代码差异分析、报告生成或影响面评估。两者主目的明显不同,且代码缺失声明中的核心能力,因此属于明显不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The declared description presents a high-level architecture analysis/orchestration agent with multiple operating modes and impact-analysis features. The supplied code chunk does not implement any of those behaviors. Its sole purpose is schema-like validation of module/API/storage dictionaries and collection of validation errors. This is not just a supporting helper that obviously realizes the declared end-user features; the code’s primary behavior is materially different from the declared purpose, and none of the key advertised capabilities appear in the snippet.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

该代码与“架构测绘/影响面分析”主题部分相关,因为它确实会聚合模块、推断依赖并支持基线合并;但声明中的多数核心能力在代码中不存在。实际代码仅是一个纯内存的数据处理组件,输入是模块字典列表和可选 baseline,输出是依赖聚合结果。没有看到任何关于自动模式分流、显式命令词处理、项目扫描、需求文本解析、同步变更、差异计算到行级、测试选择、报告生成、文件落盘或历史记录的实现。因此其实际行为明显比声明窄,且缺失声明中的关键主功能,属于描述与实现不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared description presents a higher-level agent responsible for workflow routing, incremental analysis, sync/diff operations, and historical trace generation. The supplied code chunk does not implement those agent behaviors. Instead, it is a narrow rendering utility that converts module/storages metadata into Mermaid diagrams (architecture, data flow, sequence) and applies visual styles for changed modules. While diagram generation could be a supporting part of an architecture-mapping system, this chunk does not perform the core declared functions such as baseline-aware mode selection, impact analysis from requirements, sync/diff processing, diff_impact.json production, test selection, or change-history recording. Therefore the description materially overstates and misrepresents what this code actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description presents a feature-rich architecture mapping and impact-analysis agent. In contrast, this code chunk only implements a small approval/rejection decision handler. Its primary purpose is materially different from the declared purpose, and it introduces review-gate behavior (including baseline commit/discard-memory actions) that is not mentioned in the description. This is not merely a supporting detail for the declared functionality because none of the described routing, analysis, sync, diff, reporting, or history features appear in the supplied code.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The provided code implements only a narrow filesystem scanning utility for identifying top-level source-containing directories. While this could be a supporting component of an architecture-mapping system, it does not itself perform the core declared behaviors: routing between full and lite modes, incremental impact analysis based on requirements, sync/diff operations, report generation, test selection, or history retention. The primary purpose of the code chunk is module discovery, which is materially narrower than the declared agent functionality, so this is a description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The declared description presents an operational 'architecture mapping agent' with mode routing, incremental impact analysis, sync/diff workflows, and change-history outputs. The actual code chunk does not implement those agent behaviors. Instead, it is a test file that exercises ETL-profiler-related functions and validates generated ETL documentation/report artifacts, config contract scans, registry metadata, and dependency logic using pytest. While both involve analysis/reporting in a broad sense, the primary purpose and concrete capabilities are materially different. This is not merely an internal support detail; the code lacks the core declared agent features and instead targets ETL rule profiling test coverage.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

声明描述的是一个面向架构测绘与增量影响分析的 Agent 能力集合,核心在 full/lite 分流、baseline 管理、sync/diff 触发和影响面/测试选择输出。而实际代码并不是该 Agent 的实现,也不是这些能力的调度逻辑;它只是一个测试文件,验证 ETL 注册表加载、错误处理、目录检测、配置读取及 ETL 报告产出是否符合预期。虽然代码中出现 BaselineManager 和 generate_etl_reports 等词汇,说明它可能属于同一项目的一部分,但本代码块实际行为与声明中的主要能力并不对应,尤其缺少 full/lite 自动分流、+sync、+diff、行级差异分析、测试选择与历史留痕等关键功能。因此该描述不能准确代表此代码块的实际作用,属于明显不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The supplied code only implements a low-level worker that reads source files from a module path, heuristically extracts APIs/storages/imports, validates the result, and computes directory hashes. While the hashing could support incremental/sync workflows, none of the declared orchestration features are present in this chunk: there is no mode selection logic, no baseline-aware routing, no parsing of requirement text, no synchronization/report regeneration, no diff artifact emission, and no history logging. Therefore the declared description materially overstates and misrepresents what this code chunk actually does.

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

md
h_index JSON 均携带 priority 标识,summary 含 priority_counts 与 parse_depth 统计;单条规则可在 `etl_rule_registry.py` 显式写 `priority` 字段覆盖推导

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
h_index JSON 均携带 priority 标识,summary 含 priority_counts 与 parse_depth 统计;单条规则可在 `etl_rule_registry.py` 显式写 `priority` 字段覆盖推导

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · archmap_agent/etl_rule_registry.py (reported line 520)May include surrounding context.

python
def rule_priority(rule: dict) -> str:
    """规则解析优先级:P0 深度解析 / P1 标准解析 / P2 轻量解析(仅文件存在性检查)。"""
    return rule.get("priority") or RISK_TO_PRIORITY.get(rule["risk_level"], "P1")


def layer_name(code: str) -> str:

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · archmap_agent/etl_rule_registry.py (reported line 671)May include surrounding context.

python
def rule_priority(rule: dict) -> str:
    """规则解析优先级:P0 深度解析 / P1 标准解析 / P2 轻量解析(仅文件存在性检查)。"""
    return rule.get("priority") or RISK_TO_PRIORITY.get(rule["risk_level"], "P1")


def layer_name(code: str) -> str:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · archmap_agent/module_detail_analyzer.py (reported line 35)May include surrounding context.

python
DEFAULT_BLACKLIST = {
    "node_modules", "dist", "build", "target", "__pycache__", ".git",
    ".svn", ".hg", "venv", ".venv", "env", ".env", "site-packages",
    "test", "tests", "spec", "specs", "coverage", ".pytest_cache",
    ".archmap", "archmap", ".agent_backup", "backup", "backups", "ckpt", "tmp", "temp",
    "logs", "log", "snapshots", "snapshot", "cache", "caches",

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · archmap_agent/source_scanner.py (reported line 6)May include surrounding context.

python
DEFAULT_BLACKLIST = {
    "node_modules", "dist", "build", "target", "__pycache__", ".git",
    ".svn", ".hg", "venv", ".venv", "env", ".env", "site-packages",
    "test", "tests", "spec", "specs", "coverage", ".pytest_cache",
    ".archmap", "archmap", ".agent_backup", "backup", "backups", "ckpt", "tmp", "temp",
    "logs", "log", "snapshots", "snapshot", "cache", "caches",

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The entire skill description, invocation guidance, and operational instructions are presented only in Chinese, with no indication that users may choose another language or that the skill is intentionally limited to a Chinese-speaking context. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill declares broad operational behavior including shell execution, filesystem reads/writes, environment access, and potential network-capable dependency installation, but it does not define an explicit tool/permission scope. In an agent environment, this increases the risk of overprivileged execution and makes it harder for a caller or policy layer to constrain dangerous side effects.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill description and operational instructions are written entirely in Chinese and repeatedly use Chinese trigger terms such as '同步' and Chinese requirement text examples, with no indication that other languages are supported or that the user can choose a preferred language. This creates a locale/language constraint in the natural-language interface without documented opt-in or justification as a region-specific tool.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill presents itself as a 'pure analysis' component, but it also invokes external helper skills and writes cross-skill advisory/internalization logs. That expands the trust boundary and creates hidden side effects, which can leak project context to other components or enable unreviewed behavior outside the stated architecture-mapping scope.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The expert-router and self-learning/internalization features are unrelated to core architecture mapping and cause the skill to consult external logic and persist derived knowledge about user projects. In a security-sensitive agent setting, this broadens data exposure, increases non-obvious execution paths, and may create long-lived records containing sensitive architectural details.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest explicitly advertises a '+diff' capability that produces line-level diff impact analysis and test selection. However, the CLI only accepts modes 'full', 'incremental', 'sync', and 'lite', so the documented diff mode cannot be invoked directly through this interface even though a run_diff function exists in code.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The default report_templates are all named in Chinese, which indicates the skill is configured to produce or organize outputs in a specific language by default. The file does not offer a language choice or explain a region-specific reason for this locale constraint, which conflicts with the policy against forcing a language without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The module docstring and embedded user-oriented text are entirely in Chinese and describe operational behavior and generated documentation in that language. There is no indication that users can choose another language or that the locale restriction is intentionally limited to a justified region-specific use case.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module docstring and all generated report headings/content are written exclusively in Chinese, indicating the skill is designed to produce outputs in a fixed language. There is no visible opt-in, locale selection, or justification that this is a region-specific tool, so this is a natural-language locale policy concern.

Content

No source excerpt is available for this finding.