SlideShare a Scribd company logo
The Fault in Our Stars
Attack Vectors for APIs Using Amazon API Gateway Lambda
Authorizers
arn:aws:iam:sa-east-1:*:user/AlexandreSieira
● Co-Founder @ Tenchi Security
● Cloud Security Posture Chiropractor (h/t
@swagitda_)
● São Paulo, Brazil 🇧🇷
sts:GetCallerIdentity
asieira@tenchisecurity.com
@AlexandreSieira
arn:aws:iam:sa-east-1:*:user/LeonardoViveiros
● DevSecOps Specialist @ Tenchi Security
● Recovering serverful on-premises software
developer
● Limeira, Brazil 🇧🇷
lviveiros@tenchisecurity.com
@LeonardoViveiro
Motivation
Why should you care?
https://twitter.com/CloudTrekAU/status/936300151005626368/photo/1
Expectation Reality
https://twitter.com/swyx/status/1423025792783568899/photo/1
API Gateway Overview
Pronounced “ah-pee gateway” by AWS teams (h/t @quinnypig)
API Gateway Overview
Main Concepts
● APIs are uniquely identified by IDs
● API stages are logical reference to a lifecycle
state like 'dev', 'prod', 'beta', 'v2’, and are
identified by API ID and stage name.
● Many ways to implement auth:
○ Amazon Cognito
○ Native OpenID Connect / OAuth 2.0
○ IAM
○ Lambda authorizers
Amazon Cognito
AWS’ Own CIAM Offering has a History
● Andrés Riancho from Wildlife Studios published amazing
research on this in 2019: https://andresriancho.com/internet-
scale-analysis-of-aws-cognito-security/
● Cognito reference architecture relies on providing client-side
code with AWS credentials for authenticated and
unauthenticated users.
● The research identified 2,500 identity pools, which were used
to gain access to the following non-public resources using only
unauthenticated user privileges:
○ 13,000 S3 buckets
○ 1,200 DynamoDB tables
○ 1,500 Lambda functions
@AndresRiancho
API Gateway Overview
Lambda Authorizers Overview
API Gateway Overview
Lambda Authorizers Return Value
API Gateway Overview
Lambda Authorizers Policy Document
● IAM policy in PAERC format – more familiar to ops and
security than to devs.
● Case sensitive resource matching.
● Stars (‘*’) expand greedily inside each ARN
component.
● Lack of regular expression matching severely limits
representation (i.e. path parameters, multiple
methods).
API Gateway Execute-API
arn:aws:execute-api:sa-east-1:account-id:api-id/prod/*/dashboard/*
API Gateway Execute-API
arn:aws:execute-api:sa-east-1:account-id:api-id/prod/*/dashboard/*
api-id/prod/POST/admin/store/order/creditcard/dashboard/
api-id/prod/POST/admin/dashboard/createAdminUser/
API Gateway Documentation
If it’s documented it’s a feature, not a bug
Documentation examples written as if “*” stopped
expanding at “/”, which is not the case.
https://docs.aws.amazon.com/apigateway/latest/d
eveloperguide/api-gateway-control-access-using-
iam-policies-to-invoke-api.html
API Gateway Documentation
If it’s documented it’s a feature, not a bug
API Gateway Documentation
If it’s documented it’s a feature, not a bug
https://github.com/awslabs/aws-apigateway-lambda-authorizer-blueprints/
API Gateway Console
If it’s documented it’s a feature, not a bug
Lambda Console
If it’s documented it’s a feature, not a bug
Actual Examples
This project on Github does exactly what someone
would do after reading the AWS documentation.
And these policies
are for guest users...
Someone with this policy can call:
● GET /problems/submissions
● GET /problems/foo/bar/submissions
● GET /problems/foo/submissions
● POST /problems/submit
● POST /problems/foo/submit
● POST /problems/foo/bar/submit
● ...
Works on My Machine!
Serverless Offline Deployed to AWS
https://github.com/dherault/serverless-offline/issues/1259
Responsible Disclosure
Playing by the rules
● Initially reported issues to AWS on April 26th,
2021.
● Published at
https://www.tenchisecurity.com/blog/thefaultinours
tars on June 21st, 20201.
● AWS was incredibly responsive and professional
about the entire thing.
● Special thanks to Mark Ryland and the API
Gateway team for their support throughout this
process.
● They updated documentation and lambda
authorizer code, but notably not the AWS
console output.
IAM Policy Injection
Good design choices by AWS
● Lambda authorizers use external input to build
the policy document.
● Can we perform an injection attack (i.e. a new
statement with Allow for ”*”)?
● Lambda authorizers must return a structured
language object (Javascript object, Python
dict, etc) by design, so they are not routinely
built as strings.
● This avenue of attack doesn’t seem practical
for the vast majority of APIs.
FOILED
IAM Policy Injection
What if we provide “*” or “a*” as the external data?
https://aws.amazon.com/blogs/compute/int
roducing-custom-authorizers-in-amazon-
api-gateway/
Recommendations
First for AWS – you hold to key to improving this service!
● Create IAM policy conditions for API
gateway.
● Change placeholders in AWS Console to
ANYTHING other than “*”.
● Find a way to allow regular expression
matching at a minimum for resource
paths, so path parameters can be safely
handled.
● Let some senior security folks into those
fabled 2-🍕 teams!
This could be us, AWS, but u playin’
Recommendations
For AWS customers
● Stars should ideally only be used as "/*" at the very end of the
ARN (i.e.: "arn:aws:execute-api:us-west-
1:12345678:myApiId/test/GET/foo/bar/*").
● Use Deny statements to limit the impact or scope of star
expansions when possible.
● Check again that the user is authorized to call an endpoint in its
implementation. Don’t trust the lambda authorizer alone with
authorization decisions.
● Make sure any code imported from the previous version of the
lambda authorizer blueprints is updated to the latest version.
● If you use URL path parameters in your APIs, avoid cases
where valid values can be chosen by potential attackers. Prefer
backend-generated IDs.
Questions?
asieira@tenchisecurity.com
@AlexandreSieira
lviveiros@tenchisecurity.com
@LeonardoViveiro
https://www.reddit.com/r/ProgrammerHumor/comments/d37bzc/what_comes_after_
serverless/
Demo code available at:
https://github.com/tenchi-security/the-fault-in-our-stars

More Related Content

What's hot

Amazon GuardDuty Lab
Amazon GuardDuty LabAmazon GuardDuty Lab
Amazon GuardDuty Lab
Amazon Web Services
 
Intro to Threat Detection & Remediation on AWS: AWS Security Week at the SF Loft
Intro to Threat Detection & Remediation on AWS: AWS Security Week at the SF LoftIntro to Threat Detection & Remediation on AWS: AWS Security Week at the SF Loft
Intro to Threat Detection & Remediation on AWS: AWS Security Week at the SF Loft
Amazon Web Services
 
AWS re:Inforce 2019 - Threat Hunting in CloudTrail & GuardDuty
AWS re:Inforce 2019 - Threat Hunting in CloudTrail & GuardDutyAWS re:Inforce 2019 - Threat Hunting in CloudTrail & GuardDuty
AWS re:Inforce 2019 - Threat Hunting in CloudTrail & GuardDuty
Chris Farris
 
ThreatResponse
ThreatResponseThreatResponse
ThreatResponse
Amazon Web Services
 
AWS re:Inforce 2019 Builders session: Simplify and secure your network archit...
AWS re:Inforce 2019 Builders session: Simplify and secure your network archit...AWS re:Inforce 2019 Builders session: Simplify and secure your network archit...
AWS re:Inforce 2019 Builders session: Simplify and secure your network archit...
Bhavin Desai, CCIE Security
 
An Active Case Study on Insider Threat Detection in your Applications
An Active Case Study on Insider Threat Detection in your ApplicationsAn Active Case Study on Insider Threat Detection in your Applications
An Active Case Study on Insider Threat Detection in your Applications
Amazon Web Services
 
AWS Security Best Practices
AWS Security Best PracticesAWS Security Best Practices
AWS Security Best Practices
Aleksandr Maklakov
 
Serverless Authentication and Authorisation
Serverless Authentication and AuthorisationServerless Authentication and Authorisation
Serverless Authentication and Authorisation
Amazon Web Services
 
Why your next serverless project should use AWS AppSync
Why your next serverless project should use AWS AppSyncWhy your next serverless project should use AWS AppSync
Why your next serverless project should use AWS AppSync
Yan Cui
 
Incident Response in the Cloud - SID319 - re:Invent 2017
Incident Response in the Cloud - SID319 - re:Invent 2017Incident Response in the Cloud - SID319 - re:Invent 2017
Incident Response in the Cloud - SID319 - re:Invent 2017
Amazon Web Services
 
Forge: Under the Hood
Forge: Under the HoodForge: Under the Hood
Forge: Under the Hood
Atlassian
 
Deep dive - AWS security by design
Deep dive - AWS security by designDeep dive - AWS security by design
Deep dive - AWS security by design
Richard Harvey
 
Automating Incident Response and Forensics in AWS
Automating Incident Response and Forensics in AWSAutomating Incident Response and Forensics in AWS
Automating Incident Response and Forensics in AWS
Amazon Web Services
 
Automating Threat Detection and Remediation at ZocDoc
Automating Threat Detection and Remediation at ZocDocAutomating Threat Detection and Remediation at ZocDoc
Automating Threat Detection and Remediation at ZocDoc
Amazon Web Services
 
Incident Response on AWS - A Practical Look.pdf
Incident Response on AWS - A Practical Look.pdfIncident Response on AWS - A Practical Look.pdf
Incident Response on AWS - A Practical Look.pdf
Amazon Web Services
 
AWS Secrets Manager: Best Practices for Managing, Retrieving, and Rotating Se...
AWS Secrets Manager: Best Practices for Managing, Retrieving, and Rotating Se...AWS Secrets Manager: Best Practices for Managing, Retrieving, and Rotating Se...
AWS Secrets Manager: Best Practices for Managing, Retrieving, and Rotating Se...
Amazon Web Services
 
RESTful API を Chalice で紐解く 〜 Python Serverless Microframework for AWS 〜
RESTful API を Chalice で紐解く 〜 Python Serverless Microframework for AWS 〜RESTful API を Chalice で紐解く 〜 Python Serverless Microframework for AWS 〜
RESTful API を Chalice で紐解く 〜 Python Serverless Microframework for AWS 〜
崇之 清水
 
A Self-Defending Border: Protect Your Web-Facing Workloads with AWS Security ...
A Self-Defending Border: Protect Your Web-Facing Workloads with AWS Security ...A Self-Defending Border: Protect Your Web-Facing Workloads with AWS Security ...
A Self-Defending Border: Protect Your Web-Facing Workloads with AWS Security ...
Amazon Web Services
 
AWS Account Security Checklist
AWS Account Security ChecklistAWS Account Security Checklist
AWS Account Security Checklist
Ninad Gupte
 
Incident Response - Finding a Needle in a Stack of Needles
Incident Response - Finding a Needle in a Stack of NeedlesIncident Response - Finding a Needle in a Stack of Needles
Incident Response - Finding a Needle in a Stack of Needles
Amazon Web Services
 

What's hot (20)

Amazon GuardDuty Lab
Amazon GuardDuty LabAmazon GuardDuty Lab
Amazon GuardDuty Lab
 
Intro to Threat Detection & Remediation on AWS: AWS Security Week at the SF Loft
Intro to Threat Detection & Remediation on AWS: AWS Security Week at the SF LoftIntro to Threat Detection & Remediation on AWS: AWS Security Week at the SF Loft
Intro to Threat Detection & Remediation on AWS: AWS Security Week at the SF Loft
 
AWS re:Inforce 2019 - Threat Hunting in CloudTrail & GuardDuty
AWS re:Inforce 2019 - Threat Hunting in CloudTrail & GuardDutyAWS re:Inforce 2019 - Threat Hunting in CloudTrail & GuardDuty
AWS re:Inforce 2019 - Threat Hunting in CloudTrail & GuardDuty
 
ThreatResponse
ThreatResponseThreatResponse
ThreatResponse
 
AWS re:Inforce 2019 Builders session: Simplify and secure your network archit...
AWS re:Inforce 2019 Builders session: Simplify and secure your network archit...AWS re:Inforce 2019 Builders session: Simplify and secure your network archit...
AWS re:Inforce 2019 Builders session: Simplify and secure your network archit...
 
An Active Case Study on Insider Threat Detection in your Applications
An Active Case Study on Insider Threat Detection in your ApplicationsAn Active Case Study on Insider Threat Detection in your Applications
An Active Case Study on Insider Threat Detection in your Applications
 
AWS Security Best Practices
AWS Security Best PracticesAWS Security Best Practices
AWS Security Best Practices
 
Serverless Authentication and Authorisation
Serverless Authentication and AuthorisationServerless Authentication and Authorisation
Serverless Authentication and Authorisation
 
Why your next serverless project should use AWS AppSync
Why your next serverless project should use AWS AppSyncWhy your next serverless project should use AWS AppSync
Why your next serverless project should use AWS AppSync
 
Incident Response in the Cloud - SID319 - re:Invent 2017
Incident Response in the Cloud - SID319 - re:Invent 2017Incident Response in the Cloud - SID319 - re:Invent 2017
Incident Response in the Cloud - SID319 - re:Invent 2017
 
Forge: Under the Hood
Forge: Under the HoodForge: Under the Hood
Forge: Under the Hood
 
Deep dive - AWS security by design
Deep dive - AWS security by designDeep dive - AWS security by design
Deep dive - AWS security by design
 
Automating Incident Response and Forensics in AWS
Automating Incident Response and Forensics in AWSAutomating Incident Response and Forensics in AWS
Automating Incident Response and Forensics in AWS
 
Automating Threat Detection and Remediation at ZocDoc
Automating Threat Detection and Remediation at ZocDocAutomating Threat Detection and Remediation at ZocDoc
Automating Threat Detection and Remediation at ZocDoc
 
Incident Response on AWS - A Practical Look.pdf
Incident Response on AWS - A Practical Look.pdfIncident Response on AWS - A Practical Look.pdf
Incident Response on AWS - A Practical Look.pdf
 
AWS Secrets Manager: Best Practices for Managing, Retrieving, and Rotating Se...
AWS Secrets Manager: Best Practices for Managing, Retrieving, and Rotating Se...AWS Secrets Manager: Best Practices for Managing, Retrieving, and Rotating Se...
AWS Secrets Manager: Best Practices for Managing, Retrieving, and Rotating Se...
 
RESTful API を Chalice で紐解く 〜 Python Serverless Microframework for AWS 〜
RESTful API を Chalice で紐解く 〜 Python Serverless Microframework for AWS 〜RESTful API を Chalice で紐解く 〜 Python Serverless Microframework for AWS 〜
RESTful API を Chalice で紐解く 〜 Python Serverless Microframework for AWS 〜
 
A Self-Defending Border: Protect Your Web-Facing Workloads with AWS Security ...
A Self-Defending Border: Protect Your Web-Facing Workloads with AWS Security ...A Self-Defending Border: Protect Your Web-Facing Workloads with AWS Security ...
A Self-Defending Border: Protect Your Web-Facing Workloads with AWS Security ...
 
AWS Account Security Checklist
AWS Account Security ChecklistAWS Account Security Checklist
AWS Account Security Checklist
 
Incident Response - Finding a Needle in a Stack of Needles
Incident Response - Finding a Needle in a Stack of NeedlesIncident Response - Finding a Needle in a Stack of Needles
Incident Response - Finding a Needle in a Stack of Needles
 

Similar to The Fault in Our Stars - Attack Vectors for APIs Using Amazon API Gateway Lambda Authorizers

AWS Serverless API Management - Meetup
AWS Serverless API Management - MeetupAWS Serverless API Management - Meetup
AWS Serverless API Management - Meetup
Samuel Vandecasteele
 
Unlocking Agility with the AWS Serverless Application Model (SAM) - AWS Summi...
Unlocking Agility with the AWS Serverless Application Model (SAM) - AWS Summi...Unlocking Agility with the AWS Serverless Application Model (SAM) - AWS Summi...
Unlocking Agility with the AWS Serverless Application Model (SAM) - AWS Summi...
Amazon Web Services
 
Serverless APIs and you
Serverless APIs and youServerless APIs and you
Serverless APIs and you
James Beswick
 
Building CICD Pipelines for Serverless Applications
Building CICD Pipelines for Serverless ApplicationsBuilding CICD Pipelines for Serverless Applications
Building CICD Pipelines for Serverless Applications
Amazon Web Services
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep Dive
Amazon Web Services
 
Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...
Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...
Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...
Amazon Web Services
 
Experiences in Architecting & Implementing Platforms using Serverless.pdf
Experiences in Architecting & Implementing Platforms using Serverless.pdfExperiences in Architecting & Implementing Platforms using Serverless.pdf
Experiences in Architecting & Implementing Platforms using Serverless.pdf
Srushith Repakula
 
Getting Started with AWS Lambda & Serverless Computing
Getting Started with AWS Lambda & Serverless ComputingGetting Started with AWS Lambda & Serverless Computing
Getting Started with AWS Lambda & Serverless Computing
Amazon Web Services
 
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
Amazon Web Services
 
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
Amazon Web Services
 
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
Chris Munns
 
Devops on serverless
Devops on serverlessDevops on serverless
Devops on serverless
Sébastien ☁ Stormacq
 
AWS Serverless Development
AWS Serverless DevelopmentAWS Serverless Development
AWS Serverless Development
Amazon Web Services
 
How to Build a Backend for an Alexa Smart Home Skill - ALX316 - re:Invent 2017
How to Build a Backend for an Alexa Smart Home Skill - ALX316 - re:Invent 2017How to Build a Backend for an Alexa Smart Home Skill - ALX316 - re:Invent 2017
How to Build a Backend for an Alexa Smart Home Skill - ALX316 - re:Invent 2017
Amazon Web Services
 
Serverless Applications with AWS SAM
Serverless Applications with AWS SAMServerless Applications with AWS SAM
Serverless Applications with AWS SAM
Chris Munns
 
Developing and Implementing APIs at Scale, the Servless Way - Ed Lima - AWS T...
Developing and Implementing APIs at Scale, the Servless Way - Ed Lima - AWS T...Developing and Implementing APIs at Scale, the Servless Way - Ed Lima - AWS T...
Developing and Implementing APIs at Scale, the Servless Way - Ed Lima - AWS T...
Amazon Web Services
 
SMC305 Building CI/CD Pipelines for Serverless Applications
SMC305 Building CI/CD Pipelines for Serverless ApplicationsSMC305 Building CI/CD Pipelines for Serverless Applications
SMC305 Building CI/CD Pipelines for Serverless Applications
Amazon Web Services
 
Building API Driven Microservices
Building API Driven MicroservicesBuilding API Driven Microservices
Building API Driven Microservices
Chris Munns
 
Beyond Infrastructure for SAP on AWS (GPSTEC322) - AWS re:Invent 2018
Beyond Infrastructure for SAP on AWS (GPSTEC322) - AWS re:Invent 2018Beyond Infrastructure for SAP on AWS (GPSTEC322) - AWS re:Invent 2018
Beyond Infrastructure for SAP on AWS (GPSTEC322) - AWS re:Invent 2018
Amazon Web Services
 
Application Server-less Web Applications - Serverless Toronto Meetup
Application Server-less Web Applications - Serverless Toronto Meetup Application Server-less Web Applications - Serverless Toronto Meetup
Application Server-less Web Applications - Serverless Toronto Meetup
Daniel Zivkovic
 

Similar to The Fault in Our Stars - Attack Vectors for APIs Using Amazon API Gateway Lambda Authorizers (20)

AWS Serverless API Management - Meetup
AWS Serverless API Management - MeetupAWS Serverless API Management - Meetup
AWS Serverless API Management - Meetup
 
Unlocking Agility with the AWS Serverless Application Model (SAM) - AWS Summi...
Unlocking Agility with the AWS Serverless Application Model (SAM) - AWS Summi...Unlocking Agility with the AWS Serverless Application Model (SAM) - AWS Summi...
Unlocking Agility with the AWS Serverless Application Model (SAM) - AWS Summi...
 
Serverless APIs and you
Serverless APIs and youServerless APIs and you
Serverless APIs and you
 
Building CICD Pipelines for Serverless Applications
Building CICD Pipelines for Serverless ApplicationsBuilding CICD Pipelines for Serverless Applications
Building CICD Pipelines for Serverless Applications
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep Dive
 
Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...
Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...
Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...
 
Experiences in Architecting & Implementing Platforms using Serverless.pdf
Experiences in Architecting & Implementing Platforms using Serverless.pdfExperiences in Architecting & Implementing Platforms using Serverless.pdf
Experiences in Architecting & Implementing Platforms using Serverless.pdf
 
Getting Started with AWS Lambda & Serverless Computing
Getting Started with AWS Lambda & Serverless ComputingGetting Started with AWS Lambda & Serverless Computing
Getting Started with AWS Lambda & Serverless Computing
 
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
 
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
 
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
 
Devops on serverless
Devops on serverlessDevops on serverless
Devops on serverless
 
AWS Serverless Development
AWS Serverless DevelopmentAWS Serverless Development
AWS Serverless Development
 
How to Build a Backend for an Alexa Smart Home Skill - ALX316 - re:Invent 2017
How to Build a Backend for an Alexa Smart Home Skill - ALX316 - re:Invent 2017How to Build a Backend for an Alexa Smart Home Skill - ALX316 - re:Invent 2017
How to Build a Backend for an Alexa Smart Home Skill - ALX316 - re:Invent 2017
 
Serverless Applications with AWS SAM
Serverless Applications with AWS SAMServerless Applications with AWS SAM
Serverless Applications with AWS SAM
 
Developing and Implementing APIs at Scale, the Servless Way - Ed Lima - AWS T...
Developing and Implementing APIs at Scale, the Servless Way - Ed Lima - AWS T...Developing and Implementing APIs at Scale, the Servless Way - Ed Lima - AWS T...
Developing and Implementing APIs at Scale, the Servless Way - Ed Lima - AWS T...
 
SMC305 Building CI/CD Pipelines for Serverless Applications
SMC305 Building CI/CD Pipelines for Serverless ApplicationsSMC305 Building CI/CD Pipelines for Serverless Applications
SMC305 Building CI/CD Pipelines for Serverless Applications
 
Building API Driven Microservices
Building API Driven MicroservicesBuilding API Driven Microservices
Building API Driven Microservices
 
Beyond Infrastructure for SAP on AWS (GPSTEC322) - AWS re:Invent 2018
Beyond Infrastructure for SAP on AWS (GPSTEC322) - AWS re:Invent 2018Beyond Infrastructure for SAP on AWS (GPSTEC322) - AWS re:Invent 2018
Beyond Infrastructure for SAP on AWS (GPSTEC322) - AWS re:Invent 2018
 
Application Server-less Web Applications - Serverless Toronto Meetup
Application Server-less Web Applications - Serverless Toronto Meetup Application Server-less Web Applications - Serverless Toronto Meetup
Application Server-less Web Applications - Serverless Toronto Meetup
 

More from Tenchi Security

us-east-1 Shuffle_ Lateral Movement and other Creative Steps Attackers Take i...
us-east-1 Shuffle_ Lateral Movement and other Creative Steps Attackers Take i...us-east-1 Shuffle_ Lateral Movement and other Creative Steps Attackers Take i...
us-east-1 Shuffle_ Lateral Movement and other Creative Steps Attackers Take i...
Tenchi Security
 
Shopping for Vulnerabilities - How Cloud Service Provider Marketplaces can He...
Shopping for Vulnerabilities - How Cloud Service Provider Marketplaces can He...Shopping for Vulnerabilities - How Cloud Service Provider Marketplaces can He...
Shopping for Vulnerabilities - How Cloud Service Provider Marketplaces can He...
Tenchi Security
 
Detecting AWS control plane abuse in an actionable way using Det{R}ails
Detecting AWS control plane abuse in an actionable way using Det{R}ailsDetecting AWS control plane abuse in an actionable way using Det{R}ails
Detecting AWS control plane abuse in an actionable way using Det{R}ails
Tenchi Security
 
Aprendizados da Gestão de Riscos e Conformidade Regulatória de sua Organizaçã...
Aprendizados da Gestão de Riscos e Conformidade Regulatória de sua Organizaçã...Aprendizados da Gestão de Riscos e Conformidade Regulatória de sua Organizaçã...
Aprendizados da Gestão de Riscos e Conformidade Regulatória de sua Organizaçã...
Tenchi Security
 
Mapeando problemas de privilégios no AWS IAM (Identity & Access Management)
Mapeando problemas de privilégios no AWS IAM (Identity & Access Management)Mapeando problemas de privilégios no AWS IAM (Identity & Access Management)
Mapeando problemas de privilégios no AWS IAM (Identity & Access Management)
Tenchi Security
 
Novos Paradigmas de Segurança com adoção de Nuvem (AWS)
Novos Paradigmas  de Segurança com adoção  de Nuvem (AWS)Novos Paradigmas  de Segurança com adoção  de Nuvem (AWS)
Novos Paradigmas de Segurança com adoção de Nuvem (AWS)
Tenchi Security
 
Palestra Medindo seu nível de Visibilidade e Detecção usando ATT&CK e DeTT&CT
Palestra Medindo seu nível de Visibilidade e Detecção usando ATT&CK e DeTT&CTPalestra Medindo seu nível de Visibilidade e Detecção usando ATT&CK e DeTT&CT
Palestra Medindo seu nível de Visibilidade e Detecção usando ATT&CK e DeTT&CT
Tenchi Security
 
Introdução à Segurança de Containers e Kubernetes
Introdução à Segurança de Containers e KubernetesIntrodução à Segurança de Containers e Kubernetes
Introdução à Segurança de Containers e Kubernetes
Tenchi Security
 
Webinar Segurança de DevOps
Webinar Segurança de DevOpsWebinar Segurança de DevOps
Webinar Segurança de DevOps
Tenchi Security
 
Latinoware 2019 - Securing Clouds Wide Open
Latinoware 2019 - Securing Clouds  Wide OpenLatinoware 2019 - Securing Clouds  Wide Open
Latinoware 2019 - Securing Clouds Wide Open
Tenchi Security
 

More from Tenchi Security (10)

us-east-1 Shuffle_ Lateral Movement and other Creative Steps Attackers Take i...
us-east-1 Shuffle_ Lateral Movement and other Creative Steps Attackers Take i...us-east-1 Shuffle_ Lateral Movement and other Creative Steps Attackers Take i...
us-east-1 Shuffle_ Lateral Movement and other Creative Steps Attackers Take i...
 
Shopping for Vulnerabilities - How Cloud Service Provider Marketplaces can He...
Shopping for Vulnerabilities - How Cloud Service Provider Marketplaces can He...Shopping for Vulnerabilities - How Cloud Service Provider Marketplaces can He...
Shopping for Vulnerabilities - How Cloud Service Provider Marketplaces can He...
 
Detecting AWS control plane abuse in an actionable way using Det{R}ails
Detecting AWS control plane abuse in an actionable way using Det{R}ailsDetecting AWS control plane abuse in an actionable way using Det{R}ails
Detecting AWS control plane abuse in an actionable way using Det{R}ails
 
Aprendizados da Gestão de Riscos e Conformidade Regulatória de sua Organizaçã...
Aprendizados da Gestão de Riscos e Conformidade Regulatória de sua Organizaçã...Aprendizados da Gestão de Riscos e Conformidade Regulatória de sua Organizaçã...
Aprendizados da Gestão de Riscos e Conformidade Regulatória de sua Organizaçã...
 
Mapeando problemas de privilégios no AWS IAM (Identity & Access Management)
Mapeando problemas de privilégios no AWS IAM (Identity & Access Management)Mapeando problemas de privilégios no AWS IAM (Identity & Access Management)
Mapeando problemas de privilégios no AWS IAM (Identity & Access Management)
 
Novos Paradigmas de Segurança com adoção de Nuvem (AWS)
Novos Paradigmas  de Segurança com adoção  de Nuvem (AWS)Novos Paradigmas  de Segurança com adoção  de Nuvem (AWS)
Novos Paradigmas de Segurança com adoção de Nuvem (AWS)
 
Palestra Medindo seu nível de Visibilidade e Detecção usando ATT&CK e DeTT&CT
Palestra Medindo seu nível de Visibilidade e Detecção usando ATT&CK e DeTT&CTPalestra Medindo seu nível de Visibilidade e Detecção usando ATT&CK e DeTT&CT
Palestra Medindo seu nível de Visibilidade e Detecção usando ATT&CK e DeTT&CT
 
Introdução à Segurança de Containers e Kubernetes
Introdução à Segurança de Containers e KubernetesIntrodução à Segurança de Containers e Kubernetes
Introdução à Segurança de Containers e Kubernetes
 
Webinar Segurança de DevOps
Webinar Segurança de DevOpsWebinar Segurança de DevOps
Webinar Segurança de DevOps
 
Latinoware 2019 - Securing Clouds Wide Open
Latinoware 2019 - Securing Clouds  Wide OpenLatinoware 2019 - Securing Clouds  Wide Open
Latinoware 2019 - Securing Clouds Wide Open
 

Recently uploaded

Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 

Recently uploaded (20)

Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 

The Fault in Our Stars - Attack Vectors for APIs Using Amazon API Gateway Lambda Authorizers

  • 1. The Fault in Our Stars Attack Vectors for APIs Using Amazon API Gateway Lambda Authorizers
  • 2. arn:aws:iam:sa-east-1:*:user/AlexandreSieira ● Co-Founder @ Tenchi Security ● Cloud Security Posture Chiropractor (h/t @swagitda_) ● São Paulo, Brazil 🇧🇷 sts:GetCallerIdentity asieira@tenchisecurity.com @AlexandreSieira arn:aws:iam:sa-east-1:*:user/LeonardoViveiros ● DevSecOps Specialist @ Tenchi Security ● Recovering serverful on-premises software developer ● Limeira, Brazil 🇧🇷 lviveiros@tenchisecurity.com @LeonardoViveiro
  • 3. Motivation Why should you care? https://twitter.com/CloudTrekAU/status/936300151005626368/photo/1 Expectation Reality https://twitter.com/swyx/status/1423025792783568899/photo/1
  • 4. API Gateway Overview Pronounced “ah-pee gateway” by AWS teams (h/t @quinnypig)
  • 5. API Gateway Overview Main Concepts ● APIs are uniquely identified by IDs ● API stages are logical reference to a lifecycle state like 'dev', 'prod', 'beta', 'v2’, and are identified by API ID and stage name. ● Many ways to implement auth: ○ Amazon Cognito ○ Native OpenID Connect / OAuth 2.0 ○ IAM ○ Lambda authorizers
  • 6. Amazon Cognito AWS’ Own CIAM Offering has a History ● Andrés Riancho from Wildlife Studios published amazing research on this in 2019: https://andresriancho.com/internet- scale-analysis-of-aws-cognito-security/ ● Cognito reference architecture relies on providing client-side code with AWS credentials for authenticated and unauthenticated users. ● The research identified 2,500 identity pools, which were used to gain access to the following non-public resources using only unauthenticated user privileges: ○ 13,000 S3 buckets ○ 1,200 DynamoDB tables ○ 1,500 Lambda functions @AndresRiancho
  • 7. API Gateway Overview Lambda Authorizers Overview
  • 8. API Gateway Overview Lambda Authorizers Return Value
  • 9. API Gateway Overview Lambda Authorizers Policy Document ● IAM policy in PAERC format – more familiar to ops and security than to devs. ● Case sensitive resource matching. ● Stars (‘*’) expand greedily inside each ARN component. ● Lack of regular expression matching severely limits representation (i.e. path parameters, multiple methods).
  • 12.
  • 13. API Gateway Documentation If it’s documented it’s a feature, not a bug Documentation examples written as if “*” stopped expanding at “/”, which is not the case. https://docs.aws.amazon.com/apigateway/latest/d eveloperguide/api-gateway-control-access-using- iam-policies-to-invoke-api.html
  • 14. API Gateway Documentation If it’s documented it’s a feature, not a bug
  • 15. API Gateway Documentation If it’s documented it’s a feature, not a bug https://github.com/awslabs/aws-apigateway-lambda-authorizer-blueprints/
  • 16. API Gateway Console If it’s documented it’s a feature, not a bug
  • 17. Lambda Console If it’s documented it’s a feature, not a bug
  • 18. Actual Examples This project on Github does exactly what someone would do after reading the AWS documentation. And these policies are for guest users... Someone with this policy can call: ● GET /problems/submissions ● GET /problems/foo/bar/submissions ● GET /problems/foo/submissions ● POST /problems/submit ● POST /problems/foo/submit ● POST /problems/foo/bar/submit ● ...
  • 19. Works on My Machine! Serverless Offline Deployed to AWS https://github.com/dherault/serverless-offline/issues/1259
  • 20. Responsible Disclosure Playing by the rules ● Initially reported issues to AWS on April 26th, 2021. ● Published at https://www.tenchisecurity.com/blog/thefaultinours tars on June 21st, 20201. ● AWS was incredibly responsive and professional about the entire thing. ● Special thanks to Mark Ryland and the API Gateway team for their support throughout this process. ● They updated documentation and lambda authorizer code, but notably not the AWS console output.
  • 21. IAM Policy Injection Good design choices by AWS ● Lambda authorizers use external input to build the policy document. ● Can we perform an injection attack (i.e. a new statement with Allow for ”*”)? ● Lambda authorizers must return a structured language object (Javascript object, Python dict, etc) by design, so they are not routinely built as strings. ● This avenue of attack doesn’t seem practical for the vast majority of APIs. FOILED
  • 22. IAM Policy Injection What if we provide “*” or “a*” as the external data? https://aws.amazon.com/blogs/compute/int roducing-custom-authorizers-in-amazon- api-gateway/
  • 23. Recommendations First for AWS – you hold to key to improving this service! ● Create IAM policy conditions for API gateway. ● Change placeholders in AWS Console to ANYTHING other than “*”. ● Find a way to allow regular expression matching at a minimum for resource paths, so path parameters can be safely handled. ● Let some senior security folks into those fabled 2-🍕 teams! This could be us, AWS, but u playin’
  • 24. Recommendations For AWS customers ● Stars should ideally only be used as "/*" at the very end of the ARN (i.e.: "arn:aws:execute-api:us-west- 1:12345678:myApiId/test/GET/foo/bar/*"). ● Use Deny statements to limit the impact or scope of star expansions when possible. ● Check again that the user is authorized to call an endpoint in its implementation. Don’t trust the lambda authorizer alone with authorization decisions. ● Make sure any code imported from the previous version of the lambda authorizer blueprints is updated to the latest version. ● If you use URL path parameters in your APIs, avoid cases where valid values can be chosen by potential attackers. Prefer backend-generated IDs.