Back to skill

Security audit

CDA Code Lab

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed CDA simulation code-generation guide, with reliability and dependency cautions but no hidden execution, persistence, credential access, or exfiltration behavior found.

Install only if you want a Chinese-language CDA/PyTorch code-generation aid. Treat its generated simulation code as a prototype: validate JSON inputs, cap tensor and network sizes, pin dependencies, and review physical-invariant logic before using results for research or decisions.

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

Warning
Location
references/component-specs.md:548
Finding

Untrusted JSON Input Can Control Tensor and Neural-Network Allocations

Content
View full analysis

Vulnerability Details

File Location: references/component-specs.md:548-656
Vulnerability Type: Unbounded resource allocation from unvalidated input
Risk Level: Medium

Vulnerable Code

python
def load_graph(path: str) -> Tuple[Dict[int, EntityState], List[CausalEdge]]:
    """Load a causal graph from .graph.json."""
    with open(path) as f:
        data = json.load(f)

    entities = {}
    for e_data in data['entities']:
        entity = EntityState(
            id=e_data['id'],
            name=e_data['name'],
            type=e_data['type'],
            domain=e_data['domain'],
            q=torch.tensor(e_data['position']['values'], dtype=torch.float64),
            p=torch.tensor(e_data['momentum']['values'], dtype=torch.float64),
            attributes=_convert_attrs(e_data['attributes']),
            belief_mean=torch.tensor(e_data['belief']['mean'], dtype=torch.float64),
            belief_cov=torch.tensor(
                e_data['belief']['covariance'],
                dtype=torch.float64,
            ),
        )
        entities[entity.id] = entity

    edges = []
    for e_data in data['edges']:
        mechanism = _create_mechanism(e_data)
        edge = CausalEdge(
            source_id=e_data['source_id'],
            target_id=e_data['target_id'],
            mechanism=mechanism,
            mechanism_type=e_data['mechanism_type'],
            strength=e_data['strength'],
            delay=e_data['delay'],
            confidence=e_data['confidence'],
        )
        edges.append(edge)

    return entities, edges
python
elif m_type == 'pinn_learned':
    pinn_cfg = params.get('pinn_params', {})
    return PINNMechanism(
        state_dim=pinn_cfg.get('input_dim', 6),
        hidden_dims=pinn_cfg.get('network_arch', [64, 64, 32]),
    )
else:
    from src.mechanisms.causal_mechanism import CausalMechanismFunction
    return CausalMechanismFunction(
        causal_type=m_type,
        state_dim=params.get('
...[truncated 2569 chars]
Remediation
View remediation

Remediation Suggestions

  1. Enforce a maximum input-file size before calling json.load().
  2. Validate every document against a strict JSON Schema before constructing tensors or models.
  3. Set explicit upper bounds for:
    • Entity and edge counts.
    • State-vector dimensions.
    • Covariance dimensions.
    • Number of neural-network layers.
    • Width of each layer.
    • Total estimated model parameter count.
  4. Calculate the expected allocation size before constructing tensors or modules and reject inputs exceeding a configured memory budget.
  5. Reject negative, non-integer, zero, excessively large, or otherwise invalid architecture dimensions.
  6. Require all physical and statistical values to be finite; reject NaN and infinity.
  7. Verify that belief covariance matrices are square, symmetric, dimensionally consistent, and positive definite.
  8. Validate that entity identifiers are unique and that every edge references existing entities.
  9. Constrain mechanism types and function forms to an explicit allowlist.
  10. Apply process-level memory, CPU, and execution-time limits when processing externally supplied datasets.
  11. Return controlled validation errors rather than allowing raw allocation or linear-algebra exceptions to terminate the application.

T08 · Insecure Dependencies

Note
Location
references/implementation-guide.md:268
Finding

Dependency Versions Are Not Locked or Integrity-Verified

Content
View full analysis

Vulnerability Details

File Location: references/implementation-guide.md:268-275
Vulnerability Type: Non-reproducible and unverified dependency resolution
Risk Level: Low

Vulnerable Configuration

text
# requirements.txt
torch>=2.0.0
numpy>=1.24.0
scipy>=1.10.0
matplotlib>=3.7.0
pandas>=2.0.0
text
Exact minor versions are not pinned; only minimum versions are specified.
Reproducibility is provided through set_seed() rather than dependency
version locking.

Technical Analysis

The implementation guide instructs generated projects to use open-ended minimum-version constraints. A package installer may therefore select any later compatible release available at installation time. The resolved environment can change without any modification to the generated project.

Random-number seeding does not provide package integrity or build reproducibility. It cannot prevent dependency behavior, APIs, binary implementations, transitive dependency trees, or installation artifacts from changing.

The configuration also provides no cryptographic hashes or reviewed lockfile. Consequently, it cannot verify that downloaded artifacts match a previously approved dependency set. Although the listed package names are legitimate and no malicious package is directly introduced by the project, this policy unnecessarily increases exposure to compromised releases, incompatible future versions, and supply-chain changes.

Attack Path

  1. A generated project retains the documented open-ended dependency constraints.
  2. A user or automated deployment installs the requirements at a later date.
  3. The package resolver selects newer direct or transitive dependency releases than those originally reviewed or tested.
  4. A selected release contains an incompatible change, security defect, or compromised installation artifact.
  5. The dependency code runs during installation, import, training, or simulation under the privileges of the invoking enviro ...[truncated 746 chars]
Remediation
View remediation

Remediation Suggestions

  1. Generate and maintain a reviewed lockfile containing exact direct and transitive dependency versions.
  2. Include cryptographic hashes for approved distributions and install with hash verification, such as pip's --require-hashes.
  3. Separate abstract compatibility requirements from the concrete, deployable lockfile.
  4. Use only trusted package indexes and explicitly configure the expected index rather than permitting arbitrary additional indexes.
  5. Build and test dependencies in an isolated virtual environment or container without unnecessary credentials or host permissions.
  6. Run software-composition analysis and vulnerability scans against every dependency update.
  7. Adopt a controlled update process that regenerates the lockfile, reviews release changes, executes the full test suite, and records approval.
  8. Where platform-specific wheels make a single lockfile impractical, maintain reviewed lockfiles for each supported Python version and operating-system target.
  9. Do not describe random seeding as a substitute for environment locking; document it only as a control for algorithmic randomness.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (12)

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The trigger conditions are broad and include many generic technical terms, which can cause the skill to activate in contexts beyond tightly scoped CDA code-generation requests. In an agent setting, overbroad activation increases the chance that this skill is invoked on unrelated prompts and generates executable code or follows internal workflow assumptions without sufficient user intent validation.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file is written as an instruction/specification document entirely in Chinese, including headings, descriptions, and implementation guidance, with no indication that users may choose another language. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documentation claims a constrained Hamiltonian projection using Lagrange multipliers and gradient-based correction, but the implementation only applies a heuristic rescaling of q and p. This mismatch can mislead downstream code generators or users into assuming physical invariants are enforced when they are not, producing unsafe or invalid simulation behavior that could silently corrupt scientific or decision-support results.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This markdown file is subject to natural-language policy checks. Line L010 states that all CDA components 'must comply' with this specification, but the specification is written in Chinese and does not offer any language or locale opt-in, which can amount to forcing a specific language on downstream users or components.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This markdown file contains user-facing instructional content exclusively in Chinese, including headings, descriptions, and code comments. Under the policy rule, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is clearly documented and justified, which is not present here.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The helper is documented at L0965 as obtaining the entity's recent state change, implying access to historical state information. The implementation at L0966-L0967 explicitly does not use history and instead returns the current state's absolute q magnitude as a Phase 1 simplification, which contradicts the stated behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file is primarily written as a normative implementation guide in Chinese, and it does not indicate that other languages are supported or that Chinese is required for a region-specific reason. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.