Saltar al contenido
Skillpedia
Agentes35 mil · #7871

detecting-serverless-function-injection

Qué hace

Esta herramienta ayuda a encontrar y prevenir ataques que intentan ejecutar código malicioso en funciones en la nube (como AWS Lambda). Comprueba si los datos que reciben estas funciones pueden usarse para ejecutar comandos no deseados o robar información.

Cuándo usarla

  • ✓Cuando quieras comprobar si se puede atacar una función en la nube a través de los datos que recibe.
  • ✓Cuando investigues si un atacante modificó el código de una función para mantener un acceso persistente.
  • ✓Cuando busques formas en que un atacante podría obtener más permisos de los que debería tener.

Link de la skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-serverless-function-injection/SKILL.md

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-serverless-function-injection/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Analiza mis funciones Lambda en busca de inyección de código a través de los datos de eventos.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

La herramienta analiza el código de la función y los registros de actividad de la nube. Busca patrones peligrosos que podrían permitir ejecutar comandos maliciosos usando los datos que recibe la función.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de GitHub.

Detecting Serverless Function Injection

When to Use

  • Auditing Lambda/Cloud Functions for code injection vulnerabilities where unsanitized event data flows into dangerous runtime functions (eval, exec, child_process.exec, os.system)
  • Investigating incidents where an attacker modified function code or layers to establish persistence or exfiltrate data from the serverless environment
  • Detecting privilege escalation paths where an adversary with lambda:UpdateFunctionCode and iam:PassRole can assume higher-privilege execution roles
  • Analyzing event source poisoning attacks where malicious payloads are injected through S3 object uploads, SQS messages, DynamoDB stream records, or API Gateway requests that trigger function execution
  • Building detection rules for SOC teams monitoring serverless workloads for unauthorized function modifications, layer additions, and suspicious invocation patterns

Do not use for load testing or denial-of-service simulation against serverless functions, for testing against production functions processing live customer data without explicit authorization, or for modifying IAM policies in shared accounts without change management approval.

Prerequisites

  • AWS account access with read permissions for Lambda, CloudTrail, IAM, CloudWatch Logs, and EventBridge
  • AWS CLI v2 configured with appropriate credentials and region
  • CloudTrail enabled with Data Events for Lambda (captures Invoke events) and Management Events (captures UpdateFunctionCode, UpdateFunctionConfiguration, CreateFunction)
  • Python 3.9+ with boto3, bandit (Python SAST), and semgrep for static analysis
  • Access to function source code or deployment packages for static analysis
  • CloudWatch Logs Insights access for querying Lambda execution logs

Workflow

Step 1: Enumerate the Serverless Attack Surface

Map all Lambda functions and their event source triggers to understand injection entry points:

  • List all Lambda functions and their configurations:
    aws lambda list-functions --query 'Functions[*].[FunctionName,Runtime,Role,Handler,Layers]' --output table
    
  • Map event source mappings: Each event source mapping is a potential injection entry point where untrusted data enters the function:
    aws lambda list-event-source-mappings --output json | \
      jq '.EventSourceMappings[] | {Function: .FunctionArn, Source: .EventSourceArn, State: .State}'
    
  • Identify API Gateway triggers: API Gateway routes pass HTTP request data (headers, query strings, body, path parameters) directly into the Lambda event object:
    aws apigateway get-rest-apis --query 'items[*].[id,name]' --output table
    
    For each API, enumerate resources and methods to identify which Lambda functions receive user-controlled HTTP input.
  • Identify S3 event triggers: S3 bucket notifications can trigger Lambda with attacker-controlled object keys and metadata:
    aws s3api get-bucket-notification-configuration --bucket <bucket-name>
    
  • Catalog function environment variables: Secrets in environment variables are exposed if an attacker achieves code execution inside the function:
    aws lambda get-function-configuration --function-name <name> \
      --query 'Environment.Variables' --output json
    
  • Identify overprivileged execution roles: Functions with * resource permissions or administrative policies are high-value escalation targets:
    aws iam list-attached-role-policies --role-name <lambda-exec-role>
    aws iam list-role-policies --role-name <lambda-exec-role>
    

Step 2: Static Analysis for Injection Sinks

Scan function code for dangerous patterns that allow injected event data to execute as code or commands:

  • Download function deployment packages:
    aws lambda get-function --function-name <name> --query 'Code.Location' --output text | xargs curl -o function.zip
    unzip function.zip -d function_code/
    
  • Python injection sinks (Lambda Python runtimes): Search for functions that execute strings as code:
    # DANGEROUS: Direct eval/exec of event data
    eval(event['expression'])           # Code injection via eval
    exec(event['code'])                 # Arbitrary code execution
    os.system(event['command'])         # OS command injection
    subprocess.call(event['cmd'], shell=True)  # Shell injection
    os.popen(event['input'])            # Command injection
    

…

Preguntas frecuentes

¿Qué son las 'funciones sin servidor'?

Son programas que se ejecutan en la nube sin que tengas que gestionar servidores. Algunos ejemplos comunes son AWS Lambda, Azure Functions y Google Cloud Functions.

¿Qué es la 'inyección de código'?

Es un tipo de ataque en el que un atacante inserta código malicioso en un programa. Si el programa ejecuta ese código, el atacante puede tomar el control, robar datos o causar otros daños.

¿Qué es el 'envenenamiento de la fuente de eventos'?

Es un ataque en el que se envían datos maliciosos a través de los servicios que activan las funciones en la nube (como archivos subidos a un almacenamiento o mensajes en una cola). Después, estos datos pueden usarse para atacar la función.

Detalles

Descripción original del autor

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

repo: mukul975/Anthropic-Cybersecurity-Skills

Popularidad

Estrellas en GitHub
35 mil
Posición en el ranking
#7871
Licencia
Apache-2.0
Actualizada
31/8/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas