返回技能目录
静态审阅软件开发

技能研究档案

detecting-serverless-function-injection

来源声明

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.

保留作者的英文原始描述。它表达设计意图,不代表已验证的实际效果。

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

研究摘要

机器生成分析,等待人工复核

以下观察来自确定性源码解析,不代表人工安全审查或受控任务评估。

来源描述: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. 此双语摘要由所收集的源文本和文件结构确定性地生成,等待人工编辑复核。

审阅范围

对所收集的 SKILL.md 及辅助文本/代码进行确定性静态分析。机器辅助候选和发现等待人工编辑复核;不评估动态行为或效果。

可观察能力

  • Workflow[来源陈述;暂定,未测试。证据:skills/detecting-serverless-function-injection/SKILL.md:L59]
  • Step 1: Enumerate the Serverless Attack Surface[来源陈述;暂定,未测试。证据:skills/detecting-serverless-function-injection/SKILL.md:L61]
  • Step 2: Static Analysis for Injection Sinks[来源陈述;暂定,未测试。证据:skills/detecting-serverless-function-injection/SKILL.md:L94]
  • Step 3: Detect Event Source Poisoning[来源陈述;暂定,未测试。证据:skills/detecting-serverless-function-injection/SKILL.md:L147]
  • Step 4: Detect Malicious Lambda Layer Injection[来源陈述;暂定,未测试。证据:skills/detecting-serverless-function-injection/SKILL.md:L201]
  • Step 5: Detect IAM Privilege Escalation via Lambda[来源陈述;暂定,未测试。证据:skills/detecting-serverless-function-injection/SKILL.md:L245]
  • Step 6: Implement Runtime Injection Prevention[来源陈述;暂定,未测试。证据:skills/detecting-serverless-function-injection/SKILL.md:L297]

限制与范围

  • 静态分析无法评估运行时行为、命令是否成功、网络可达性或模型输出质量。
  • 未执行任何命令、脚本、网络请求、模型调用或受控技能测试。
  • 类别、标签、能力、工作流程和双语编辑摘要均为待人工复核的确定性候选,并非已验证结果。
  • 在后续管线实际执行并记录官方模型专用计数之前,无法提供精确 token 数。

适用读者

  • 评估是否检查并安装该来源技能的实践者;此受众由产品语境推断,并非测量得到的使用情况。[证据:skills/detecting-serverless-function-injection/SKILL.md:L1-L37]

技能包含哪些内容

文件清单来自记录提交中的采集源码。路径与大小属于结构观察,不代表质量评价。

个文件
4
Markdown 文件
2
个脚本
1
个引用
1
大小
66.5 KB
结构复杂度
低

文件清单

路径类型字节
skills/detecting-serverless-function-injection/LICENSE其他11 KB
skills/detecting-serverless-function-injection/references/api-reference.md引用5 KB
skills/detecting-serverless-function-injection/scripts/agent.py脚本25.9 KB
skills/detecting-serverless-function-injection/SKILL.md指令24.6 KB

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

对运行顺序的一种解读

此工作流根据源码材料重建表面顺序。除非明确记录受控评估,否则它属于暂定解读,而非真实运行轨迹。

  1. 01
    判断

    When to Use

    来源描述的决策候选,位于“When to Use”;未经执行验证。

  2. 02
    操作

    Workflow

    来源描述的步骤候选,位于“Workflow”;未经执行验证。

  3. 03
    操作

    Step 1: Enumerate the Serverless Attack Surface

    来源描述的步骤候选,位于“Step 1: Enumerate the Serverless Attack Surface”;未经执行验证。

  4. 04
    操作

    List all Lambda functions and their configurations:

    来源描述的步骤候选,位于“Step 1: Enumerate the Serverless Attack Surface”;未经执行验证。

  5. 05
    输入

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

    来源描述的步骤候选,位于“Step 1: Enumerate the Serverless Attack Surface”;未经执行验证。

  6. 06
    操作

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

    来源描述的步骤候选,位于“Step 1: Enumerate the Serverless Attack Surface”;未经执行验证。

查看全部工作流候选节点 (60 个候选步骤)
  1. 07
    操作

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

    来源描述的步骤候选,位于“Step 1: Enumerate the Serverless Attack Surface”;未经执行验证。

  2. 08
    判断

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

    来源描述的决策候选,位于“Step 1: Enumerate the Serverless Attack Surface”;未经执行验证。

  3. 09
    操作

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

    来源描述的步骤候选,位于“Step 1: Enumerate the Serverless Attack Surface”;未经执行验证。

  4. 10
    操作

    Step 2: Static Analysis for Injection Sinks

    来源描述的步骤候选,位于“Step 2: Static Analysis for Injection Sinks”;未经执行验证。

  5. 11
    操作

    Download function deployment packages:

    来源描述的步骤候选,位于“Step 2: Static Analysis for Injection Sinks”;未经执行验证。

  6. 12
    操作

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

    来源描述的步骤候选,位于“Step 2: Static Analysis for Injection Sinks”;未经执行验证。

  7. 13
    操作

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

    来源描述的步骤候选,位于“Step 2: Static Analysis for Injection Sinks”;未经执行验证。

  8. 14
    操作

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

    来源描述的步骤候选,位于“Step 2: Static Analysis for Injection Sinks”;未经执行验证。

  9. 15
    操作

    Run Bandit for Python functions:

    来源描述的步骤候选,位于“Step 2: Static Analysis for Injection Sinks”;未经执行验证。

  10. 16
    操作

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

    来源描述的步骤候选,位于“Step 2: Static Analysis for Injection Sinks”;未经执行验证。

  11. 17
    输入

    Step 3: Detect Event Source Poisoning

    来源描述的步骤候选,位于“Step 3: Detect Event Source Poisoning”;未经执行验证。

  12. 18
    操作

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

    来源描述的步骤候选,位于“Step 3: Detect Event Source Poisoning”;未经执行验证。

  13. 19
    操作

    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:

    来源描述的步骤候选,位于“Step 3: Detect Event Source Poisoning”;未经执行验证。

  14. 20
    操作

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

    来源描述的步骤候选,位于“Step 3: Detect Event Source Poisoning”;未经执行验证。

  15. 21
    操作

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

    来源描述的步骤候选,位于“Step 3: Detect Event Source Poisoning”;未经执行验证。

  16. 22
    判断

    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:

    来源描述的决策候选,位于“Step 3: Detect Event Source Poisoning”;未经执行验证。

  17. 23
    操作

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

    来源描述的步骤候选,位于“Step 3: Detect Event Source Poisoning”;未经执行验证。

  18. 24
    操作

    Step 4: Detect Malicious Lambda Layer Injection

    来源描述的步骤候选,位于“Step 4: Detect Malicious Lambda Layer Injection”;未经执行验证。

  19. 25
    操作

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

    来源描述的步骤候选,位于“Step 4: Detect Malicious Lambda Layer Injection”;未经执行验证。

  20. 26
    操作

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

    来源描述的步骤候选,位于“Step 4: Detect Malicious Lambda Layer Injection”;未经执行验证。

  21. 27
    判断

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

    来源描述的决策候选,位于“Step 4: Detect Malicious Lambda Layer Injection”;未经执行验证。

  22. 28
    操作

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

    来源描述的步骤候选,位于“Step 4: Detect Malicious Lambda Layer Injection”;未经执行验证。

  23. 29
    操作

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

    来源描述的步骤候选,位于“Step 4: Detect Malicious Lambda Layer Injection”;未经执行验证。

  24. 30
    操作

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

    来源描述的步骤候选,位于“Step 4: Detect Malicious Lambda Layer Injection”;未经执行验证。

  25. 31
    操作

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

    来源描述的步骤候选,位于“Step 4: Detect Malicious Lambda Layer Injection”;未经执行验证。

  26. 32
    操作

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

    来源描述的步骤候选,位于“Step 4: Detect Malicious Lambda Layer Injection”;未经执行验证。

  27. 33
    操作

    CloudTrail detection query for layer changes:

    来源描述的步骤候选,位于“Step 4: Detect Malicious Lambda Layer Injection”;未经执行验证。

  28. 34
    操作

    Step 5: Detect IAM Privilege Escalation via Lambda

    来源描述的步骤候选,位于“Step 5: Detect IAM Privilege Escalation via Lambda”;未经执行验证。

  29. 35
    操作

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

    来源描述的步骤候选,位于“Step 5: Detect IAM Privilege Escalation via Lambda”;未经执行验证。

  30. 36
    操作

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

    来源描述的步骤候选,位于“Step 5: Detect IAM Privilege Escalation via Lambda”;未经执行验证。

  31. 37
    操作

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

    来源描述的步骤候选,位于“Step 5: Detect IAM Privilege Escalation via Lambda”;未经执行验证。

  32. 38
    操作

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

    来源描述的步骤候选,位于“Step 5: Detect IAM Privilege Escalation via Lambda”;未经执行验证。

  33. 39
    操作

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

    来源描述的步骤候选,位于“Step 5: Detect IAM Privilege Escalation via Lambda”;未经执行验证。

  34. 40
    操作

    Detect UpdateFunctionCode events: Monitor CloudTrail for function code modifications:

    来源描述的步骤候选,位于“Step 5: Detect IAM Privilege Escalation via Lambda”;未经执行验证。

  35. 41
    操作

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

    来源描述的步骤候选,位于“Step 5: Detect IAM Privilege Escalation via Lambda”;未经执行验证。

  36. 42
    操作

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

    来源描述的步骤候选,位于“Step 5: Detect IAM Privilege Escalation via Lambda”;未经执行验证。

  37. 43
    操作

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

    来源描述的步骤候选,位于“Step 5: Detect IAM Privilege Escalation via Lambda”;未经执行验证。

  38. 44
    操作

    Step 6: Implement Runtime Injection Prevention

    来源描述的步骤候选,位于“Step 6: Implement Runtime Injection Prevention”;未经执行验证。

  39. 45
    输入

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

    来源描述的步骤候选,位于“Step 6: Implement Runtime Injection Prevention”;未经执行验证。

  40. 46
    操作

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

    来源描述的步骤候选,位于“Step 6: Implement Runtime Injection Prevention”;未经执行验证。

  41. 47
    操作

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

    来源描述的步骤候选,位于“Step 6: Implement Runtime Injection Prevention”;未经执行验证。

  42. 48
    操作

    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:

    来源描述的步骤候选,位于“Step 6: Implement Runtime Injection Prevention”;未经执行验证。

  43. 49
    操作

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

    来源描述的步骤候选,位于“Step 6: Implement Runtime Injection Prevention”;未经执行验证。

  44. 50
    操作

    Key Concepts

    来源描述的步骤候选,位于“Key Concepts”;未经执行验证。

  45. 51
    操作

    Tools & Systems

    来源描述的步骤候选,位于“Tools & Systems”;未经执行验证。

  46. 52
    操作

    Common Scenarios

    来源描述的步骤候选,位于“Common Scenarios”;未经执行验证。

  47. 53
    操作

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

    来源描述的步骤候选,位于“Scenario: Detecting and Responding to a Lambda-Based Privilege Escalation Attack”;未经执行验证。

  48. 54
    操作

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

    来源描述的步骤候选,位于“Scenario: Detecting and Responding to a Lambda-Based Privilege Escalation Attack”;未经执行验证。

  49. 55
    操作

    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

    来源描述的步骤候选,位于“Scenario: Detecting and Responding to a Lambda-Based Privilege Escalation Attack”;未经执行验证。

  50. 56
    判断

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

    来源描述的决策候选,位于“Scenario: Detecting and Responding to a Lambda-Based Privilege Escalation Attack”;未经执行验证。

  51. 57
    操作

    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

    来源描述的步骤候选,位于“Scenario: Detecting and Responding to a Lambda-Based Privilege Escalation Attack”;未经执行验证。

  52. 58
    操作

    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

    来源描述的步骤候选,位于“Scenario: Detecting and Responding to a Lambda-Based Privilege Escalation Attack”;未经执行验证。

  53. 59
    操作

    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

    来源描述的步骤候选,位于“Scenario: Detecting and Responding to a Lambda-Based Privilege Escalation Attack”;未经执行验证。

  54. 60
    输出

    Output Format

    来源描述的步骤候选,位于“Output Format”;未经执行验证。

潜在风险面

静态发现用于提示安装前需要检查的位置,不能证明一项技能安全、恶意或有效。

建议重点关注

收集的文本中有 62 项确定性词法发现需要复核。发现可能仅位于文档中,不证明已执行或可被利用;仅含二进制的文件未扫描。

网络访问已观察到
文件写入已观察到
凭据使用未观察到
中

文本提及网络访问

10 次命中

此源文件行包含 URL 或网络客户端。应检查目标地址、发送的数据和信任边界;静态文本无法证明实际发生了网络活动。 该规则在收集文本中命中 10 处;此处列出 3 个代表位置。命中文本可能只是文档,分析器没有执行它。

提示

文本描述或实现了文件修改

17 次命中

此行包含可能的文件写入或重定向操作。应检查目标路径和覆盖行为;静态审查没有写入任何文件。 该规则在收集文本中命中 17 处;此处列出 3 个代表位置。命中文本可能只是文档,分析器没有执行它。

高

文本引用动态命令执行

32 次命中

此行出现 shell、动态求值或进程执行原语。应检查参数和输入控制;源代码中出现这些语法并不证明命令已运行。 该规则在收集文本中命中 32 处;此处列出 3 个代表位置。命中文本可能只是文档,分析器没有执行它。

高

文本描述或实现了文件删除

