Strobesstrobes
Platform
Solutions
Resources
Customers
Company
Pricing
Book a Demo
Strobesstrobes

Strobes connects every exposure signal to autonomous action, so security teams fix what matters, prove what works, and stop chasing noise.

Book a DemoTalk to an expert
ISO 27001SOC 2CREST
  • Platform
  • Platform Overview
  • Agentic Exposure Management
  • AI Agents
  • Integrations
  • API & Developers
  • Workflows & Automation
  • Analytics & Reporting
  • Solutions
  • Exposure Assessment (EAP)
  • Attack Surface Management
  • Application Security Posture
  • Risk-Based Vulnerability Management
  • Adversarial Exposure Validation (AEV)
  • AI Pentesting
  • Pentesting as a Service
  • CTEM Framework
  • By Industry
  • Financial Institutions
  • Technology
  • Retail
  • Healthcare
  • Manufacturing
  • By Roles
  • CISOs
  • Security Directors
  • Cloud Security Leaders
  • App Sec Leaders
  • Resources
  • Quick Agentic Pentest
  • Blog
  • Customer Stories
  • eBooks
  • Datasheets
  • Videos & Demos
  • Exposure Management Academy
  • CTEM Maturity Assessment
  • Pentest Health Check
  • Security Tool ROI Calculator
  • Company
  • About Strobes
  • Meet the Team
  • Trust & Security
  • Contact Us
  • Careers
  • Become a Partner
  • Technology Partner
  • Partner Deal Registration
  • Press Release

Weekly insight for security leaders

CTEM research, agentic AI trends, and what's actually moving the needle.

© 2026 Strobes Security Inc. All rights reserved.

Privacy PolicyTerms of ServiceCookie PolicyAccessibilitySitemap
Back to Blog
Serverless Architecture Penetration Testing
Cloud pentestingApplication Security

Serverless Architecture Penetration Testing

Akhil ReniAugust 23, 20258 min read

Table of Contents

  • What is serverless penetration testing?
  • Event injection comes from the triggers nobody validates
  • In serverless, the role is the blast radius
  • How do dependencies and secrets create risk?
  • What does a real serverless engagement turn up, and how do you fix it?
  • Frequently asked questions
  • Sources and references

Authors

A
Akhil Reni

Share

Table of Contents

  • What is serverless penetration testing?
  • Event injection comes from the triggers nobody validates
  • In serverless, the role is the blast radius
  • How do dependencies and secrets create risk?
  • What does a real serverless engagement turn up, and how do you fix it?
  • Frequently asked questions
  • Sources and references

Authors

A
Akhil Reni

Share

TL;DR
  • ✓Serverless collapses the attack surface to four things: the function code, its event sources, its execution-role permissions, and its dependencies. There is no OS or network to attack.
  • ✓Event injection is the signature serverless vulnerability: untrusted data from many event sources (HTTP, queues, storage events, email) reaches a sink without validation, and non-HTTP triggers are usually trusted blindly.
  • ✓Over-privileged execution roles are the highest-impact finding. A compromised function inherits its IAM role, so an over-scoped role turns one bug into account-wide access.
  • ✓Third-party dependencies matter more in serverless because each function ships its full dependency tree and runs with the function's permissions, and Lambda exposes its role credentials through environment variables.
  • ✓The OWASP Serverless Top 10 anchors the methodology; pmapper models role blast radius, SCA scans the deployment package, and Prowler or ScoutSuite catch misconfigured functions.

Serverless changes what you attack. There is no server to port-scan, no OS to exploit, no long-lived host to pivot through. A function spins up, runs your code with an IAM role, and disappears. That collapses the attack surface down to four things: the function code, the events that trigger it, the permissions it carries, and the dependencies it ships with. Get those right and serverless is genuinely hard to break; get them wrong and a single event injection inherits an over-privileged role straight into your account.

This guide covers serverless penetration testing for AWS Lambda, Azure Functions, and Google Cloud Functions, organized by that four-part surface rather than a traditional kill chain. You will see a real non-HTTP injection payload, the credentials a function leaks once you have code execution, a dependency-scan finding, and a sample findings table. The OWASP Serverless Top 10 anchors the framework, and written authorization is assumed.

Table of contents
  1. What is serverless penetration testing?
  2. Event injection comes from the triggers nobody validates
  3. In serverless, the role is the blast radius
  4. How do dependencies and secrets create risk?
  5. What does a real serverless engagement turn up, and how do you fix it?

What is serverless penetration testing?

Serverless penetration testing assesses functions-as-a-service applications (AWS Lambda, Azure Functions, Google Cloud Functions) by focusing on code, event sources, IAM permissions, and dependencies rather than infrastructure. The provider owns the runtime, patching, and isolation, so the testable surface shifts almost entirely into the application and its configuration.

The mental model is different from a monolith. A monolith has a handful of front doors; a serverless app has dozens of functions, each triggered by different event sources, each with its own role. The attack surface is wide and shallow. The first move is to inventory it, because the application's serverless.yml, SAM template, or Terraform is gold: it lists every function, its triggers, and its role in one place. The OWASP Serverless Top 10 reframes the familiar web risks for this model, and much of it overlaps with the API and application work in our web application pentesting checklist.

Event injection comes from the triggers nobody validates

Event injection is the serverless equivalent of injection attacks, and it is broader because functions accept input from many event sources, not just HTTP. A Lambda can fire from API Gateway, an SQS or SNS message, an S3 object-created event, a DynamoDB stream, an SES email, or an IoT message. Each carries attacker-influenceable data, and developers trust event data from those internal-feeling sources they would never trust from a web form.

The bug pattern is classic injection: untrusted event data reaches a dangerous sink (a database query, an OS command, a dynamic eval, a downstream API call) without validation. The trick is delivering the payload through a non-HTTP trigger. For an S3-triggered function that builds a query from the object key, you write a malicious key and let the object-created event carry it in:

$ aws s3api put-object --bucket uploads-prod \
    --key "orders'; DROP TABLE orders;--.jpg" --body ./benign.txt
{"ETag": "\"9b2cf...\""}

# Function's CloudWatch log, triggered by the upload:
INFO  processing key: orders'; DROP TABLE orders;--.jpg
ERROR near "orders": syntax error                     <- the key reached the SQL sink unvalidated

That error line is the proof: the object key flowed straight into a query. Because non-HTTP triggers feel internal, validation is often skipped entirely, so test every event source, not just the API. The underlying injection logic carries over from our SSRF testing guide and standard injection testing.

Serverless Testing Methodology
1
Map functions and triggers
Inventory every function and its event sources from serverless.yml, SAM, or Terraform.
2
Test event injection
Send malicious data through every trigger (HTTP, queues, storage events, email), not just the API.
3
Model execution roles
Enumerate each function's IAM role or managed identity and compute its blast radius.
4
Scan dependencies and secrets
Run SCA on the deployment package and hunt secrets in environment variables.

In serverless, the role is the blast radius

Over-privileged execution roles are the highest-impact serverless finding because a compromised function inherits whatever its role can do. The moment you get code execution through an event injection or a vulnerable dependency, you operate with the function's IAM permissions. If that role carries wildcard actions or broad data access, a single function bug becomes account-wide compromise. The fix is one role per function, scoped to exactly what it needs. During testing, read each function's role then model its reach:

$ aws lambda get-function-configuration --function-name order-processor --query 'Role' --output text
arn:aws:iam::111122223333:role/order-processor-role
$ aws iam list-attached-role-policies --role-name order-processor-role \
    --query 'AttachedPolicies[].PolicyName' --output text
AmazonS3FullAccess  SecretsManagerReadWrite           <- way too broad for a thumbnail job
$ pmapper query "who can do secretsmanager:GetSecretValue with *"
order-processor-role can do secretsmanager:GetSecretValue with *

Those two attached managed policies are the whole problem: a thumbnail function should never read every secret in the account. In Azure and GCP, check the managed identity or service-account bindings the same way. Functions also expose their environment variables to any code that runs in them, so any secret stored there is readable post-compromise. The IAM escalation paths in our AWS penetration testing guide apply directly to these roles.

