Skip to content

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

    iac-ai-services-v1

    View as Markdown

    19 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.iacai.bedrock-agent-iam-wildcard-action-resource

    Section titled “seceng.iacai.bedrock-agent-iam-wildcard-action-resource”

    error hcl terraform, aws, bedrock

    IAM policy grants bedrock:* (or * on a Bedrock/agent-named policy) on Resource = "*". An agent role with this policy can invoke any model, edit agents/guardrails and read knowledge bases; a prompt-injected agent inherits all of it. Scope actions to the needed bedrock:InvokeModel ARNs and specific agent/guardrail/KB resources.

    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-269 CWE-732 LLM06 ASI03 ASI02

    Fix: List the specific actions (bedrock:InvokeModel, bedrock:Retrieve) and restrict Resource to the exact model, guardrail and knowledge-base ARNs. Add a permissions boundary and condition keys such as aws:SourceArn for the agent’s service role.

    References: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/bedrockagent_agent · https://docs.aws.amazon.com/bedrock/latest/userguide/security_iam_service-with-iam.html

    warning hcl terraform, aws, bedrock

    aws_bedrockagent_agent has no guardrail_configuration, so prompts and responses reach the model with no content, PII or prompt-attack filtering at the Bedrock layer. Attach an aws_bedrock_guardrail (with PROMPT_ATTACK filtering) to the agent.

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

    Edge inspected: grants authority is given or left unchecked.

    CWE-693 LLM01 LLM06 ASI01 ASI02

    Fix: Add guardrail_configuration { guardrail_identifier = aws_bedrock_guardrail.x.guardrail_id guardrail_version = aws_bedrock_guardrail.x.version } to the agent.

    References: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/bedrockagent_agent#guardrail_configuration · https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html

    seceng.iacai.bedrock-guardrail-filter-strength-none

    Section titled “seceng.iacai.bedrock-guardrail-filter-strength-none”

    warning hcl terraform, aws, bedrock

    aws_bedrock_guardrail content filter is set to strength NONE, which disables that filter for the direction. A PROMPT_ATTACK filter at NONE removes the guardrail’s injection defense entirely. Use at least MEDIUM (HIGH for PROMPT_ATTACK input).

    Confidence P1: dangerous in context. 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-693 LLM01 LLM05 ASI01 ASI02

    Fix: Set input_strength and output_strength to MEDIUM or HIGH for every filters_config; PROMPT_ATTACK uses input_strength HIGH and output_strength NONE (the only valid output value).

    References: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/bedrock_guardrail · https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-prompt-attack.html

    seceng.iacai.bedrock-guardrail-prompt-attack-none

    Section titled “seceng.iacai.bedrock-guardrail-prompt-attack-none”

    warning hcl terraform, aws, bedrock

    aws_bedrock_guardrail PROMPT_ATTACK filter has input_strength = "NONE", so jailbreak and prompt-injection detection is off. Use HIGH.

    Confidence P1: dangerous in context. 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-1427 LLM01 ASI01

    Fix: Set input_strength = “HIGH” on the PROMPT_ATTACK filter.

    References: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/bedrock_guardrail · https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-prompt-attack.html

    seceng.iacai.sagemaker-endpoint-config-no-kms

    Section titled “seceng.iacai.sagemaker-endpoint-config-no-kms”

    warning hcl terraform, aws, sagemaker

    aws_sagemaker_endpoint_configuration has no kms_key_arn, so the endpoint’s attached storage and captured inference payloads (prompts, completions) are encrypted only with an AWS-managed key you cannot control or audit. Set a customer-managed KMS key.

    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-311 CWE-320 LLM02 ASI03

    Fix: Set kms_key_arn to a customer-managed key (and the same for data_capture_config.kms_key_id if capture is enabled).

    References: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sagemaker_endpoint_configuration#kms_key_arn · https://raw.githubusercontent.com/hashicorp/terraform-provider-aws/main/website/docs/r/sagemaker_endpoint_configuration.html.markdown

    seceng.iacai.sagemaker-notebook-direct-internet

    Section titled “seceng.iacai.sagemaker-notebook-direct-internet”

    warning hcl terraform, aws, sagemaker

    aws_sagemaker_notebook_instance has direct_internet_access = "Enabled", giving the notebook (which holds model artifacts and credentials) a path to and from the public internet outside your VPC controls. Set it to Disabled and route through a NAT/VPC endpoints.

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

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

    CWE-668 LLM02 LLM03 ASI03

    Fix: Set direct_internet_access = “Disabled”, attach a subnet_id, and reach package mirrors via VPC endpoints or a controlled egress path.

    References: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sagemaker_notebook_instance#direct_internet_access · https://raw.githubusercontent.com/hashicorp/terraform-provider-aws/main/website/docs/r/sagemaker_endpoint_configuration.html.markdown

    seceng.iacai.azure-openai-public-network-access-enabled

    Section titled “seceng.iacai.azure-openai-public-network-access-enabled”

    error hcl terraform, azure, azure-openai

    azurerm_cognitive_account of kind OpenAI sets public_network_access_enabled = true, exposing the Azure OpenAI endpoint to the internet; only the API key stands between callers and your quota and data. Disable it and use private endpoints.

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

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

    CWE-668 LLM02 LLM10 ASI03 ASI10

    Fix: Set public_network_access_enabled = false and create an azurerm_private_endpoint for the account (subresource “account”).

    References: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account#public_network_access_enabled · https://learn.microsoft.com/azure/ai-services/cognitive-services-virtual-networks

    seceng.iacai.azure-openai-local-auth-enabled

    Section titled “seceng.iacai.azure-openai-local-auth-enabled”

    warning hcl terraform, azure, azure-openai

    azurerm_cognitive_account of kind OpenAI keeps local_auth_enabled = true, so long-lived API keys can call the endpoint and bypass Entra ID RBAC and conditional access. Disable local auth and authenticate with managed identities.

    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: grants authority is given or left unchecked.

    CWE-798 CWE-287 LLM02 LLM06 ASI03

    Fix: Set local_auth_enabled = false and grant callers the Cognitive Services OpenAI User role via managed identity.

    References: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account#local_auth_enabled · https://learn.microsoft.com/azure/ai-services/openai/how-to/managed-identity

    warning hcl terraform, azure, azure-openai

    azurerm_cognitive_account of kind OpenAI has no network_acls block, so with public access on (the default) any address can reach the endpoint. Add network_acls with default_action = “Deny” or disable public access.

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

    Edge inspected: grants authority is given or left unchecked.

    CWE-668 LLM02 LLM10 ASI03 ASI10

    Fix: Add network_acls { default_action = “Deny” ip_rules = […] virtual_network_rules {…} } or set public_network_access_enabled = false with a private endpoint.

    References: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account#network_acls · https://learn.microsoft.com/azure/ai-services/cognitive-services-virtual-networks

    seceng.iacai.azure-openai-network-acls-default-allow

    Section titled “seceng.iacai.azure-openai-network-acls-default-allow”

    error hcl terraform, azure, azure-openai

    azurerm_cognitive_account OpenAI network_acls uses default_action = "Allow", which makes the ACL meaningless: every address not explicitly listed is still permitted. Use “Deny” and list the allowed ranges.

    Confidence P1: dangerous in context. 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-1188 LLM02 LLM10 ASI03 ASI10

    Fix: Set default_action = “Deny” and enumerate ip_rules or virtual_network_rules.

    References: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account#network_acls

    seceng.iacai.azure-openai-deployment-no-rai-policy

    Section titled “seceng.iacai.azure-openai-deployment-no-rai-policy”

    warning hcl terraform, azure, azure-openai

    azurerm_cognitive_deployment sets no rai_policy_name, so the deployment uses the default content filter configuration and not one you reviewed. Attach an explicit Responsible AI (content filter) policy.

    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: grants authority is given or left unchecked.

    CWE-693 LLM05 LLM01 ASI01 ASI02

    Fix: Create an azurerm_cognitive_account_rai_policy with your filter levels (including Prompt Shields) and reference it via rai_policy_name.

    References: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_deployment#rai_policy_name · https://learn.microsoft.com/azure/ai-services/openai/concepts/content-filter

    seceng.iacai.vertex-ai-endpoint-no-private-network

    Section titled “seceng.iacai.vertex-ai-endpoint-no-private-network”

    warning hcl terraform, gcp, vertex-ai

    google_vertex_ai_endpoint sets neither network nor private_service_connect_config, so predictions are served from a public endpoint. Use VPC peering or Private Service Connect for model endpoints that handle sensitive data.

    Confidence P1: dangerous in context. 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-668 LLM02 ASI03 ASI10

    Fix: Set network = “projects/<num>/global/networks/<vpc>” (peering) or private_service_connect_config { enable_private_service_connect = true project_allowlist = […] }.

    References: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/vertex_ai_endpoint#network · https://docs.cloud.google.com/gemini-enterprise-agent-platform/machine-learning/predictions/using-private-endpoints

    seceng.iacai.gcp-ai-role-granted-to-public

    Section titled “seceng.iacai.gcp-ai-role-granted-to-public”

    error hcl terraform, gcp, vertex-ai, discovery-engine

    Vertex AI / Discovery Engine (Vertex AI Search) role is granted to allUsers or allAuthenticatedUsers. Anyone on the internet (or with any Google account) can call your models, search apps and data stores on your bill. Grant to specific principals.

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

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

    CWE-732 LLM02 LLM10 ASI03 ASI10

    Fix: Replace allUsers/allAuthenticatedUsers with named groups or service accounts, and enable the iam.allowedPolicyMemberDomains org policy to block public members.

    References: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/project_iam · https://docs.cloud.google.com/iam/docs/principals-overview#all-users · https://raw.githubusercontent.com/hashicorp/terraform-provider-google/main/website/docs/r/discovery_engine_search_engine.html.markdown

    seceng.iacai.k8s-ai-service-exposed-loadbalancer-nodeport

    Section titled “seceng.iacai.k8s-ai-service-exposed-loadbalancer-nodeport”

    error yaml kubernetes, vllm, ollama, litellm

    Kubernetes Service for an AI model server (vLLM, Ollama, TGI, Open WebUI, LiteLLM, …) is type: LoadBalancer or NodePort. These servers are unauthenticated by default (Ollama) or hold provider keys (LiteLLM, Open WebUI), so a public address hands out free inference and admin APIs. Keep it ClusterIP behind an authenticated gateway, or restrict with internal-LB annotations/loadBalancerSourceRanges.

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

    Edge inspected: grants authority is given or left unchecked.

    CWE-306 LLM02 LLM10 ASI03 ASI10

    Fix: Use type ClusterIP and publish only through an ingress/gateway that enforces authentication (OIDC proxy, API-key check), add NetworkPolicies, and if a cloud LB is needed mark it internal and set loadBalancerSourceRanges.

    References: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer · https://docs.ollama.com/faq#how-can-i-expose-ollama-on-my-network

    seceng.iacai.k8s-ai-ingress-no-auth-annotation

    Section titled “seceng.iacai.k8s-ai-ingress-no-auth-annotation”

    warning yaml kubernetes, ingress-nginx, vllm, ollama

    Ingress routes to an AI model server (vLLM, Ollama, TGI, Open WebUI, LiteLLM, …) but carries no authentication annotation (auth-url, auth-type/basic auth, oauth2-proxy, forward-auth, JWT). Verify the backend enforces auth itself; otherwise inference and admin endpoints are open to whoever can reach the ingress.

    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: grants authority is given or left unchecked.

    CWE-306 LLM02 LLM10 ASI03 ASI10

    Fix: Add external authentication (nginx.ingress.kubernetes.io/auth-url + auth-signin to an oauth2-proxy, or auth-type: basic with auth-secret), or front the service with an API gateway that validates keys/JWTs.

    References: https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#external-authentication

    warning yaml vllm, kubernetes, docker-compose

    vLLM OpenAI-compatible server container is started without --api-key (or VLLM_API_KEY), so anyone who can reach the port can run inference and use your GPUs. Set an API key from a Secret and still restrict network access.

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

    Edge inspected: grants authority is given or left unchecked.

    CWE-306 LLM02 LLM10 ASI03 ASI10

    Fix: Pass –api-key $(VLLM_API_KEY) (or set env VLLM_API_KEY from a Secret/secret file), keep the Service internal, and add a NetworkPolicy; use a gateway for per-user keys.

    References: https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html

    warning yaml ollama, kubernetes, docker-compose

    OLLAMA_HOST is set to 0.0.0.0, binding Ollama’s unauthenticated API (generate, pull, create, delete) on every interface. Make sure a NetworkPolicy/firewall limits who can reach port 11434, or put an authenticating proxy in front; this rule cannot see NetworkPolicy objects in other files.

    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: grants authority is given or left unchecked.

    CWE-306 CWE-668 LLM02 LLM10 ASI03 ASI10

    Fix: Bind to 127.0.0.1 or a pod-local sidecar, publish only through an authenticating reverse proxy, and apply a default-deny NetworkPolicy that admits only the calling workloads.

    References: https://docs.ollama.com/faq#how-can-i-expose-ollama-on-my-network

    error yaml kubernetes, docker-compose, nvidia

    GPU / model-serving container runs with privileged: true. A compromised model server or a prompt-injected tool gets full device and host access. GPUs are exposed through the NVIDIA device plugin/CDI without privileged mode; drop it.

    Confidence P1: dangerous in context. 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-250 CWE-269 LLM06 ASI05 ASI03

    Fix: Remove privileged: true, request GPUs via resources.limits nvidia.com/gpu (or compose deploy.resources.reservations.devices), run as non-root and set allowPrivilegeEscalation: false with a restricted seccomp profile.

    References: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ · https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/cdi-support.html

    seceng.iacai.agent-tool-workload-host-network

    Section titled “seceng.iacai.agent-tool-workload-host-network”

    error yaml kubernetes

    Agent/tool/model workload runs with hostNetwork: true, putting its containers on the node’s network namespace. A prompt-injected tool can then reach node-local services (kubelet, cloud metadata, other pods’ host ports) and bypass NetworkPolicy. Use the pod network.

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

    Edge inspected: grants authority is given or left unchecked.

    CWE-668 CWE-250 LLM06 ASI05 ASI03

    Fix: Remove hostNetwork (and hostPID/hostIPC); expose ports with a Service. Enforce the Pod Security ‘baseline’ or ‘restricted’ profile on the namespace.

    References: https://kubernetes.io/docs/concepts/security/pod-security-standards/#baseline