Skip to content

    Type a page, a command such as keryn scan, or a rule id.

    llm03-supply-chain

    View as Markdown

    5 rules · Keryn Software Licence · rules 0.8.0 · all packs

    How to read a rule
    Severity
    How bad the finding is if it is real: error fails a default gate, warning and info do not.
    Confidence
    P0 exploitable as written; P1 dangerous in context; P2 a heuristic or a posture check: confirm by reading the code.
    False-positive risk
    low: an exact API or flag, so hits are almost always real; medium: the pattern is legitimate in many programs, so check each hit; high: it finds a lead to confirm, so expect benign hits.
    Edge
    The relationship the finding sits on. reaches: content or traffic gets to a thing; calls: one thing invokes another; reads: one thing reads from another; writes: one thing writes to another; sends: data leaves for another party; grants: authority is given or left unchecked; depends_on: something relies on a component it does not verify; trusts: one party believes another without evidence. The boundary it crosses, when there is one: user->prompt (untrusted input reaching a prompt); model->code (model output reaching code, a shell, a query or a page); secret->outside (a secret leaving the trusted side); supply-chain (code, models or prompts pulled in from outside).
    Taxonomy chips
    References for readers who work in OWASP LLM 2025, OWASP Agentic, CWE or NIST AI RMF. They say where a rule belongs, not that a framework is satisfied.

    warning python llm03-supply-chain

    Running ‘pip install’ from within code without version pinning. This is a significant supply chain risk.

    Confidence P1: dangerous in context. False-positive risk high: it finds a lead to confirm, so expect benign hits.

    Edge inspected: depends_on something relies on a component it does not verify; it crosses the supply-chain boundary (code, models or prompts pulled in from outside).

    CWE-829 LLM03 ASI04

    Try it: a snippet that triggers this rule

    Written for this page, not taken from any project. Save it as runtime/deps.py and scan it with keryn scan runtime --verbose; the finding below appears.

    runtime/deps.py
    import importlib
    import os
    def ensure(module: str, package: str):
    try:
    return importlib.import_module(module)
    except ImportError:
    os.system("pip install " + package)
    return importlib.import_module(module)

    Checked with Keryn’s browser engine when this page was built: it reports seceng.llm03.python-pip-install-in-code at line 9 (warning, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.

    error javascript, typescript llm03-supply-chain

    Running ‘npm install’ from within code. This is a significant supply chain risk.

    Confidence P1: dangerous in context. False-positive risk low: an exact API or flag, so hits are almost always real.

    Edge inspected: depends_on something relies on a component it does not verify; it crosses the supply-chain boundary (code, models or prompts pulled in from outside).

    CWE-829 LLM03 ASI04

    Try it: a snippet that triggers this rule

    Written for this page, not taken from any project. Save it as scripts/plugins.js and scan it with keryn scan scripts --verbose; the finding below appears.

    scripts/plugins.js
    const { exec } = require("child_process");
    function installPlugin(name) {
    const child = exec("npm install " + name);
    child.stdout.pipe(process.stdout);
    child.on("exit", (code) => {
    if (code !== 0) console.error(`install of ${name} failed`);
    });
    }
    installPlugin(process.argv[2]);

    Checked with Keryn’s browser engine when this page was built: it reports seceng.llm03.js-ts-npm-install-in-code at line 4 (error, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.

    warning python, javascript, typescript huggingface

    Dynamic model weight download detected from a URL. Prefer local, verified model files or pinned HuggingFace revisions.

    Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: depends_on something relies on a component it does not verify; it crosses the supply-chain boundary (code, models or prompts pulled in from outside).

    CWE-494 LLM03 ASI04

    warning python pytorch

    Use of unsafe loading with torch.load() or joblib.load(). Models saved as pickles can execute arbitrary code during loading. Set ‘weights_only=True’ for PyTorch or use safer formats like Safetensors.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk high: it finds a lead to confirm, so expect benign hits.

    Edge inspected: depends_on something relies on a component it does not verify; it crosses the supply-chain boundary (code, models or prompts pulled in from outside).

    CWE-502 LLM03 ASI04

    info python llm03-supply-chain

    Loading model weights from potentially unsafe formats (.bin, .pt). Prefer using the .safetensors format to mitigate arbitrary code execution risks.

    Confidence P1: dangerous in context. False-positive risk high: it finds a lead to confirm, so expect benign hits.

    Edge inspected: depends_on something relies on a component it does not verify.

    CWE-502 LLM03 ASI05 ASI04