此行包含删除语法,也可能只是文档示例。应检查确切目标、递归范围和保护措施。分析器没有执行该命令。 该规则在收集文本中命中 1 处;此处列出 1 个代表位置。命中文本可能只是文档,分析器没有执行它。

查看全部安全发现 (62 项发现)

上下文可能消耗在哪里

发现、激活与资源层具有不同含义。只有使用指定官方方法并记录模型的运行时,才显示精确数值。

精确 token 计数不可用

在管线使用明确模型执行官方精确计数之前,包括文件清单在内的所有 token 值均为 null。

未使用要求的官方方法记录 token 测量。本档案不会用字符数、文件大小或估计值替代。

受控评估

没有受控评估

该技能仅具备以上标明的证据。不声称任何任务成功率、token 效率、延迟或质量优势。

尚未测试

在源码可见的情况下使用

安装命令
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.

前置条件

  • 静态分析无法评估运行时行为、命令是否成功、网络可达性或模型输出质量。
  • 未执行任何命令、脚本、网络请求、模型调用或受控技能测试。
  • 类别、标签、能力、工作流程和双语编辑摘要均为待人工复核的确定性候选,并非已验证结果。
  • 在后续管线实际执行并记录官方模型专用计数之前,无法提供精确 token 数。

示例提示词

未提供

附上限制条件的判断

优势

  • 快照包含 4 个收集文件、2 个 Markdown 文件和 1 个脚本文件,可进行源代码级检查。[证据:skills/detecting-serverless-function-injection/SKILL.md:L1]

注意事项

  • 尚未确立功能、安全或模型质量结果。安装或发布前,人工复核必须检查源代码上下文和所有引用发现。
研究结论

仅为暂定的确定性静态清单;等待人工编辑复核以及独立的受控评估。不构成安装建议、安全保证或有效性声明。

从结构上保持可追溯

档案是对公开工件的限时阅读,而非背书。请通过来源链接检查确切的上游材料。

mukul975Anthropic-Cybersecurity-Skillsskills/detecting-serverless-function-injection
来源类型
社区
提交
54a798831d2266a3ca61ce68a7acb80b81160d57
采集时间
2026年11月20日
最近核查
2026年11月20日
上游许可证
Apache-2.0
仓库星标
36,446
内容依据

仅对提供的文件进行确定性词法解析、YAML frontmatter 校验、文件清单、来源描述的工作流程提取和启发式暂定分类。由机器生成;无 LLM、执行、动态测试或人工编辑批准。