본문으로 건너뛰기
Skillpedia
에이전트35k · #7871

detecting-serverless-function-injection

하는 일

이 도구는 클라우드 함수(예: AWS Lambda)에서 악성 코드를 실행하려는 공격을 찾고 막는 데 도움을 줍니다. 함수가 받은 데이터가 원하지 않는 명령을 실행하거나 정보를 훔치는 데 쓰일 수 있는지 확인합니다.

사용하는 경우

  • ✓데이터를 통해 클라우드 함수가 공격받을 수 있는지 점검할 때.
  • ✓공격자가 지속적인 접근을 위해 함수 코드를 수정했는지 조사할 때.
  • ✓공격자가 허용된 것보다 더 많은 권한을 얻을 방법이 있는지 찾는 경우.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-serverless-function-injection/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이벤트 데이터를 통한 코드 주입이 있는지 내 Lambda 함수를 검사해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 도구는 함수의 코드와 클라우드 활동 로그를 분석합니다. 함수가 받는 데이터로 악성 명령이 실행될 수 있는 위험한 패턴을 찾습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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
    

…

자주 묻는 질문

‘서버리스 함수’란 무엇인가요?

서버를 직접 관리하지 않아도 클라우드에서 실행되는 프로그램입니다. 대표적으로 AWS Lambda, Azure Functions, Google Cloud Functions가 있습니다.

‘코드 주입’이란 무엇인가요?

공격자가 프로그램에 악성 코드를 넣는 공격 방식입니다. 프로그램이 이 코드를 실행하면 공격자가 제어권을 얻거나, 데이터를 훔치거나, 다른 피해를 줄 수 있습니다.

‘이벤트 소스 중독(event source poisoning)’이란 무엇인가요?

함수를 실행시키는 서비스(예: 저장소에 업로드된 파일이나 큐의 메시지)를 통해 악성 데이터를 보내는 공격입니다. 이 데이터로 함수를 공격할 수 있습니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
35k
순위
#7871
라이선스
Apache-2.0
업데이트
2026. 8. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