Torna al catalogo
Revisione staticaSviluppo

Dossier della skill

detecting-serverless-function-injection

Dichiarazione di fonte

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 descrizione originale dell'autore, conservata in inglese. Descrive l'intento, non prestazioni verificate.

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

I contenuti di ricerca di questo sito sono pubblicati in inglese e cinese e qui sono mostrati in inglese.

Sintesi della ricerca

Analisi statica

Queste osservazioni derivano dall'analisi deterministica del sorgente. Non sono una valutazione controllata delle attività.

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.

Ambito della revisione

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.

Capacità osservabili

  • 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]

Limiti e ambito

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

Utile per

  • 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]

Cosa contiene la skill

L'inventario dei file proviene dal sorgente raccolto al commit registrato. Percorsi e dimensioni sono osservazioni strutturali, non una misura di qualità.

file
4
File Markdown
2
script
1
riferimenti
1
Dimensione
66,5 KB
Complessità strutturale
Bassa

Inventario dei file

PercorsoTipoByte
skills/detecting-serverless-function-injection/LICENSEAltro11 KB
skills/detecting-serverless-function-injection/references/api-reference.mdRiferimento5 KB
skills/detecting-serverless-function-injection/scripts/agent.pyScript25,9 KB
skills/detecting-serverless-function-injection/SKILL.mdIstruzione24,6 KB

Frontmatter di 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 lettura della sequenza operativa

Questo workflow ricostruisce la sequenza apparente a partire dal materiale sorgente. A meno che sia registrata esplicitamente una valutazione controllata, è provvisorio e non una traccia osservata.

  1. 01
    Decisione

    When to Use

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

  2. 02
    Azione

    Workflow

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

  3. 03
    Azione

    Step 1: Enumerate the Serverless Attack Surface

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

  4. 04
    Azione

    List all Lambda functions and their configurations:

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

  5. 05
    Input

    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
    Azione

    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.

Esamina tutti i passaggi di workflow candidati (60 passaggi candidati)
  1. 07
    Azione

    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
    Decisione

    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
    Azione

    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
    Azione

    Step 2: Static Analysis for Injection Sinks

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

  5. 11
    Azione

    Download function deployment packages:

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

  6. 12
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    Run Bandit for Python functions:

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

  10. 16
    Azione

    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
    Input

    Step 3: Detect Event Source Poisoning

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

  12. 18
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Decisione

    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
    Azione

    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
    Azione

    Step 4: Detect Malicious Lambda Layer Injection

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

  19. 25
    Azione

    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
    Azione

    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
    Decisione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    CloudTrail detection query for layer changes:

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

  28. 34
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    Step 6: Implement Runtime Injection Prevention

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

  39. 45
    Input

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    Key Concepts

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

  45. 51
    Azione

    Tools & Systems

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

  46. 52
    Azione

    Common Scenarios

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

  47. 53
    Azione

    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
    Azione

    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
    Azione

    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
    Decisione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Output

    Output Format

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

Possibili superfici di rischio

I rilievi statici indicano i punti da esaminare prima dell'installazione. Non stabiliscono che una skill sia sicura, dannosa o efficace.

Attenzione consigliata

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.

Accesso alla reteOsservato
Scritture su fileOsservato
Uso di credenzialiNon osservato
Medio

Network access is mentioned

10 occorrenze

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 occorrenze

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.

Alto

Dynamic command execution is referenced

32 occorrenze

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.

Alto

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.

Esamina tutti i rilievi di sicurezza (62 rilievi)
Alto

Downloaded content may be executed

2 occorrenze

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.

Dove può essere consumato il contesto

I livelli di individuazione, attivazione e risorse hanno significati diversi. I valori esatti compaiono solo quando il metodo ufficiale di conteggio è stato eseguito con un modello indicato.

Conteggio esatto dei token non disponibile

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

Non è stata registrata alcuna misura dei token con il metodo ufficiale richiesto. Questo dossier non la sostituisce con conteggi di caratteri, dimensioni dei file o stime.

Valutazione controllata

Nessuna valutazione controllata

Questa skill dispone solo delle evidenze indicate sopra. Non si afferma alcun tasso di successo, efficienza in token, latenza o vantaggio di qualità.

Non testato

Usare tenendo il sorgente in vista

Comando di installazione
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.

Prerequisiti

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

Prompt di esempio

Non fornito

Un giudizio, con i suoi limiti

Punti di forza

  • 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]

Aspetti da valutare

  • No functional, security, or model-quality result has been established. Inspect source context and all cited findings before installation or publication.
Conclusione della ricerca

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

Tracciabile per costruzione

Il dossier è una lettura circoscritta nel tempo di un artefatto pubblico, non un'approvazione. Usa il link al sorgente per esaminare il materiale upstream esatto.

mukul975Anthropic-Cybersecurity-Skillsskills/detecting-serverless-function-injection
Tipo di fonte
Community
Commit
54a798831d2266a3ca61ce68a7acb80b81160d57
Raccolta
20 nov 2026
Ultimo controllo
20 nov 2026
Licenza upstream
Apache-2.0
Stelle del repository
36.446
Base dei contenuti

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.