Volver al catálogo
Revisión estáticaDesarrollo

Dosier de la skill

detecting-serverless-function-injection

Declaración de origen

Detects and prevents code injection attacks targeting serverless functions (AWS Lambda, Azure Functions, Google Cloud Functions) through event source poisoning, malicious layer injection, runtime command execution, and IAM privilege escalation via function modification. The analyst combines static analysis of function code, CloudTrail event correlation, runtime behavior monitoring, and IAM policy auditing to identify injection vectors across the expanded serverless attack surface including API Gateway, S3, SQS, DynamoDB Streams, and CloudWatch event triggers. Activates for requests involving Lambda security assessment, serverless injection detection, function event poisoning analysis, or serverless privilege escalation investigation.

La descripción original del autor, conservada en inglés. Describe la intención, no un rendimiento verificado.

Detects and prevents code injection attacks targeting serverless functions (AWS Lambda, Azure Functions, Google Cloud Functions) through event source poisoning, malicious layer injection, runtime command execution, and IAM privilege escalation via function modification. The analyst combines static analysis of function code, CloudTrail event correlation, runtime behavior monitoring, and IAM policy auditing to identify injection vectors across the expanded serverless attack surface including API Gateway, S3, SQS, DynamoDB Streams, and CloudWatch event triggers. Activates for requests involving Lambda security assessment, serverless injection detection, function event poisoning analysis, or serverless privilege escalation investigation.

developmentreferencesscripts

El contenido de investigación de este sitio está publicado en inglés y chino, y aquí se muestra en inglés.

Resumen de la investigación

Análisis estático

Estas observaciones proceden del análisis determinista del código fuente. No son una evaluación controlada de tareas.

Detects and prevents code injection attacks targeting serverless functions (AWS Lambda, Azure Functions, Google Cloud Functions) through event source poisoning, malicious layer injection, runtime command execution, and IAM privilege escalation via function modification. The analyst combines static analysis of function code, CloudTrail event correlation, runtime behavior monitoring, and IAM policy auditing to identify injection vectors across the expanded serverless attack surface including API Gateway, S3, SQS, DynamoDB Streams, and CloudWatch event triggers. Activates for requests involving Lambda security assessment, serverless injection detection, function event poisoning analysis, or serverless privilege escalation investigation. This bilingual summary is generated deterministically from collected source text and file structure; it is from static parsing.

Alcance de la revisión

Deterministic static analysis of collected SKILL.md and supporting text/code. Machine-assisted candidates and findings are static-analysis candidates; no dynamic behavior or effect is assessed.

Capacidades observables

  • Workflow [Source statement; provisional, not tested. Evidence: skills/detecting-serverless-function-injection/SKILL.md:L59]
  • Step 1: Enumerate the Serverless Attack Surface [Source statement; provisional, not tested. Evidence: skills/detecting-serverless-function-injection/SKILL.md:L61]
  • Step 2: Static Analysis for Injection Sinks [Source statement; provisional, not tested. Evidence: skills/detecting-serverless-function-injection/SKILL.md:L94]
  • Step 3: Detect Event Source Poisoning [Source statement; provisional, not tested. Evidence: skills/detecting-serverless-function-injection/SKILL.md:L147]
  • Step 4: Detect Malicious Lambda Layer Injection [Source statement; provisional, not tested. Evidence: skills/detecting-serverless-function-injection/SKILL.md:L201]
  • Step 5: Detect IAM Privilege Escalation via Lambda [Source statement; provisional, not tested. Evidence: skills/detecting-serverless-function-injection/SKILL.md:L245]
  • Step 6: Implement Runtime Injection Prevention [Source statement; provisional, not tested. Evidence: skills/detecting-serverless-function-injection/SKILL.md:L297]

Limitaciones y alcance

  • Static analysis cannot assess runtime behavior, command success, network reachability, or model output quality.
  • No commands, scripts, network requests, model calls, or controlled skill executions were performed.
  • Category, tags, capabilities, workflows, and bilingual editorial summaries are deterministic candidates from static parsing, not verified outcomes.
  • Exact token counts are unavailable until a later pipeline performs and records an official model-specific count.

Relevante para

  • Practitioners evaluating whether to inspect and install the source skill; this audience is inferred from the product context, not measured usage. [Evidence: skills/detecting-serverless-function-injection/SKILL.md:L1-L37]

Qué incluye la skill

El inventario de archivos procede del código fuente recopilado en el commit registrado. Las rutas y los tamaños son observaciones estructurales, no una medida de calidad.

archivos
4
Archivos Markdown
2
scripts
1
referencias
1
Tamaño
66,5 KB
Complejidad estructural
Baja

Inventario de archivos

RutaTipoBytes
skills/detecting-serverless-function-injection/LICENSEOtro11 KB
skills/detecting-serverless-function-injection/references/api-reference.mdReferencia5 KB
skills/detecting-serverless-function-injection/scripts/agent.pyScript25,9 KB
skills/detecting-serverless-function-injection/SKILL.mdInstrucción24,6 KB

Frontmatter de SKILL.md

{
  "name": "detecting-serverless-function-injection",
  "description": "Detects and prevents code injection attacks targeting serverless functions (AWS Lambda, Azure Functions, Google Cloud Functions) through event source poisoning, malicious layer injection, runtime command execution, and IAM privilege escalation via function modification. The analyst combines static analysis of function code, CloudTrail event correlation, runtime behavior monitoring, and IAM policy auditing to identify injection vectors across the expanded serverless attack surface including API Gateway, S3, SQS, DynamoDB Streams, and CloudWatch event triggers. Activates for requests involving Lambda security assessment, serverless injection detection, function event poisoning analysis, or serverless privilege escalation investigation.\n",
  "domain": "cybersecurity",
  "subdomain": "cloud-security",
  "tags": [
    "serverless-security",
    "Lambda-injection",
    "event-source-poisoning",
    "OWASP-serverless",
    "IAM-escalation",
    "CloudTrail"
  ],
  "version": "1.0.0",
  "author": "mukul975",
  "license": "Apache-2.0",
  "nist_csf": [
    "PR.IR-01",
    "ID.AM-08",
    "GV.SC-06",
    "DE.CM-01"
  ],
  "mitre_attack": [
    "T1190",
    "T1059",
    "T1648",
    "T1078.004",
    "T1068"
  ]
}

Una lectura de la secuencia de funcionamiento

Este flujo de trabajo reconstruye la secuencia aparente a partir del material de origen. A menos que se registre explícitamente una evaluación controlada, es provisional y no un seguimiento observado.

  1. 01
    Decisión

    When to Use

    Source-described decision candidate under “When to Use”; not verified execution.

  2. 02
    Acción

    Workflow

    Source-described action candidate under “Workflow”; not verified execution.

  3. 03
    Acción

    Step 1: Enumerate the Serverless Attack Surface

    Source-described action candidate under “Step 1: Enumerate the Serverless Attack Surface”; not verified execution.

  4. 04
    Acción

    List all Lambda functions and their configurations:

    Source-described action candidate under “Step 1: Enumerate the Serverless Attack Surface”; not verified execution.

  5. 05
    Entrada

    Map event source mappings: Each event source mapping is a potential injection entry point where untrusted data enters the function:

    Source-described input candidate under “Step 1: Enumerate the Serverless Attack Surface”; not verified execution.

  6. 06
    Acción

    Identify API Gateway triggers: API Gateway routes pass HTTP request data (headers, query strings, body, path parameters) directly into the Lambda event object:

    Source-described action candidate under “Step 1: Enumerate the Serverless Attack Surface”; not verified execution.

Examinar todos los pasos de flujo de trabajo candidatos (60 pasos candidatos)
  1. 07
    Acción

    Identify S3 event triggers: S3 bucket notifications can trigger Lambda with attacker-controlled object keys and metadata:

    Source-described action candidate under “Step 1: Enumerate the Serverless Attack Surface”; not verified execution.

  2. 08
    Decisión

    Catalog function environment variables: Secrets in environment variables are exposed if an attacker achieves code execution inside the function:

    Source-described decision candidate under “Step 1: Enumerate the Serverless Attack Surface”; not verified execution.

  3. 09
    Acción

    Identify overprivileged execution roles: Functions with `` resource permissions or administrative policies are high-value escalation targets:

    Source-described action candidate under “Step 1: Enumerate the Serverless Attack Surface”; not verified execution.

  4. 10
    Acción

    Step 2: Static Analysis for Injection Sinks

    Source-described action candidate under “Step 2: Static Analysis for Injection Sinks”; not verified execution.

  5. 11
    Acción

    Download function deployment packages:

    Source-described action candidate under “Step 2: Static Analysis for Injection Sinks”; not verified execution.

  6. 12
    Acción

    Python injection sinks (Lambda Python runtimes): Search for functions that execute strings as code:

    Source-described action candidate under “Step 2: Static Analysis for Injection Sinks”; not verified execution.

  7. 13
    Acción

    Node.js injection sinks (Lambda Node.js runtimes):

    Source-described action candidate under “Step 2: Static Analysis for Injection Sinks”; not verified execution.

  8. 14
    Acción

    Run Semgrep with serverless rules: Use purpose-built rules that detect event data flowing into injection sinks:

    Source-described action candidate under “Step 2: Static Analysis for Injection Sinks”; not verified execution.

  9. 15
    Acción

    Run Bandit for Python functions:

    Source-described action candidate under “Step 2: Static Analysis for Injection Sinks”; not verified execution.

  10. 16
    Acción

    Custom pattern detection: Search for indirect injection patterns where event data is concatenated into strings that are later executed:

    Source-described action candidate under “Step 2: Static Analysis for Injection Sinks”; not verified execution.

  11. 17
    Entrada

    Step 3: Detect Event Source Poisoning

    Source-described input candidate under “Step 3: Detect Event Source Poisoning”; not verified execution.

  12. 18
    Acción

    Analyze event sources for injection payloads that exploit how Lambda processes triggers:

    Source-described action candidate under “Step 3: Detect Event Source Poisoning”; not verified execution.

  13. 19
    Acción

    S3 event key injection: When a Lambda function processes S3 events, the object key from the event record can contain injection payloads. An attacker uploads an object with a malicious key name:

    Source-described action candidate under “Step 3: Detect Event Source Poisoning”; not verified execution.

  14. 20
    Acción

    SQS message body injection: Lambda processes SQS messages where the body contains attacker-controlled data:

    Source-described action candidate under “Step 3: Detect Event Source Poisoning”; not verified execution.

  15. 21
    Acción

    API Gateway header/parameter injection: HTTP request data passes through API Gateway into the Lambda event:

    Source-described action candidate under “Step 3: Detect Event Source Poisoning”; not verified execution.

  16. 22
    Decisión

    DynamoDB Stream record injection: Modified DynamoDB items trigger Lambda with the new record values. If an attacker can write to the table, they control the event data:

    Source-described decision candidate under “Step 3: Detect Event Source Poisoning”; not verified execution.

  17. 23
    Acción

    Detection via CloudWatch Logs Insights: Query for evidence of injection attempts in function execution logs:

    Source-described action candidate under “Step 3: Detect Event Source Poisoning”; not verified execution.

  18. 24
    Acción

    Step 4: Detect Malicious Lambda Layer Injection

    Source-described action candidate under “Step 4: Detect Malicious Lambda Layer Injection”; not verified execution.

  19. 25
    Acción

    Audit current layer attachments: List all functions and their layer versions to identify unexpected additions:

    Source-described action candidate under “Step 4: Detect Malicious Lambda Layer Injection”; not verified execution.

  20. 26
    Acción

    Detect layer modification events in CloudTrail: Query for `UpdateFunctionConfiguration` events that add or change layers:

    Source-described action candidate under “Step 4: Detect Malicious Lambda Layer Injection”; not verified execution.

  21. 27
    Decisión

    Parse the `CloudTrailEvent` JSON to check if `Layers` was modified in the request parameters.

    Source-described decision candidate under “Step 4: Detect Malicious Lambda Layer Injection”; not verified execution.

  22. 28
    Acción

    Analyze layer contents: Download and inspect layer packages for malicious code:

    Source-described action candidate under “Step 4: Detect Malicious Lambda Layer Injection”; not verified execution.

  23. 29
    Acción

    Layer hijacking indicators: A malicious layer can override the function's runtime behavior by placing files in the runtime's search path:

    Source-described action candidate under “Step 4: Detect Malicious Lambda Layer Injection”; not verified execution.

  24. 30
    Acción

    Python: Layer code in `/opt/python/` is imported before the function's own modules

    Source-described action candidate under “Step 4: Detect Malicious Lambda Layer Injection”; not verified execution.

  25. 31
    Acción

    Node.js: Layer code in `/opt/nodejs/nodemodules/` overrides function dependencies

    Source-described action candidate under “Step 4: Detect Malicious Lambda Layer Injection”; not verified execution.

  26. 32
    Acción

    A layer providing a modified `boto3` package can intercept all AWS API calls, log credentials, and forward requests to an attacker-controlled endpoint

    Source-described action candidate under “Step 4: Detect Malicious Lambda Layer Injection”; not verified execution.

  27. 33
    Acción

    CloudTrail detection query for layer changes:

    Source-described action candidate under “Step 4: Detect Malicious Lambda Layer Injection”; not verified execution.

  28. 34
    Acción

    Step 5: Detect IAM Privilege Escalation via Lambda

    Source-described action candidate under “Step 5: Detect IAM Privilege Escalation via Lambda”; not verified execution.

  29. 35
    Acción

    The Lambda privilege escalation pattern: An attacker with `lambda:UpdateFunctionCode` and `iam:PassRole` permissions can:

    Source-described action candidate under “Step 5: Detect IAM Privilege Escalation via Lambda”; not verified execution.

  30. 36
    Acción

    Identify a Lambda function with a high-privilege execution role (e.g., AdministratorAccess)

    Source-described action candidate under “Step 5: Detect IAM Privilege Escalation via Lambda”; not verified execution.

  31. 37
    Acción

    Modify the function's code to call `sts:GetCallerIdentity` or perform privileged actions

    Source-described action candidate under “Step 5: Detect IAM Privilege Escalation via Lambda”; not verified execution.

  32. 38
    Acción

    Invoke the function, which executes with the high-privilege role

    Source-described action candidate under “Step 5: Detect IAM Privilege Escalation via Lambda”; not verified execution.

  33. 39
    Acción

    Exfiltrate the role's temporary credentials from the function's environment variables (`AWSACCESSKEYID`, `AWSSECRETACCESSKEY`, `AWSSESSIONTOKEN`)

    Source-described action candidate under “Step 5: Detect IAM Privilege Escalation via Lambda”; not verified execution.

  34. 40
    Acción

    Detect UpdateFunctionCode events: Monitor CloudTrail for function code modifications:

    Source-described action candidate under “Step 5: Detect IAM Privilege Escalation via Lambda”; not verified execution.

  35. 41
    Acción

    Detect PassRole to Lambda: `iam:PassRole` is required to attach a different execution role to a function. Monitor for this:

    Source-described action candidate under “Step 5: Detect IAM Privilege Escalation via Lambda”; not verified execution.

  36. 42
    Acción

    Detect credential exfiltration from Lambda: A compromised function may call STS or create new IAM entities:

    Source-described action candidate under “Step 5: Detect IAM Privilege Escalation via Lambda”; not verified execution.

  37. 43
    Acción

    EventBridge rule for real-time alerting: Create an EventBridge rule to trigger an SNS alert whenever function code is modified:

    Source-described action candidate under “Step 5: Detect IAM Privilege Escalation via Lambda”; not verified execution.

  38. 44
    Acción

    Step 6: Implement Runtime Injection Prevention

    Source-described action candidate under “Step 6: Implement Runtime Injection Prevention”; not verified execution.

  39. 45
    Entrada

    Input validation at handler entry: Validate and sanitize all event data before processing:

    Source-described input candidate under “Step 6: Implement Runtime Injection Prevention”; not verified execution.

  40. 46
    Acción

    Lambda function URL authorization: Ensure functions exposed via URLs require IAM auth:

    Source-described action candidate under “Step 6: Implement Runtime Injection Prevention”; not verified execution.

  41. 47
    Acción

    Least privilege execution roles: Restrict the function's IAM role to the minimum required permissions:

    Source-described action candidate under “Step 6: Implement Runtime Injection Prevention”; not verified execution.

  42. 48
    Acción

    SCP to prevent dangerous Lambda modifications: Apply a Service Control Policy at the organization level to restrict who can modify Lambda functions and pass roles:

    Source-described action candidate under “Step 6: Implement Runtime Injection Prevention”; not verified execution.

  43. 49
    Acción

    AWS Lambda Powertools for structured logging: Emit structured security events that can be ingested by SIEM:

    Source-described action candidate under “Step 6: Implement Runtime Injection Prevention”; not verified execution.

  44. 50
    Acción

    Key Concepts

    Source-described action candidate under “Key Concepts”; not verified execution.

  45. 51
    Acción

    Tools & Systems

    Source-described action candidate under “Tools & Systems”; not verified execution.

  46. 52
    Acción

    Common Scenarios

    Source-described action candidate under “Common Scenarios”; not verified execution.

  47. 53
    Acción

    Query CloudTrail for `UpdateFunctionCode` events in the past 7 days to identify when the function was modified and by which principal:

    Source-described action candidate under “Scenario: Detecting and Responding to a Lambda-Based Privilege Escalation Attack”; not verified execution.

  48. 54
    Acción

    Discover that the function was modified from an IP address in an unexpected geographic location at 02:47 UTC, outside of normal deployment windows

    Source-described action candidate under “Scenario: Detecting and Responding to a Lambda-Based Privilege Escalation Attack”; not verified execution.

  49. 55
    Acción

    Download the modified function code and find an injected snippet that POSTs `os.environ['AWSACCESSKEYID']`, `AWSSECRETACCESSKEY`, and `AWSSESSIONTOKEN` to an external endpoint on each invocation

    Source-described action candidate under “Scenario: Detecting and Responding to a Lambda-Based Privilege Escalation Attack”; not verified execution.

  50. 56
    Decisión

    Check if the attacker also added a malicious layer by querying for `UpdateFunctionConfiguration` events with layer changes

    Source-described decision candidate under “Scenario: Detecting and Responding to a Lambda-Based Privilege Escalation Attack”; not verified execution.

  51. 57
    Acción

    Verify the function's execution role permissions: the payment-processor role has `dynamodb:`, `s3:GetObject`, `s3:PutObject`, and `sqs:SendMessage` across all resources, exceeding least privilege

    Source-described action candidate under “Scenario: Detecting and Responding to a Lambda-Based Privilege Escalation Attack”; not verified execution.

  52. 58
    Acción

    Search CloudTrail for API calls made by the exfiltrated credentials from outside AWS, finding `sts:GetCallerIdentity`, `s3:ListBuckets`, `dynamodb:Scan` on the customer table, and `iam:CreateUser` attempts

    Source-described action candidate under “Scenario: Detecting and Responding to a Lambda-Based Privilege Escalation Attack”; not verified execution.

  53. 59
    Acción

    Respond by reverting the function code from the last known-good deployment package in the CI/CD artifact store, rotating the execution role's session tokens, and adding an SCP that restricts `lambda:UpdateFunctionCode` to the CI/CD role only

    Source-described action candidate under “Scenario: Detecting and Responding to a Lambda-Based Privilege Escalation Attack”; not verified execution.

  54. 60
    Salida

    Output Format

    Source-described output candidate under “Output Format”; not verified execution.

Posibles superficies de riesgo

Los hallazgos estáticos señalan puntos que conviene revisar antes de instalar. No establecen que una skill sea segura, maliciosa ni eficaz.

Se recomienda atención

62 deterministic lexical finding(s) require review across the collected text. Findings can occur in documentation and do not prove execution or exploitability; binary-only files were not scanned.

Acceso a la redObservado
Escrituras de archivosObservado
Uso de credencialesNo observado
Media

Network access is mentioned

10 ocurrencias

A URL or network client appears in this source line. Review destinations, data sent, and trust boundaries; static text cannot establish actual network activity. This rule matched 10 location(s) in the collected text; 3 representative location(s) are cited. Matching text may be documentation, and the analyzer did not execute it.

Nota

File modification is described or implemented

17 ocurrencias

This line contains a possible file-write or redirection operation. Check destination paths and overwrite behavior; the static review did not write any file. This rule matched 17 location(s) in the collected text; 3 representative location(s) are cited. Matching text may be documentation, and the analyzer did not execute it.

Alta

Dynamic command execution is referenced

32 ocurrencias

A shell, dynamic evaluation, or process execution primitive appears here. Inspect arguments and input control. Presence in source does not prove a command ran. This rule matched 32 location(s) in the collected text; 3 representative location(s) are cited. Matching text may be documentation, and the analyzer did not execute it.

Alta

File deletion is described or implemented

Deletion syntax occurs in this line, including possible documentation. Review its exact target, recursive scope, and safeguards. The analyzer did not execute it. This rule matched 1 location(s) in the collected text; 1 representative location(s) are cited. Matching text may be documentation, and the analyzer did not execute it.

Examinar todos los hallazgos de seguridad (62 hallazgos)
Alta

Downloaded content may be executed

2 ocurrencias

This line combines retrieval and execution. Such patterns can run mutable remote code. Review pinning, integrity checks, and isolation; the analyzer performed no download or execution. This rule matched 2 location(s) in the collected text; 2 representative location(s) are cited. Matching text may be documentation, and the analyzer did not execute it.

Dónde puede consumirse el contexto

Las capas de descubrimiento, activación y recursos tienen significados distintos. Los valores exactos solo aparecen cuando el método oficial de recuento se ejecutó con un modelo identificado.

Recuento exacto de tokens no disponible

All token values, including per-file inventory, are null until the pipeline performs an official exact count with an explicit model.

No se registró ninguna medición de tokens con el método oficial requerido. Este dosier no la sustituye por recuentos de caracteres, tamaños de archivo ni estimaciones.

Evaluación controlada

Sin evaluación controlada

Esta skill solo cuenta con las evidencias indicadas arriba. No se afirma ninguna tasa de éxito, eficiencia de tokens, latencia ni ventaja de calidad.

Sin probar

Úsala con el código fuente a la vista

Comando de instalación
Inspect the pinned source at https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/54a798831d2266a3ca61ce68a7acb80b81160d57/skills/detecting-serverless-function-injection/SKILL.md and follow the source repository's installation instructions. No installation was performed or verified by this static analyzer. Source license: Apache-2.0.

Requisitos previos

  • Static analysis cannot assess runtime behavior, command success, network reachability, or model output quality.
  • No commands, scripts, network requests, model calls, or controlled skill executions were performed.
  • Category, tags, capabilities, workflows, and bilingual editorial summaries are deterministic candidates from static parsing, not verified outcomes.
  • Exact token counts are unavailable until a later pipeline performs and records an official model-specific count.

Prompts de ejemplo

No proporcionado

Una decisión, con sus límites

Fortalezas

  • The snapshot contains 4 collected file(s), 2 Markdown file(s), and 1 script file(s), enabling source-level inspection. [Evidence: skills/detecting-serverless-function-injection/SKILL.md:L1]

Aspectos a considerar

  • No functional, security, or model-quality result has been established. Inspect source context and all cited findings before installation or publication.
Conclusión de la investigación

Provisional deterministic static inventory only; from static parsing and, separately, controlled evaluation. No install recommendation, security assurance, or effectiveness claim is made.

Trazable por construcción

El dosier es una lectura acotada en el tiempo de un artefacto público, no un respaldo. Usa el enlace al código fuente para inspeccionar el material original exacto.

mukul975Anthropic-Cybersecurity-Skillsskills/detecting-serverless-function-injection
Tipo de origen
Comunidad
Commit
54a798831d2266a3ca61ce68a7acb80b81160d57
Recopilado
20 nov 2026
Última comprobación
20 nov 2026
Licencia original
Apache-2.0
Estrellas del repositorio
36.446
Base del contenido

Deterministic lexical parsing, YAML frontmatter validation, file inventory, source-described workflow extraction, and heuristic provisional classification of the supplied files only. Generated by machine; no LLM, execution, or dynamic testing.