Skip to content

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

    llm05-output-to-html

    View as Markdown

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

    seceng.llm05.react-dangerously-set-inner-html

    Section titled “seceng.llm05.react-dangerously-set-inner-html”

    warning javascript, typescript react

    Model-controlled, retrieved, or tool-controlled content may be rendered through dangerouslySetInnerHTML. Confirm whether the source is trusted and sanitized.

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

    Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).

    CWE-79 LLM05 ASI05

    Fix: Render untrusted output as React text children. If rich HTML is required, pass it through a maintained HTML sanitizer before assigning it to dangerouslySetInnerHTML.

    References: https://react.dev/reference/react-dom/components/common#dangerously-setting-the-inner-html

    Also reported under the older id seceng.react.ai-dangerously-set-inner-html.

    warning javascript, typescript llm05-output-to-html

    Assignment to innerHTML or outerHTML may render model, retrieved, or tool output as executable HTML. Confirm sanitizer use and source trust.

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

    Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).

    CWE-79 LLM05 ASI05

    Fix: Use textContent for plain text. If rich HTML is required, sanitize it before assigning it to innerHTML or outerHTML.

    References: https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML#security_considerations

    warning javascript, typescript llm05-output-to-html

    Markdown rendering appears to allow raw HTML. If model or retrieved content reaches this renderer, this can become XSS.

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

    Edge inspected: writes one thing writes to another.

    CWE-79 LLM05 ASI06

    Fix: Sanitize the HTML produced by Marked before inserting it into the document. Apply the sanitizer after Markdown rendering so it also checks the markup emitted by the renderer.

    References: https://marked.js.org/#usage

    warning generic llm05-output-to-html

    Vue v-html renders raw HTML. Confirm model, retrieved, or tool output cannot reach this sink without sanitization.

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

    Edge inspected: calls one thing invokes another.

    CWE-79 LLM05 ASI05

    Fix: Render untrusted output with Vue text interpolation. If rich HTML is required, sanitize it before passing it to v-html.

    References: https://vuejs.org/guide/best-practices/security.html#html-injection