Skip to content

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

    agent-outbound-actions-v1

    View as Markdown

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

    keryn.outbound.model-output-as-message-recipient-js

    Section titled “keryn.outbound.model-output-as-message-recipient-js”

    error javascript, typescript data-flow rule resend, nodemailer, sendgrid, twilio, slack

    The recipient of an outbound message (email “to”, SMS “to”, Slack channel) comes from the model’s output. A prompt-injected or hallucinated answer then decides who receives the agent’s messages, which is the exfiltration and spam path for anything the agent knows. Choose recipients from the task’s data or a fixed allowlist and let the model draft only the content.

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

    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-441 CWE-200 LLM06 LLM02 ASI02 ASI01

    Fix: Resolve the recipient from the CRM record, ticket or user session the task is about, compare it with an allowlist of domains or channels, and pass only the model’s text as the subject/body; log every send with the resolved recipient.

    References: https://resend.com/docs/api-reference/emails/send-email · https://nodemailer.com/message · https://www.twilio.com/docs/sendgrid/api-reference/mail-send/mail-send · https://www.twilio.com/docs/messaging/api/message-resource · https://api.slack.com/methods/chat.postMessage

    Try it: a snippet that triggers this rule

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

    src/notify.tsx
    import OpenAI from "openai";
    import nodemailer from "nodemailer";
    const openai = new OpenAI();
    const mailer = nodemailer.createTransport({ host: "smtp.example.com", port: 587 });
    export async function sendFollowUp(thread: string) {
    const res = await openai.chat.completions.create({
    model: "gpt-4o-mini",
    messages: [
    { role: "user", content: `Who should receive the follow-up for this thread? Reply with an address only.\n${thread}` },
    ],
    });
    const recipient = res.choices[0].message.content;
    await mailer.sendMail({
    from: "support@example.com",
    to: recipient,
    subject: "Following up on your request",
    text: "Thanks for your patience, here is an update.",
    });
    }

    Checked with Keryn’s browser engine when this page was built: it reports keryn.outbound.model-output-as-message-recipient-js at line 17 (error, proof 2). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.

    keryn.outbound.model-output-as-message-recipient-py

    Section titled “keryn.outbound.model-output-as-message-recipient-py”

    error python data-flow rule smtplib, resend, sendgrid, twilio, slack

    The recipient of an outbound message (email “to”, SMS “to”, Slack channel) comes from the model’s output. A prompt-injected or hallucinated answer then decides who receives the agent’s messages, which is the exfiltration and spam path for anything the agent knows. Choose recipients from the task’s data or a fixed allowlist and let the model draft only the content.

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

    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-441 CWE-200 LLM06 LLM02 ASI02 ASI01

    Fix: Resolve the recipient from the CRM record, ticket or user session the task is about, compare it with an allowlist of domains or channels, and pass only the model’s text as the subject/body; log every send with the resolved recipient.

    References: https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.sendmail · https://resend.com/docs/api-reference/emails/send-email · https://www.twilio.com/docs/sendgrid/for-developers/sending-email/v3-python-code-example · https://www.twilio.com/docs/messaging/api/message-resource · https://api.slack.com/methods/chat.postMessage

    keryn.outbound.model-output-to-crm-record-js

    Section titled “keryn.outbound.model-output-to-crm-record-js”

    warning javascript, typescript data-flow rule hubspot

    A CRM record (HubSpot contact, company, deal or custom object) is created or updated from the model’s output. Whatever the model inferred, or was injected to write, becomes a business record other people and automations act on: wrong owners, invented deal stages, poisoned notes that later feed another agent’s context. Validate each property against its schema and allowlist, and keep the fields the model may write small.

    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-20 CWE-915 LLM05 LLM06 ASI06 ASI02

    Fix: Build the properties object from a typed schema (zod/pydantic) that lists the writable fields, validate formats (email, enum stages, numeric amounts), reject anything else, and record the model’s text in a notes field marked as AI-generated rather than in authoritative fields.

    References: https://developers.hubspot.com/docs/api-reference/legacy/crm/objects/contacts/guide · https://developers.hubspot.com/docs/api-reference/legacy/crm/objects/deals/guide

    keryn.outbound.model-output-to-crm-record-py

    Section titled “keryn.outbound.model-output-to-crm-record-py”

    warning python data-flow rule hubspot

    A CRM record (HubSpot contact, company, deal or custom object) is created or updated from the model’s output. Whatever the model inferred, or was injected to write, becomes a business record other people and automations act on: wrong owners, invented deal stages, poisoned notes that later feed another agent’s context. Validate each property against its schema and allowlist, and keep the fields the model may write small.

    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-20 CWE-915 LLM05 LLM06 ASI06 ASI02

    Fix: Build the properties dict from a pydantic model that lists the writable fields, validate formats (email, enum stages, numeric amounts), reject anything else, and record the model’s text in a notes field marked as AI-generated rather than in authoritative fields.

    References: https://developers.hubspot.com/docs/api-reference/legacy/crm/objects/contacts/guide · https://github.com/HubSpot/hubspot-api-python

    keryn.outbound.model-output-as-payment-amount-js

    Section titled “keryn.outbound.model-output-as-payment-amount-js”

    error javascript, typescript data-flow rule stripe

    A payment, refund, transfer or payout amount comes from the model’s output. A hallucinated figure or an injected instruction then moves money, and Stripe will execute it as written. Compute amounts from your own order and pricing data, bound them, and require a human confirmation above a threshold; the model may propose, never set, the number.

    Confidence P0: exploitable as written. False-positive risk low: an exact API or flag, so hits are almost always real.

    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-840 CWE-20 LLM06 ASI02 ASI09

    Fix: Derive amount from the invoice/order record, assert it equals the stored total (or is within the refundable balance), cap it, and route anything above the cap to a human approval step before the Stripe call.

    References: https://docs.stripe.com/api/payment_intents/create · https://docs.stripe.com/api/refunds/create · https://docs.stripe.com/api/transfers/create · https://docs.stripe.com/api/payouts/create

    keryn.outbound.model-output-as-payment-amount-py

    Section titled “keryn.outbound.model-output-as-payment-amount-py”

    error python data-flow rule stripe

    A payment, refund, transfer or payout amount comes from the model’s output. A hallucinated figure or an injected instruction then moves money, and Stripe will execute it as written. Compute amounts from your own order and pricing data, bound them, and require a human confirmation above a threshold; the model may propose, never set, the number.

    Confidence P0: exploitable as written. False-positive risk low: an exact API or flag, so hits are almost always real.

    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-840 CWE-20 LLM06 ASI02 ASI09

    Fix: Derive amount from the invoice/order record, assert it equals the stored total (or is within the refundable balance), cap it, and route anything above the cap to a human approval step before the Stripe call.

    References: https://docs.stripe.com/api/payment_intents/create?lang=python · https://docs.stripe.com/api/refunds/create?lang=python

    Try it: a snippet that triggers this rule

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

    billing/refund_agent.py
    import json
    import stripe
    from openai import OpenAI
    client = OpenAI()
    def issue_refund(payment_intent: str, ticket_text: str):
    resp = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
    {"role": "system", "content": "Reply with JSON: {\"cents\": <int>}"},
    {"role": "user", "content": ticket_text},
    ],
    )
    cents = json.loads(resp.choices[0].message.content)["cents"]
    return stripe.Refund.create(payment_intent=payment_intent, amount=cents)

    Checked with Keryn’s browser engine when this page was built: it reports keryn.outbound.model-output-as-payment-amount-py at line 18 (error, proof 2). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.