D1 COMMSEC - API Security in the Age of Microservices - Ali Abdollahi
D1 COMMSEC - API Security in the Age of Microservices - Ali Abdollahi
2. API/microservice-related incidents
6. Recap
2
#Whoami
3
Overview of microservices architecture components
4
Overview of microservices architecture components
API gateways
• Centralized API entry point
• Manages routing and load balancing
• Enforces security policies
• Monitors API activity
• Simplifies API management
5
Overview of microservices architecture components
Service Mesh
6
Overview of microservices architecture components
Container orchestrators
7
Security incidents ‘Real-world examples’
8
Real-world examples
Uber data breach (2016) T-Mobile data breach (2018)
Vector: Vector:
Github repo Shopify (2020) T-Mobile's customer support
staff API
AWS API keys
Typeform (2018) Facebook Data Leak (2019)
S3 bucket
Panera Bread Data Leak (2018)
9
API vulnerabilities/attacks
# OWASP API Top 10 Example of API Attack/Vulnerability
API2
Broken User Authentication Credential stuffing, session hijacking
API3
Excessive Data Exposure Exposing sensitive user data, leaking API keys
API9
Improper Assets Management Exposing sensitive endpoints, outdated documentation
10
Microservices Security Challenges
11
Microservices Security Challenges
12
Microservices Security Challenges
13
Microservices Security Challenges
14
Weak authentication and authorization policies
Ø Poorly implemented authentication and authorization
mechanisms, which may allow unauthorized users to access or
manipulate API resources.
Ø Scenario:
An attacker exploits weak authentication by brute-forcing
credentials or exploiting a known vulnerability in the
authentication mechanism, gaining unauthorized access to
sensitive data or administrative privileges.
15
Improper rate limiting and IP filtering
Ø Insufficient or missing rate limiting and IP filtering measures,
which can leave the API susceptible to abuse and denial-of-service
(DoS) attacks.
Ø Scenario:
An attacker initiates a distributed denial of service attack by
sending a large number of queries to the API, crushing the server
and causing the service to be degraded or unavailable to
legitimate users.
16
Insufficient CORS management
Ø Incorrect configuration of Cross-Origin Resource Sharing (CORS)
policies, potentially allowing unauthorized domains to access or
interact with the API.
Ø Scenario:
An attacker crafts a malicious website that sends requests to the
API servers from an unauthorized domain. Due to misconfigured
CORS, the attacker can access sensitive data from the API server or
perform unauthorized actions on behalf of users who visit the
malicious website.
17
Microservices Security Challenges
18
Misconfigured security policies
Ø Incorrectly configured or missing security policies in the
service mesh, such as exposing internal APIs to the public
internet as a result of insecure traffic routing rules or
incorrectly configured ingress rules, make services vulnerable
to attacks.
Ø Scenario:
An attacker exploits the misconfigured ingress rule in a service mesh to send
malicious requests or access sensitive data from an exposed service.
19
Weak data encryption in transit
Ø Insufficient or missing encryption of data transmitted between
services in the service mesh, such as using outdated
encryption algorithms or failing to implement mTLS, can lead
to data leakage or interception.
Ø Scenario:
An attacker infiltrates the service mesh network and
intercepts unencrypted communication between services,
exploiting an outdated, vulnerable encryption algorithm (e.g.,
small key size RSA). This allows data access or manipulation,
risking breaches or service disruptions.
20
Securing APIs in Microservices (Best Practices)
21
Implement strong authentication and authorization
22
Implement strong authentication and authorization
OAuth 2.0
23
Implement strong authentication and authorization
JWT
24
Implement strong authentication and authorization
25
Service-to-service authentication and encryption
26
Service-to-service authentication and encryption
More examples:
• Utilize Istio for secure service communication. e.g. Istio, Linkerd
• Data encryption with modern algorithms
• Use VPN/IPSec for secure service connections.
27 https://istio.io/
https://linkerd.io/
Anomaly detection
• Spike detection
• Monitoring failed login attempts
• Geolocation analysis
• Monitoring unusual IP addresses
• Request payload analysis
28
Network Segmentation
29
Recap
Secure Secure
IAM
Design Comm.
30 https://www.hashicorp.com/products/vault
https://www.openpolicyagent.org/
Do not forget…
ü Security monitoring
ü Security frameworks e.g. OWASP API Security Top 10, NIST SP 800-204, etc.
31 https://csrc.nist.gov/publications/detail/sp/800-204/final
https://owasp.org/www-project-api-security/
32 Thank you!