Back to catalog
Static reviewDevelopment

Skill dossier

detecting-serverless-function-injection

Source declaration

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.

The author's original description, preserved in English. It describes intent, not verified performance.

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

Research summary

Machine-generated analysis; pending human review

These observations come from deterministic source parsing, not a human security review or controlled task evaluation.

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 pending human editorial review.

Review scope

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

Observable capabilities

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

Limitations & scope

  • 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 pending human review, not verified outcomes.
  • Exact token counts are unavailable until a later pipeline performs and records an official model-specific count.

Relevant for

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

What ships with the skill

The file inventory comes from the collected source at the recorded commit. Paths and sizes are structural observations, not a measure of quality.

files
4
Markdown files
2
scripts
1
references
1
Size
66.5 KB
Structural complexity
Low

File inventory

PathTypeBytes
skills/detecting-serverless-function-injection/LICENSEOther11 KB
skills/detecting-serverless-function-injection/references/api-reference.mdReference5 KB
skills/detecting-serverless-function-injection/scripts/agent.pyScript25.9 KB
skills/detecting-serverless-function-injection/SKILL.mdInstruction24.6 KB

SKILL.md frontmatter

{
  "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"
  ]
}

A reading of the operating sequence

This workflow reconstructs the apparent sequence from source material. Unless controlled evaluation is explicitly recorded, it is provisional—not an observed trace.

  1. 01
    Decision

    When to Use

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

  2. 02
    Action

    Workflow

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

  3. 03
    Action

    Step 1: Enumerate the Serverless Attack Surface

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

  4. 04
    Action

    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
    Action

    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.

Inspect all extracted workflow candidates (60 candidate steps)
  1. 07
    Action

    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
    Decision

    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
    Action

    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
    Action

    Step 2: Static Analysis for Injection Sinks

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

  5. 11
    Action

    Download function deployment packages:

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

  6. 12
    Action

    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
    Action

    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
    Action

    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
    Action

    Run Bandit for Python functions:

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

  10. 16
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Decision

    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
    Action

    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
    Action

    Step 4: Detect Malicious Lambda Layer Injection

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

  19. 25
    Action

    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
    Action

    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
    Decision

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    CloudTrail detection query for layer changes:

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

  28. 34
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    Key Concepts

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

  45. 51
    Action

    Tools & Systems

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

  46. 52
    Action

    Common Scenarios

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

  47. 53
    Action

    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
    Action

    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
    Action

    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
    Decision

    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
    Action

    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
    Action

    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
    Action

    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.

Potential risk surfaces

Static findings identify points to inspect before installation. They do not establish that a skill is safe, malicious, or effective.

Attention recommended

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.

Network accessObserved
File writesObserved
Credential useNot observed
Medium

Network access is mentioned

10 occurrences

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.

Note

File modification is described or implemented

17 occurrences

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.

High

Dynamic command execution is referenced

32 occurrences

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.

High

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.

Inspect all security findings (62 findings)
High

Downloaded content may be executed

2 occurrences

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.

Where context can be spent

Discovery, activation, and resource layers have different meanings. Exact values appear only when the official token-counting method was run with a named model.

Exact token counts unavailable

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

No token measurement was recorded with the required official method. This dossier does not substitute character counts, file sizes, or estimates.

Controlled evaluation

No controlled evaluation

This skill has only the evidence identified above. No task success, token efficiency, latency, or quality advantage is claimed.

Not tested

Use with the source in view

Install command
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.

Prerequisites

  • 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 pending human review, not verified outcomes.
  • Exact token counts are unavailable until a later pipeline performs and records an official model-specific count.

Example prompts

Not provided

A decision, with its limits attached

Strengths

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

Considerations

  • No functional, security, or model-quality result has been established. Human review must inspect source context and all cited findings before installation or publication.
Research conclusion

Provisional deterministic static inventory only; pending human editorial review and, separately, controlled evaluation. No install recommendation, security assurance, or effectiveness claim is made.

Traceable by construction

The dossier is a time-bound reading of a public artifact, not an endorsement. Use the source link to inspect the exact upstream material.

mukul975Anthropic-Cybersecurity-Skillsskills/detecting-serverless-function-injection
Source type
Community
Commit
54a798831d2266a3ca61ce68a7acb80b81160d57
Collected
20 Nov 2026
Last checked
20 Nov 2026
Upstream license
Apache-2.0
Repository stars
36,446
Content basis

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, dynamic testing, or human editorial approval.