Skip to content

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

    llm01-advanced-contextual-v2

    View as Markdown

    14 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 llm01-advanced-contextual

    User-controlled input is passed into a multimodal image_url payload. This can enable visual prompt injection through attacker-controlled images.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).

    CWE-20 LLM01 ASI01

    warning javascript, typescript llm01-advanced-contextual

    User-controlled input is passed into a multimodal image_url payload. This can enable visual prompt injection through attacker-controlled images.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).

    CWE-20 LLM01 ASI01

    warning python llm01-advanced-contextual

    User-controlled input is passed into an audio or base64 multimodal payload. This can enable hidden instruction injection through attacker-controlled media.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).

    CWE-20 LLM01 ASI01

    seceng.llm01.multimodal-user-audio-input-js

    Section titled “seceng.llm01.multimodal-user-audio-input-js”

    warning javascript, typescript llm01-advanced-contextual

    User-controlled input is passed into an audio or base64 multimodal payload. This can enable hidden instruction injection through attacker-controlled media.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).

    CWE-20 LLM01 ASI01

    seceng.llm01.retrieved-document-to-prompt-context

    Section titled “seceng.llm01.retrieved-document-to-prompt-context”

    warning python llm01-advanced-contextual

    Retrieved external document content is inserted into model prompt context without visible sanitization. This is a second-order prompt injection risk.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).

    CWE-94 CWE-20 LLM01 ASI01 ASI06

    seceng.llm01.database-record-to-system-prompt

    Section titled “seceng.llm01.database-record-to-system-prompt”

    warning python llm01-advanced-contextual

    Database content is used as a system prompt without visible sanitization. A poisoned record can alter model behavior.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: writes one thing writes to another.

    CWE-94 CWE-20 LLM01 ASI01 ASI06

    warning python llm01-advanced-contextual

    Web-scraped content is inserted into model context without visible filtering. Attacker-controlled pages can inject instructions into the model.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).

    CWE-20 LLM01 ASI01

    warning python data-flow rule llm01-advanced-contextual

    User-controlled input flows into the model parameter. This can enable model downgrade attacks or bypass of approved model routing.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).

    CWE-20 LLM01 LLM10 ASI01 ASI08

    seceng.llm01.model-name-user-controlled-js

    Section titled “seceng.llm01.model-name-user-controlled-js”

    warning javascript, typescript data-flow rule llm01-advanced-contextual

    User-controlled input flows into the model parameter. This can enable model downgrade attacks or bypass of approved model routing.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).

    CWE-20 LLM01 LLM10 ASI01 ASI08

    seceng.llm01.system-user-role-flip-contextual

    Section titled “seceng.llm01.system-user-role-flip-contextual”

    warning python llm01-advanced-contextual

    Content sourced from a system or developer message is later sent as a user message in a downstream model call. This can enable agent hijacking across model boundaries.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: calls one thing invokes another.

    CWE-116 CWE-20 LLM01 LLM07 ASI02 ASI01

    seceng.llm01.openai-assistants-hardcoded-thread

    Section titled “seceng.llm01.openai-assistants-hardcoded-thread”

    warning python openai

    Hardcoded OpenAI Assistants thread_id detected. Reusing a persistent thread across users can leak data or preserve malicious state.

    Confidence 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.

    Edge inspected: grants authority is given or left unchecked.

    CWE-200 CWE-639 LLM01 LLM07 LLM08 ASI01 ASI06

    seceng.llm01.openai-assistants-hardcoded-thread-js

    Section titled “seceng.llm01.openai-assistants-hardcoded-thread-js”

    warning javascript, typescript openai

    Hardcoded OpenAI Assistants thread_id detected. Reusing a persistent thread across users can leak data or preserve malicious state.

    Confidence 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.

    Edge inspected: grants authority is given or left unchecked.

    CWE-200 CWE-639 LLM01 LLM07 LLM08 ASI01 ASI06

    seceng.llm01.missing-safety-sidecar-openai-python

    Section titled “seceng.llm01.missing-safety-sidecar-openai-python”

    info python openai

    OpenAI model call found in a Python file without visible import of guardrails, llm_guard, rebuff, nemoguardrails, or equivalent safety sidecar.

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

    Edge inspected: trusts one party believes another without evidence.

    CWE-693 LLM01 ASI01

    Also reported under the older id seceng.llm01.missing-safety-guardrail-policy.

    warning javascript, typescript browser-extension

    Prompt, persona, system instruction, or developer instruction content is written to browser storage. This exposes sensitive prompt state to users and extensions.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: sends data leaves for another party.

    CWE-312 LLM07 ASI01