AWS - Security Specialty
AWS - Security Specialty
These are all the notes that I took after reading the entire
exam guide for the AWS Ceritifed Security - Specialty exam
(ISBN-13: 978-1789534474). It is recommended that you
install Obsidian and download the zip file instead, as this will
allow you to quickly and easily navigate through these notes.
Table of Contents
AWS Questions
Misc
Groups
groups are associated with set of permissions allowing
members of that group to inherit those permissions
groups don't have credentials associated with it
object within IAM
Roles
associated set of permissions that allows access to AWS
resources
not associated with users or groups
sort of works like discord roles
Examples of roles:
Service Roles
User Roles
Policy Structure:
1. Version
shows version of policy language
2. Statement
acts as group for parameters in json structure
3. Sid
statement identification
4. Effect
can be either allow or deny
allows or denies access to resource
5. Action
list of actions to be allowed or denied access to
action is first defined by service and then
preceded with action
6. Resource
provides Amazon Resource Name (ARN)
tells which resource the permissions apply to
7. Condition
optional
dictates under what conditions policy is in effect
Policy Types:
Identity-based Policies
attached to IAM user, group, or role
controls what actions an identity (users, groups of
users, roles) can perform on which resources and
under what conditions
e.g. allowing user John to run the EC2
RunInstances action
can be AWS-managed, customer-managed or in-line
policies
AWS-managed
policies that are created and managed by AWS
Customer-managed
custom policy that is made by the customer
In-line
added directly to user, group, or role
deleted when the identity is deleted
Resource-based Policies
very similar to in-line policies except they are attached
to resources instead of identities
can be attached to buckets and S3 objects
lets you specify who has access to resource and what
actions they can perform on it
policy looks the same as in the example policy,
however includes a Principal parameter
identifies user, role, account, or federated user
that permissions should be applied to
Permissions boundaries
governs maximum permissions an identity-based
policy can associate with any user or role
Organization SCPs
SCP stands for Service Control Policy
used by AWS organizations to manage multiple AWS
accounts
similar to permissions boundaries within identity
objects
they also set maximum permission level that can
be given to members of an AWS account or
organization unit (OU)
restrict permissions for resource-based and
identity-based policies
restricts permissions, doesn't grant permissions
Policy evaluation
Determination of permissions when accessing resource:
1. Authentication
2. Determine context of request
request processed and associated permissions are
defined
actions, resources, principals, environment data, and
resource data are examined
3. Policy evaluation
policy types evaluated in order of identity-based,
resource-based, IAM permissions boundaries, and
SCPs
4. Permission Result
access granted or denied
Social Federation
Amazon Cognito
made for enabling secure authentication and access
control for new and existing users accessing web or
mobile applications
generate tokens after authentication that manages
access
best practice when creating applications that require
social IdPs for authentication
1. User Pools
scalable user directories
allow users to login to mobile application
2. Identity Pools
assigns permissions to user to access AWS resources
(uses temporary credentials
Shared Responsibility Model
AWS Contents
AWS Questions > Shared Responsibility Model
1. Infrastructure
most common model
covers infrastructure as a Service (IaaS) services such
as Elastic Compute Cloud (EC2)
Subnets
can only reside in a single availability zone (e.g. only in
eu-west-1bAZ)
10.0.3.0/24
etc.
note the first address is reserved for the network
address, and the last address is reserved for the
broadcast address
AWS reserves the first three host addresses in any
subnet
first host address reserved for internal AWS VPC
routing
second host address for AWS DNS
third host address for future use
therefore, 251 (out of 256) available host addresses
for customer use in /16 subnet
Security Groups
similar to NACLs (provide virtual firewall) except operates
at instance level rather than network level
associated with instances rather than subnets
controls traffic to and from instances within VPC
stateful
no field for Allow or Deny traffic, as all rules in security
group are assumed to be allowed (traffic not categorized
as such is dropped)
works as a whitelist for traffic
all rules evaluated before decision is made
Bastion Hosts
used to gain access to instances that reside within private
subnets
bastion host resides within public subnet
hardened EC2 instance with restrictive controls
acts as ingress gateway
DDoS Patterns
SYN Floods
abuses three-way handshake when connection is being
established between client and server
the final ACK completes the handshake, but this is
dropped in SYN Flood attack to leave connection open
HTTP Floods
many GET or POST requests sent to server
AWS Shield
specify ARN of resources and services Shield should
protect
Elastic IP Address (EIP) should be specified first for EC2
instance in order to use Shield on it
Rate-Based Rules
counts number of requests received from IP address over
5 minutes
can define max number of request from singe IP within 5
minutes (must be over 2000)
AWS WAF
Three primary elements:
Types of ELBs
Three different ELBs:
Application Load Balancer
Securing APIs
AWS API gateway
IAM Tags
Lambda Authorizers
1. Directive Controls
establishes governance, risk, and compliance models
2. Preventative Controls
protects workloads and mitigates threats and
vulnerabilities
3. Detective Controls
provides full visibility and transparency over operation
of deployments
4. Responsive Controls
drives the remediation of potential deviation from
security baselines
Forensics
recommended to have an account with preconfigured
settings dedicated to forensics
compromised instances can be moved to forensics
account
note that the instance cannot be moved to different
AWS account
can also create forensic instance for forensic analysis
could take snapshot of compromised instance / EBS
volume and attach it to forensic instance
Common Infrastructure Security
Incident
Common approach in a breach scenario (blue side):
AWS VPN
Uses two components:
Routing
Route table example:
Destination Target
10.0.0.0/16 Local
172.16.0.0/16 pcx-1234abcd
172.16.1.0/24 vgw-wxyz6789
Virtual Interfaces
connection can be partitioned into virtual interfaces
allows access to other AWS services other than what is
within your VPC
Key Pairs
used to allow connection to instance
uses public key cryptography (2048 bit SSH-2 RSA)
public key maintained by EC2 instance, private key is with
customer
keys are unrecoverable if lost
public key encrypts creds, private key decrypts
Amazon CloudWatch
most common AWS monitoring service
monitors resource performance over time
can be used with unified Cloud Agent to collect logs of
applications
Isolation
security group should be created so that a compromised
instance can quickly be changed to this group
the group should not be able to communicate with any
other resources
log data should be stored in dedicated S3 bucket
create IAM roles that only allow read-only access to
resources
prevents accidentally changing data on instance
Actions
Automation
Run Command
Distributor
distributes software across instances
State Manager
Patch Manager
AWS Artifact
on-demand portal allowing viewing and downloading AWS
security and compliance reports and online agreements
these reports are undetaken by external auditors of
AWS
agreements for accounts made with AWS
AWS Config
useful for seeing history of modifications to a resource via
looking at the history of configuration items
Configuration items
Configuration streams
Configuration history
Configuration snapshots
Configuration recorder
Config rules
Resource relationships
Config role
Amazon S3 Logging
most common AWS storage service
logs can be sent to S3 or Amazon CloudWatch Logs
Object-Level Logging
must be associated with CloudTrail which will record write
and read API activity
Flow Logs
captures IP traffic across network interfaces
default log file format:
CloudTrail
Trails: contain configurable options for what to monitor and
track
Events: every API call is stored as an event
Log Files: created every 5 minutes; stored within S3 bucket
CloudWatch Logs: logs can be sent to CloudWatch for
analysis and monitoring
API Activity Filters: provide search and filter functionality
when looking at API activity
"awsRegion": "eu-west-1",
"eventID": "6ce47c89-5908-452d-87cc-a7c251ac4ac0",
"eventName": "PutObject",
"eventSource": "s3.amazonaws.com",
"eventTime": "2019-11-27T23:54:21Z",
"eventType": "AwsApiCall",
"eventVersion": "1.05",
"readOnly": false,
"recipientAccountId": "730739171055",
"requestID": "95BAC3B3C83CCC5D",
"requestParameters": {
"bucketName": "cloudtrailpackt",
"Host": "cloudtrailpackt.s3.eu-west-
1.amazonaws.com",
"key": "Packt/AWSLogs/730739171055/CloudTrail/eu-
west-
1/2019/11/27/730739171055_CloudTrail_eu-west-
1_20191127T2321Z_oDOj4tmndoN0pCW3.json.gz",
"x-amz-acl": "bucket-owner-full-control",
"x-amz-server-side-encryption": "AES256"
"sharedEventID": "11d4461b-0604-46c4-b4c9-
6a23b3e7f57c",
"sourceIPAddress": "cloudtrail.amazonaws.com",
"userAgent": "cloudtrail.amazonaws.com",
"userIdentity": {
"invokedBy": "cloudtrail.amazonaws.com",
"type": "AWSService"
Amazon Athena
serverless service
analyzes data stored within Amazon S3 (such as
CloudTrail logs)
uses SQL
CloudWatch
main AWS monitoring service
collects data and metrics from all supported AWS
services
can be implemented in a large scale using AWS Systems
Manager (SSM)
Automation
AWS Contents
AWS Questions > Automation
AWS Lambda
Amazon GuardDuty
can be used for automation detection and remediation
powered by machine learning
can capture events from CloudTrail logs, DNS logs, and
VPC flow flogs
events referenced against threat detection feeds
(compared against known sources of malicious
activity)
runs on AWS infrastructure so doesn't affect performance
of your infrastructure
Pentesting AWS
can't carry pentest against some services without prior
approval from AWS
services you can pentest against:
Amazon EC2 instances, NAT gateways, and elastic
load balancers
Amazon RDS
Amazon CloudFront
Amazon Aurora
Amazon API Gateways
AWS Lambda and Lambda Edge functions
Amazon Lightsail resources
Amazon Elastic Beanstalk environments
services not to be pentested:
- DNS zone walking via Amazon Route 53 hosted zones
- Denial of Service (DoS), Distributed Denial of Service
(DDoS),
- simulated DoS, simulated DDoS
- Port flooding
- Protocol flooding
- Request flooding (login request flooding and API request
flooding)# Managing Data Security
AWS Contents
AWS Questions > Managing Data Security
Amazon EBS
used for file-level storage
support in-transit and at-rest encryption
uses KMS service to encrypt data
Amazon S3
provides object-level storage
SSE-S3
Encryption
1. Client selects object(s) to upload to S3 and indicates
SSE-S3 as encryption algorithm
2. S3 encrypts object with plaintext data key and encrypted
object stored in chosen S3 bucket
3. plaintext data key encrypted with S3 master key, and the
encrypted key is then stored into S3 and associated with
encrypted data object
4. Plaintext data key removed from memory
Decryption
1. User request encrypted object
2. Encrypted data key of object is decrypted with S34
master key
3. Plaintext data key decrypts encrypted data object
4. S3 returns plaintext data object to client
SSE-KMS
Encryption
Decryption
Managing Key Infrastructure > SSE-KMS Decryption
SSE-C
Encryption
Decryption
CSE-KMS
Encryption
Decryption
1. User requests access to encrypted S3 object.
2. Encrypted object sent to client with associated cipher
blob key.
3. Cipher blob sent back to KMS to generate data key.
4. KMS uses original CMK along with cipher blob to generate
a plaintext version of data key.
5. Plaintext data key sent back to requesting Java client.
6. Java client uses plaintext key to decrypt object.
CSE-C
Encryption
1. Java client create plaintext data key to encrypt object
data.
2. CMK created by customer encrypts plaintext data key.
3. Encrypted data key and encrypted object sent from client
to S3 storage.
4. S3 associates encrypted data key with encrypted object
and stores both in S3.
Decryption
1. Uses requests access to encrypted object.
2. S3 sends requested object data with associated
encrypted data key.
3. Customer CMK used with encrypted data key to generate
plaintext version of data key.
4. Encrypted object decrypted using plaintext data key.
Amazon RDS
database service
encryption at rest uses AES-256
can only encrypt RDS database during its creation
SSL/TLS used for in-transit encryption
Amazon DynamoDB
fully managed key-value and document NoSQL database
at-rest server-side encryption enabled by default
this setting cannot be disabled
1. AWS-owned
rotation period varied from service to service
managed and created by AWS
e.g. Amazon S3 encryption using S3 master key (SSE-
S3)
can't view keys
2. AWS-managed
can't control rotation frequency
can view keys being used and track their usage and
key policies
3. Customer-managed
full control of keys
SSE-KMS Encryption
SSE-KMS Decryption
Key Policies
cannot control access to CMKs without key policies
access to CMK can be configured via:
1. Key Policies: All access governed by key policy
2. Key Policies and IAM: Access governed by key policy
and IAM identity-based policies
allows access via groups and other IAM features
3. Key Policies and Grants: Access governed by key
policy with ability to delete access to other for using
the CMK
check page 508-512, great explanation
AWS CloudHSM
fully managed service used for data encryption
can integrate with KMS in the form of using CloudHSM as
a custom key store
allows storage of CMKs outside of KMS and into
CloudHSM cluster
HSM stands for Hardware Security Module
generates keys and stores them
can use different encryption algorithms for both
symmetric keys and asymmetric keys
manages symmetric and asymmetric keys
signs and verifies signatures
can use hash function to compute hash-based
message authentication codes (HMACs)
1. Precrypto Office
2. Crypto Office
3. Crypto User
4. Appliance User
Operations PRECO CO CU AU
Operations PRECO CO CU AU
Obtain basic cluster information
(number of HSMs in cluster, IP No Yes Yes Yes
address, serial number, etc.)
Zeroize HSMs (delete keys,
certificates, and data on the No Yes Yes Yes
HSM)
Change own password Yes Yes Yes Yes
Change any user's password No Yes No No
Add and remove users No Yes No No
Get synchronization status No Yes Yes Yes
Key management operations No No Yes No
Encrypt, decrypt, sign, verify,
No No Yes No
generate, and digest HMACs
Permissions:
Permissions:
AWS Questions
AWS Contents
Misc
Access Policies
Access Policies
collapse:
**Resource-based**
collapse:
**Principal**
collapse:
**Trusted account**
collapse:
**False**
collapse:
**Amazon Cognito**
collapse:
**SAML Federation and Social Federation**
4. What is IdP short for in relation to federated access?
collapse:
**Identity provider**
collapse:
**True**
collapse:
**Infrastructure model**
collapse:
**Infrastructure**
collapse:
**Container**
collapse:
**True**
collapse:
**False**
collapse:
**False** (Used to be true). It now uses SSM to
remove the need for installing an agent.
collapse:
**AWS**
4. Which service is used to track and record API calls made
within your AWS account?
collapse:
**AWS CloudTrail**
collapse:
**Systems Manager (SSM)**
collapse:
**Virtual Private Cloud**
collapse:
**NAT Gateway**
collapse:
**True**
collapse:
**False**
Implementing Application Security
Implementing Application Security
collapse:
**True**
collapse:
**AWS Firewall Manager**
collapse:
**AWS Config**
collapse:
**Network Load Balancer**
DDoS Protection
DDoS Protection
collapse:
**SYN Flood**
collapse:
**2**
collapse:
**True**
collapse:
**False**
Incident Response
Incident Response
collapse:
**Cloud Adoption Framework (CAF)**
collapse:
**Amazon GuardDuty**
collapse:
**AWS Security Hub**
collapse:
**Customer Gateway**
collapse:
**False**
collapse:
**True**
collapse:
**False**
2. Amazon S3 object-level logging closely integrates with
which other AWS service?
collapse:
**AWS CloudTrail**
collapse:
**VPC Flow Logs**
collapse:
**True**
collapse:
**Amazon Athena**
Auditing and Governance
Auditing and Governance
collapse:
**AWS Artifact**
collapse:
**Logfile Validation**
collapse:
**AWS Managed Rules**
4. Which service is backed by machine learning and
provides an automatic way of detecting, protecting, and
classifying data within your S3 buckets?
collapse:
**Amazon Macie**
collapse:
**True**
collapse:
**VPC Flow Logs**
collapse:
**AWS Security Hub**
collapse:
**False**
Discovering Security Best Practices
Discovering Security Best Practices
1. True or false: You should enable access keys for your root
account that would enable programmatic access to your
AWS account.
collapse:
**False**
collapse:
**AWS Trusted Advisor**
collapse:
**Fault Tolerance**
4. Which support plans only give access to seven core
Trusted Advisor checks?
collapse:
**Basic and Developer**
collapse:
**True**
collapse:
**Customer Master Key (CMK)**
collapse:
**AWS-managed**
collapse:
**Key policy**
5. Which AWS service offers the ability to maintain a level of
security protection for any API keys, in addition to other
secrets?
collapse:
**AWS Secrets Manager**
collapse:
**Input/Output Operations Per Second**
collapse:
**Amazon Elastic Block Store (EBS)**
collapse:
**True**
collapse:
**AWS Key Management Service (KMS)**
Misc
AWS Contents
AWS Questions
Notes
AWS Artifact is a resource about compliance-related stuff
AWS Config is a service that enables you to assess, audit,
and evaluate the configurations of your AWS resources
Amazon CloudFront is a web service that is used for
distributing content
delivers web content through network via edge
locations (locations that are closest to the client
requesting website), therefore gives client lowest
latency
CloudTrail logs can provide detailed API tracking for
Amazon S3 bucket-level and object-level operations
VPC Flow logging logs IP data going to and from
designated network interfaces and stores this data in
Amazon CloudWatch
Amazon Athena is a serverless, interactive query service
to query data and analyze big data in Amazon S3
VPC peering - networking connection between two VPCs
that enables traffic to be routed between them
allows instances within those VPCs to communicate
with each other as if they were in the same network
Amazon S3 Glacier is a secure, durable, and extremely
low-cost Amazon S3 storage class for data archiving and
long-term backup
AWS Control Tower enforces and manages governance
rules for security, operations, and compliance at scale
ACLs were the first authorization mechanism in S3.
Bucket policies are the newer method, and the method
used for almost all AWS services. Policies can implement
very complex rules and permissions, ACLs are simplistic
(they have ALLOW but no DENY).
A majority of modern use cases in Amazon S3 no
longer require the use of ACLs, and we recommend
that you disable ACLs except in unusual
circumstances where you need to control access for
each object individually
Questions
What is the difference between Internet Gateway (IGW) and
NAT Gateway (NGW)?
Mock Exam 1
questions I got wrong or was unsure about
rate-based
4. Following a breach on your network, an instance was
compromised and you need to perform a forensic
investigation of the affected instance. You decide to move
the EC2 instance to your forensic account. Which steps
would you take to carry out this process?
Key policy
AssumeRoleWithSAML
Metadata document
12. Your CTO has asked you to find a simple and secure way
to perform administrative tasks and configurational
changes remotely against a selection of EC2 instances
within your production environment. Which option should
you choose?
16. Your CTO has explained that they are looking for a
solution to be able to monitor network packets across
your VPC. You suggest VPC flow logs, but the CTO wants
to implement a solution whereby captured traffic is sent
to a Network Load Balancer, using UDP as a listener,
which sits in front of a fleet of appliances dedicated to
network analysis. What solution would you suggest to the
CTO?
AWS CloudTrail
SSE-KMS
33. As part of your security procedures, you need to ensure
that, when using the Elastic File System (EFS), you enable
encryption-in-transit using TLS as a mount option, which
uses a client tunnel process. Assuming your filesystem is
fs-12345678 and your filesystem's identifier is /mnt/efs,
which command would you enter to mount the EFS file
stems with encryption enabled?
37. Which part of AWS CloudHSM can carry out the following
functions?
57. You have been asked to upload the company's own key
material instead of using the key material generated by
KMS. In preparation for doing this, you download the
public key and import token. What format must your key
material be in prior to it being uploaded?
Binary
Monitoring
aws/s3
61. Which keys used in conjunction with KMS are used
outside of the KMS platform to perform encryption
against your data?