Strobes insight
In serverless, the severity of a code-execution bug equals the permissions of the function's role. One function, one tightly scoped role is the single most effective control you can ship; it turns a critical into a contained incident.

How do dependencies and secrets create risk?

Third-party dependencies are a larger risk in serverless than in traditional apps because each function ships with its full dependency tree and runs with the function's permissions. A vulnerable npm or PyPI package pulled into a function can give code execution that immediately holds the function's IAM role. Scan the actual deployment package, not just the repo, since build steps introduce drift:

$ aws lambda get-function --function-name order-processor --query 'Code.Location' --output text
https://prod-lambda.s3.amazonaws.com/...zip
$ unzip -o code.zip -d pkg && pip-audit -r pkg/requirements.txt
Name    Version  ID                  Fix Versions
------- -------- ------------------- ------------
Pillow  9.0.0    GHSA-8vj2-vxx3-667w 9.0.1        <- known RCE via crafted image, on the upload path

That Pillow line is exploitable precisely because the function processes uploaded images. Secrets are the second issue. Once you have code execution inside a Lambda, environment variables and the runtime API hand you the role credentials directly, the same primitive a VM SSRF would reach:

$ env | grep AWS_
AWS_ACCESS_KEY_ID=ASIA...                              <- the execution role's temporary creds
AWS_SECRET_ACCESS_KEY=...
AWS_SESSION_TOKEN=...
AWS_LAMBDA_RUNTIME_API=127.0.0.1:9001

Export those and you are the function's role from your own machine. Prefer a secrets manager (AWS Secrets Manager, Azure Key Vault, GCP Secret Manager) with the function granted least-privilege read access at runtime, and never put long-lived secrets in environment variables.

Serverless event sources and their injection risk
TriggerAttacker-controlled dataCommon skipped validation
API Gateway (HTTP)Body, query, headers, pathSometimes validated; the obvious one
S3 object-createdObject key, metadata, contentKey treated as trusted, flows to sinks
SQS / SNS messageMessage body and attributesAssumed internal, parsed without checks
DynamoDB streamChanged item fieldsTrusted as already-stored data
SES inbound emailSubject, body, headers, attachmentsRarely sanitized before processing

What does a real serverless engagement turn up, and how do you fix it?

On a recent assessment of a retailer's image pipeline, the critical I reported started in a thumbnail function triggered by S3 uploads. The image library had a known command-injection bug, the function role held s3:GetObject on every bucket plus secretsmanager:GetSecretValue *, and one uploaded file gave code execution that read the production database secret. No posture tool flagged it because every individual setting looked normal. The findings table below is that report excerpt.

Every fix is config. Scope the role to one function's actual needs, validate every event source including non-HTTP triggers, patch the dependency, and move the secret out of reach. The role JSON below is what a thumbnail function should actually carry, instead of two wildcard managed policies:

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": ["s3:GetObject", "s3:PutObject"],
    "Resource": "arn:aws:s3:::uploads-prod/thumbnails/*"
  }]
}

A practical edge case that catches teams out: cold-start reuse. Lambda keeps an execution environment warm between invocations, so secrets or tokens written to /tmp or process memory by one request can be read by a later one if the function does not clean up. Test for state that survives across invocations, because it turns a one-shot injection into persistent access for the life of the warm container. Posture scanners miss this entire class because the danger lives in code paths, event chains, and runtime state, not static config. A scanner flags a role with s3:* but cannot tell whether an injection reaches a sink, whether a vulnerable dependency is on an executed path, or whether a non-HTTP trigger is validated. So validate the chains by hand, anchor the methodology to the OWASP Serverless Top 10, use pmapper to model role blast radius, run SCA on the deployment package, and use Prowler or ScoutSuite for misconfigured functions and overly permissive resource policies. Because serverless apps deploy constantly and each deploy can widen a role, this is a natural fit for continuous, agentic pentesting rather than a yearly pass. Fold the config-level findings into your cloud security posture checklist.

Sample Findings (Report Excerpt)
FindingSeverity (CVSS)EvidenceRemediation
Vulnerable image library (RCE)Critical (9.8)pip-audit flagged Pillow 9.0.0 on the upload pathPatch to 9.0.1+; pin and scan in CI
Execution role grants secretsmanager:*Critical (9.1)RCE read the production DB secret via the roleScope role to one bucket prefix only
Event injection via S3 object keyHigh (8.2)Malicious key reached a SQL sink in logsValidate and parameterize event data
Secrets in environment variablesHigh (7.5)env | grep AWS_ and DB_ exposed credsMove secrets to a vault; least-priv read
No per-function role separationMedium (6.4)Five functions shared one wildcard roleOne scoped role per function

Frequently asked questions

What is serverless penetration testing?
It is security testing of functions-as-a-service applications like AWS Lambda, Azure Functions, and Google Cloud Functions, focused on function code, event sources, IAM execution roles, and dependencies rather than servers or networks. The provider owns the runtime, so the testable surface is almost entirely application and configuration.
What is event injection in serverless?
Event injection is when untrusted data from any event source (HTTP, message queues, storage events, emails, IoT messages) reaches a dangerous sink without validation. Because non-HTTP triggers feel internal, developers often skip validation on them, making event injection broader than classic web injection. You should test every trigger, not just the API.
Why are over-privileged Lambda roles dangerous?
A compromised function inherits its IAM execution role, so when an attacker gets code execution through an injection or vulnerable dependency, they immediately hold that role's permissions. An over-scoped role with wildcard actions turns a single function bug into account-wide compromise. One tightly scoped role per function contains the damage to that function's narrow purpose.
How do dependencies create risk in serverless?
Each function ships with its full dependency tree and runs with the function's permissions, so a vulnerable npm or PyPI package can give code execution that immediately holds the function's IAM role. Run software composition analysis against the actual deployment package rather than the repo, since build steps can introduce dependencies the repo does not show.
Does the metadata SSRF attack apply to serverless?
It changes shape. Lambda does not use the 169.254.169.254 metadata endpoint; instead the execution role's temporary credentials are injected into environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN). Any code execution inside the function can read them, so the blast radius is still bounded by the role, which is why scoping roles tightly matters.
What framework guides serverless penetration testing?
The OWASP Serverless Top 10 reframes common application risks for the functions-as-a-service model, covering event injection, broken authentication, insecure deployment configuration, over-privileged roles, and dependency risk. It pairs well with standard application and API testing methodology since much of the surface overlaps with web and API work.

Sources and references

  • OWASP Serverless Top 10
  • AWS Lambda Execution Role
  • AWS Lambda Security Best Practices
  • pip-audit
  • pmapper
A
Akhil Reni
Co-founder and CTO, Strobes
Akhil Reni is co-founder and CTO of Strobes, building AI-driven penetration testing and exposure management for security teams.
Tags
Cloud PentestingServerlessApplication Security

Stop chasing vulnerabilities Start reducing exposure

See how Strobes AI agents validate and fix your most critical exposures automatically.

Book a Demo
Continue Reading

Related Posts

Vulnerability validation: why most of your scanner backlog is noise - Strobes
Exposure ValidationApplication Security

Vulnerability Validation: Why Most of Your Scanner Backlog Is Noise

Vulnerability validation proves which scanner findings are real, reachable, and exploitable. Why manual triage fails and how agentic validation scales.

Jun 9, 202619 min
How to pentest single-page applications - React, Angular and Vue SPA security testing guide
Penetration TestingApplication Security

How to Pentest Single-Page Applications (React, Angular, Vue)

Learn how to pentest React, Angular, and Vue SPAs. Covers DOM XSS, client-side routing bypass, JS bundle secrets, and why traditional DAST scanners fail.

Jun 4, 202623 min
Bug bounty vs pentesting vs AI pentesting comparison featured image
Penetration TestingApplication Security

Bug Bounty vs. Pentesting vs. AI Pentesting: Which Model Fits Your AppSec Program?

Bug bounty vs pentesting vs AI pentesting: compare costs, coverage, compliance, and when to use each model. Build a layered AppSec testing strategy.

Jun 4, 202621 min