本文へスキップ
Skillpedia
セキュリティ35k · #8303

performing-serverless-function-security-review

できること

このツールは、クラウド関数(AWS Lambda、Azure Functions、GCP Cloud Functionsなど)のセキュリティを確認します。過剰な権限、環境変数に露出したシークレット、悪用される可能性のある脆弱性など、リスクのある設定を探します。

使う場面

  • ✓クラウドアプリケーションを本番環境にデプロイする前。
  • ✓環境変数やログからのデータ漏えいを調査するとき。
  • ✓侵害された関数の影響を把握したいとき。

スキルのリンク

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-serverless-function-security-review/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-serverless-function-security-review/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“AWS上のサーバーレス関数のセキュリティを確認してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

このツールは、特定のコマンドを使ってクラウドサービス(AWS、Azure、GCP)に接続します。関数の一覧を取得し、アクセス権限を確認し、設定内の機密情報を探し、関数へのアクセス経路を分析します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Performing Serverless Function Security Review

When to Use

  • When auditing serverless applications before production deployment
  • When investigating potential data exposure through function environment variables or logs
  • When assessing the blast radius of a compromised serverless function execution role
  • When compliance reviews require documentation of serverless security controls
  • When building secure-by-default templates for serverless deployments

Do not use for container or VM security assessments (use container scanning tools), for API security testing (use DAST tools on the API Gateway layer), or for real-time serverless threat detection (use AWS Lambda Extensions with security agents).

Prerequisites

  • AWS CLI, Azure CLI, and gcloud CLI configured with appropriate permissions
  • Access to read function configurations, policies, and execution roles
  • Prowler or Checkov for automated serverless security scanning
  • SAM CLI or Serverless Framework for local function analysis
  • CloudTrail, Azure Monitor, or Cloud Audit Logs enabled for function invocation monitoring

Workflow

Step 1: Enumerate All Serverless Functions and Configurations

List all functions across cloud providers with their runtime, memory, timeout, and network settings.

# AWS Lambda: List all functions with key security attributes
aws lambda list-functions \
  --query 'Functions[*].[FunctionName,Runtime,MemorySize,Timeout,Role,VpcConfig.VpcId,Layers[*].Arn]' \
  --output table

# Check for functions using deprecated runtimes
aws lambda list-functions \
  --query 'Functions[?Runtime==`python3.7` || Runtime==`nodejs14.x` || Runtime==`dotnetcore3.1`].[FunctionName,Runtime]' \
  --output table

# Azure Functions: List all function apps
az functionapp list \
  --query "[].{Name:name, Runtime:siteConfig.linuxFxVersion, ResourceGroup:resourceGroup, HttpsOnly:httpsOnly}" \
  -o table

# GCP Cloud Functions: List all functions
gcloud functions list \
  --format="table(name, runtime, status, httpsTrigger.url, serviceAccountEmail, vpcConnector)"

Step 2: Audit Execution Role Permissions

Review IAM roles attached to functions for overly permissive policies.

# AWS: Check each Lambda function's execution role
for func in $(aws lambda list-functions --query 'Functions[*].FunctionName' --output text); do
  role_arn=$(aws lambda get-function-configuration --function-name "$func" --query 'Role' --output text)
  role_name=$(echo "$role_arn" | awk -F'/' '{print $NF}')
  echo "=== $func -> $role_name ==="

  # List attached policies
  aws iam list-attached-role-policies --role-name "$role_name" \
    --query 'AttachedPolicies[*].[PolicyName,PolicyArn]' --output table

  # Check for wildcard actions
  for policy_arn in $(aws iam list-attached-role-policies --role-name "$role_name" --query 'AttachedPolicies[*].PolicyArn' --output text); do
    version=$(aws iam get-policy --policy-arn "$policy_arn" --query 'Policy.DefaultVersionId' --output text)
    aws iam get-policy-version --policy-arn "$policy_arn" --version-id "$version" \
      --query 'PolicyVersion.Document' --output json | python3 -c "
import json, sys
doc = json.load(sys.stdin)
for stmt in doc.get('Statement', []):
    actions = stmt.get('Action', [])
    if isinstance(actions, str): actions = [actions]
    resources = stmt.get('Resource', [])
    if isinstance(resources, str): resources = [resources]
    if '*' in actions or any(a.endswith(':*') for a in actions):
        print(f'  WARNING: {stmt[\"Effect\"]} {actions} on {resources}')
" 2>/dev/null
  done
done

Step 3: Check Environment Variables for Secrets

Scan function environment variables for hardcoded credentials, API keys, and database connection strings.

# AWS Lambda: Extract environment variables
for func in $(aws lambda list-functions --query 'Functions[*].FunctionName' --output text); do
  envvars=$(aws lambda get-function-configuration --function-name "$func" \
    --query 'Environment.Variables' --output json 2>/dev/null)
  if [ "$envvars" != "null" ] && [ -n "$envvars" ]; then
    echo "=== $func ==="
    echo "$envvars" | python3 -c "
import json, sys, re
vars = json.load(sys.stdin)
sensitive_patterns = [
    r'(?i)(password|secret|key|token|credential|api.?key)',
    r'(?i)(aws.?access|aws.?secret)',
    r'(?i)(database.?url|connection.?string|db.?pass)',
    r'AKIA[0-9A-Z]{16}'
]
for key, value in vars.items():
    for pattern in sensitive_patterns:

…
よくある質問

サーバーレス関数とは何ですか?

サーバーを自分で管理しなくても、クラウド上で動く小さなプログラムのことです。料金は実行された時間に対してのみ支払います。

「過剰な権限を持つロール」とは何ですか?

関数が動作に必要な量を超える権限を持っている状態です。侵害された場合のリスクが高まります。

「インジェクションの脆弱性」とは何ですか?

攻撃者が悪意のあるコマンドを関数に挿入できてしまうセキュリティ上の欠陥です。データを盗まれたり、システムを乗っ取られたりする可能性があります。

詳細

作者による元の説明

Performing security reviews of serverless functions across AWS Lambda, Azure Functions, and GCP Cloud Functions to identify overly permissive execution roles, insecure environment variables, injection vulnerabilities, and missing runtime protections. '

repo: mukul975/Anthropic-Cybersecurity-Skills

人気

GitHubのスター
35k
ランキング
#8303
ライセンス
Apache-2.0
更新日
2026/8/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル