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

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-serverless-function-injection/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“افحص دوال Lambda الخاصة بي بحثًا عن حقن الشيفرة عبر بيانات الأحداث.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

تحلل هذه المهارة شيفرة الدالة وسجلات النشاط السحابي. تبحث عن أنماط خطرة قد تسمح بتنفيذ أوامر ضارة باستخدام البيانات التي تستقبلها الدالة.

المحتوى التقني (ملف 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.

ما هو «حقن الشيفرة»؟

هو نوع من الهجمات يُدخل فيه المهاجم شيفرة خبيثة في برنامج، فإذا نفّذها البرنامج يستطيع المهاجم السيطرة عليه أو سرقة البيانات أو إلحاق ضرر آخر.

ما هو «تسميم مصدر الأحداث»؟

هو هجوم يُرسَل فيه بيانات خبيثة عبر الخدمات التي تشغّل الدوال السحابية، مثل ملفات تُرفع إلى التخزين أو رسائل في طابور انتظار، ثم تُستخدم هذه البيانات لمهاجمة الدالة.

التفاصيل

الوصف الأصلي من المؤلف

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
آخر تحديث
31‏/8‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة