detecting-serverless-function-injection
Detects and prevents code injection attacks targeting serverless functions (AWS Lambda, Azure Functions, Google Cloud Functions) through event source…
Skill by mukul975
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/mukul975-detecting-serverless-function-injection
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, cloud, security
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/detecting-serverless-function-injection
What's inside
- Skill 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.
- License
- Apache-2.0
- Instructions
- 469 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
- Instructions call the network
Files (4)
- LICENSE
- SKILL.md
- api-reference.md · references/
- agent.py · scripts/
SKILL.md (first lines)
# 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**:
```bash
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:
```bash
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:
```bash
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:
```bash
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:
```bash
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:
```bash
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**:
```bash
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:
```python
# 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
pickle.loads(event['data']) # Deserialization attack
yaml.load(event['config']) # YAML deserialization (unsafe loader)
```
- **Node.js injection sinks** (Lambda Node.js runtimes):
```javascript
// DANGEROUS: Direct execution of event data
eval(event.expression); // Code injection
new Function(event.code)(); // Dynamic function creation
child_process.exec(event.command); // OS command injection
child_process.execSync(event.cmd); // Synchronous command injection
vm.runInNewContext(event.script); // Sandbox escape potential
require('child_process').exec(event.input); // Import-and-execute pattern
```
- **Run Semgrep with serverless rules**: Use purpose-built rules that detect event data flowing into injection sinks:
```bash
semgrep --config "p/owasp-top-ten" --config "p/command-injection" \
--config "p/python-security" function_code/ --json --output semgrep_results.json
```
- **Run Bandit for Python functions**:
```bash
bandit -r function_code/ -f json -o bandit_results.json \
-t B102,B301,B307,B602,B603,B604,B605,B606,B607
```
These test IDs specifically target `exec`, `pickle`, `eval`, `subprocess` with `shell=True`, and other injection-relevant patterns.
- **Custom pattern detection**: Search for indirect injection patterns where event data is concatenated into strings that are later executed:
```python
# Indirect injection: event data flows into SQL query string
query = f"SELECT * FROM users WHERE id = '{event['userId']}'"
cursor.execute(query) # SQL injection
# Indirect injection: event data flows into template rendering
template = event['template']
rendered = jinja2.Template(template).render() # SSTI
```
### Step 3: Detect Event Source Poisoning
Analyze event sources for injection payloads that exploit how Lambda processes triggers:
- **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:
```python
# Vulnerable Lambda handler
def handler(event, context):
bucket = event['Records'][0]['s3']['bucket']['name']
key = event['Records'][0]['s3']['object']['key']
# VULNERABLE: key is attacker-controlledFrom mukul975/Anthropic-Cybersecurity-Skills, Apache-2.0.
More from mukul975/Anthropic-Cybersecurity-Skills
- 0.616score
conducting-spearphishing-simulation-campaign
mukul975
Run a targeted spearphishing simulation for initial access by developing OSINT-derived pretexts, building payloads (HTML smuggling, macro docs, ISO/LNK…
SkillBFreshness: B★ 34.9KClaude Code +9 - 0.616score
conducting-social-engineering-penetration-test
mukul975
Design and execute a social engineering penetration test combining OSINT-driven target profiling with phishing, vishing, smishing, and physical pretexting…
SkillBFreshness: B★ 34.9KClaude Code +9 - 0.616score
conducting-domain-persistence-with-dcsync
mukul975
Perform DCSync attacks by abusing MS-DRSR replication rights (DS-Replication-Get-Changes/-All) to impersonate a Domain Controller and extract KRBTGT, Domain…
SkillBFreshness: B★ 34.9KClaude Code +9 - 0.616score
building-threat-intelligence-platform
mukul975
Design and deploy a Threat Intelligence Platform (TIP) by integrating open-source CTI tools (MISP, OpenCTI, TheHive, Cortex) into a unified system with feed…
SkillBFreshness: B★ 34.9KClaude Code +9 - 0.616score
building-threat-intelligence-enrichment-in-splunk
mukul975
Build automated IOC enrichment pipelines in Splunk Enterprise Security by ingesting threat feeds into KV Store collections and correlating them against…
SkillBFreshness: B★ 34.9KClaude Code +9 - 0.616score
building-vulnerability-aging-and-sla-tracking
mukul975
Implement a vulnerability aging dashboard and SLA tracking system that measures time-to-remediation against severity-based deadlines (e.g.
SkillBFreshness: B★ 34.9KClaude Code +9 - 0.616score
analyzing-cobaltstrike-malleable-c2-profiles
mukul975
Parse and analyze Cobalt Strike Malleable C2 profiles with dissect.cobaltstrike (profiles and beacon-payload configs) and pyMalleableC2 (AST parsing) to…
SkillBFreshness: B★ 34.9KClaude Code +9 - 0.616score
attacking-oauth-with-device-code-phishing
mukul975
Run OAuth 2.0 device-code and illicit-consent phishing attacks against Microsoft Entra ID, using TokenTactics-style tooling to steal access and refresh…
SkillBFreshness: B★ 34.9KClaude Code +9 - 0.616score
conducting-external-reconnaissance-with-osint
mukul975
Conduct external recon using OSINT techniques to map an organization's external attack surface without touching target systems, gathering DNS records…
SkillBFreshness: B★ 34.9KClaude Code +9 - 0.616score
building-malware-incident-communication-template
mukul975
Build structured communication templates for malware incidents (ransomware, wiper, trojan, worm), covering internal stakeholder notifications, executive…
SkillBFreshness: B★ 34.9KClaude Code +9 - 0.616score
conducting-gdpr-compliance-assessment
mukul975
Conduct comprehensive GDPR compliance assessments by evaluating data processing activities against EU Regulation 2016/679, including Article 30 records of…
SkillBFreshness: B★ 34.9KClaude Code +9 - 0.616score
configuring-active-directory-tiered-model
mukul975
Implement Microsoft's Enhanced Security Admin Environment (ESAE) tiered administration model for Active Directory, covering Tier 0/1/2 separation, privileged…
SkillBFreshness: B★ 34.9KClaude Code +9
Signals
- Stars
- 34,941
- Forks
- 4,256
- Open issues
- 24
- Last commit (this folder)
- Jun 1, 2026 (5 months ago)
- Last release
- Jun 22, 2026 (4 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from mukul975
- 0.616score
building-threat-intelligence-platform
mukul975
Design and deploy a Threat Intelligence Platform (TIP) by integrating open-source CTI tools (MISP, OpenCTI, TheHive, Cortex) into a unified system with feed…
SkillBFreshness: B★ 34.9KClaude Code +9 - 0.616score
building-vulnerability-aging-and-sla-tracking
mukul975
Implement a vulnerability aging dashboard and SLA tracking system that measures time-to-remediation against severity-based deadlines (e.g.
SkillBFreshness: B★ 34.9KClaude Code +9 - 0.616score
conducting-domain-persistence-with-dcsync
mukul975
Perform DCSync attacks by abusing MS-DRSR replication rights (DS-Replication-Get-Changes/-All) to impersonate a Domain Controller and extract KRBTGT, Domain…
SkillBFreshness: B★ 34.9KClaude Code +9 - 0.616score
conducting-external-reconnaissance-with-osint
mukul975
Conduct external recon using OSINT techniques to map an organization's external attack surface without touching target systems, gathering DNS records…
SkillBFreshness: B★ 34.9KClaude Code +9 - 0.616score
conducting-gdpr-compliance-assessment
mukul975
Conduct comprehensive GDPR compliance assessments by evaluating data processing activities against EU Regulation 2016/679, including Article 30 records of…
SkillBFreshness: B★ 34.9KClaude Code +9 - 0.616score
building-threat-intelligence-enrichment-in-splunk
mukul975
Build automated IOC enrichment pipelines in Splunk Enterprise Security by ingesting threat feeds into KV Store collections and correlating them against…
SkillBFreshness: B★ 34.9KClaude Code +9
Cite this page
detecting-serverless-function-injection skill. Agent Mart. https://agentmart.dev/skills/mukul975-detecting-serverless-function-injection (last updated 2026-10-24)