Comprehensive re:Cap security practice on AWS
Tags: security, awssecurity, aws, cloudsecurity
Published: 2024-01-24 15:04:05

[What is the Security Hub & AWS Partner solution?](#what-is-the-security-hub-amp-aws-partner-solution)
[What is Amazon Inspector?](#what-is-amazon-inspector)
[How to apply delegated Administration on AWS?](#how-to-apply-delegated-administration-on-aws)
[GuardDuty Account Architecture](#guardduty-account-architecture)
[Overflow of enabled GuardDuty](#overflow-of-enabled-guardduty)
[Policy-as-Code](#policyascode)
[Best Practices Against Ransomware](#best-practices-against-ransomware)
[Why is Infrastructure as Code (IaC) Needed?](#why-is-infrastructure-as-code-iac-needed)
[How to set up limited access on AWS?](#how-to-set-up-limited-access-on-aws)
[How to collect, store, and protect logs?](#how-to-collect-store-and-protect-logs)
[Monitor, detect, and react](#monitor-detect-and-react)
[IDS & IPS](#ids-amp-ips)
[Server-side Request Forgery (SSRF)](#serverside-request-forgery-ssrf)
[Cross-Site Scripting (XSS)](#crosssite-scripting-xss)
[What is a Whaling attack?](#what-is-a-whaling-attack)
[Cloud Security Posture Management (CSPM)](#cloud-security-posture-management-cspm)
[Reference](#reference)



<br/>&nbsp;<br/>&nbsp;

## What is the Security Hub & AWS Partner solution?

&nbsp;
#### Security Hub

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5bd5qzy3amn84yt3ossy.png)

- A centralized hub for your security alerts and compliance status across your AWS accounts.
- Collects security findings from multiple AWS services like GuardDuty, Inspector, and Macie.
- Also collects findings from AWS partner solutions.

&nbsp;
#### Benefits of Security Hub

- Pulls together security findings from AWS and third-party sources.
- Allows you to apply industry and government standards/controls.
- Automates alerts and remediations.
- Enables you to set up and manage rules yourself.
- Automatically centralizes data during an investigation.
- Provides visualization through dashboards and investigation timelines.

&nbsp;
#### Foundational Technical Review (FTR) 
is an examination conducted by AWS to assess the performance of a solution offered by an AWS Partner.

To become an AWS Partner, the following requirements must be met:

- Submission of an automatically generated security report.
- Completion of a self-assessment form.

There are various AWS Partner Network (APN) programs available, including:

- AWS Competency Program.
- AWS Service Ready Program.



<br/>&nbsp; <br/>&nbsp; 

## What is Amazon Inspector?

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f0hvbjcww7eftt0hawj0.png)

- It is an automated and continuous vulnerability management tool.
- It focuses on identifying software vulnerabilities and unintended network exposures.
- Amazon Inspector automates security scans and assessments for software vulnerabilities.
- It can be enabled at the AWS Organization level for multi-account management.
- It provides automated discovery and continuous scanning capabilities.
- It can work in conjunction with Patch Manager in AWS Systems Manager.
- It supports the deployment of new instances with patches in immutable environments.



<br/>&nbsp; <br/>&nbsp; 

## How to apply delegated Administration on AWS?

&nbsp;
#### 1 Landing Zone


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zravao8vzorrr5z3cv9f.png)



- Establish a well-architected, multi-account AWS environment.
- It serves as a starting point for implementing identity and access management, data security, network design, and logging.
- Allows for the quick and secure launch of applications.
- Account Factory utilize templated account vending by environment.
- Isolate resources and workloads into multiple AWS accounts.

<u>Benefits:</u>

- Reduces the scope of impact.
- Examples include data isolation, limit allocation, and billing.

<u>Security controls:</u>

- Implement preventative measures such as Service Control Policies (SCPs).
- Employ detective controls like AWS Config for continuous monitoring.
- Utilize proactive measures like CloudFormation hooks.

<u>Real-world example:</u>

- Different applications may have varying security profiles, such as Payment Card Industry (PCI) compliance for payment systems.

&nbsp;
#### 2 AWS Control Tower


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cqv1ctc8r1yod2zp1u4v.png)

<u>Multi-account:</u>

- It enables the governance of a secure multi-account AWS environment.
- It incorporates multi-account best practices and centralizes identity and access management.
- It provides prescriptive blueprints that simplify multi-account compliance governance.
- Cross-account security audits can be conducted using AWS Identity and Access Management (IAM) and AWS IAM Identity Center.
- The Account Factory feature facilitates the provisioning of new accounts.

<u>Compliance:</u>

- AWS Control Tower offers AWS-provided guardrails and compliance policies.
- It establishes pre-configured governance rules for security.

<u>Centralization:</u>

- It provides a central dashboard for monitoring and compliance status.
- AWS Control Tower centralizes logging from AWS CloudTrail and AWS Config.

<u>Automation:</u>

- It automates account provisioning with consistent baseline configuration.
- It automates the creation of a well-architected AWS multi-account framework.
- It automates new account provisioning within the organization.


&nbsp;
#### 3 Guardrails

Guardrails are pre-configured and prescriptive governance rules.
They are designed to enforce and detect compliance in a multi-account environment.

<u>To utilize guardrails:</u>

- Associate a guardrail with the Organizational Unit (OU).
- Detect any violations of the guardrail.
- Take measures to mitigate the identified issues.
- Analyze the configuration to ensure compliance.
- Maintain a compliance history for reference.

&nbsp;
#### 4 Protective Guardrails


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f1p2a4nrgle9ffqu3i0y.png)

<u>Least privilege access: </u>
Service - IAM roles and policies.

<u>Root users and IAM users with administrative privileges:</u>
Service - MFA.

<u>Monitor environments for security and remediation actions:</u>
Service - AWS Config.

<u>Prevent unwanted actions, restrict access:</u>
Service - AWS Organizations and control policies (SCPs).

<u>Restrict network traffic:</u>
Service - VPC security groups, network ACLs.

<u>Centrally log and monitor activity to detect anomalies:</u>
Services - AWS CloudTrail, CloudWatch, GuardDuty.

<u>Allowlist approved IP addresses/ranges:</u>
Services - AWS WAF, S3 bucket policies.

<u>Protect data at rest:</u>
Services - KMS and EBS encryption for S3, EBS, and snapshots.

<u>Control access to APIs:</u>
Service - Lambda authorizer functions with API Gateway.


&nbsp;
#### 5 Detective Guardrails

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rvkd3jsdw8rjj92747ed.png)

- Detecting issues and providing alerts/insights to facilitate remediation.
- Preventing non-compliant actions from occurring in the first place.
- Enforcing policies to ensure alignment with compliance standards and governance.
- Implementing preventative measures using service control policies and IAM permissions boundaries.
- Detecting policy violations and compliance issues, and generating alerts for them.

<u>Services:</u>

- These guardrails are implemented using AWS Config Rules and AWS Lambda functions.
- The relevant services for these guardrails include AWS Config, AWS Security Hub, Amazon GuardDuty, AWS Trusted Advisor, and Amazon Inspector.

&nbsp;
#### 6 Examples of Control Tower Guardrails

- Disallow the creation of access keys for the root user.
- Disallow internet connection through Remote Desktop Protocol (RDP).
- Disallow public write access to S3 buckets.
- Disallow Amazon Elastic Block Store (Amazon EBS) volumes.

&nbsp;
#### 7 Amazon GuardDuty:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uyjhwqtamuyoznka7ipj.png)

- Utilizes machine learning and intelligence for threat detection.
- Continuously monitors for malicious or unauthorized activity across AWS accounts.
- Provides effective monitoring capabilities.
- Monitors AWS Control Tower managed environments using GuardDuty.
- Monitors workload for malicious activity and unauthorized behavior.
- Utilizes machine learning and integrated threat intelligence to identify abnormal behavior and suspected attackers.
- Utilizes AWS CloudTrail, Amazon Virtual Private Cloud (VPC) Flow logs, and Domain Name System (DNS) logs.

&nbsp;
#### 8 GuardDuty Delegated Administrator:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1z40fqq7pafx4nvpjzdq.png)

- Enabled in an AWS organization.
- The organization's management account acts as the GuardDuty "delegated administrator" account.
- Manages multiple GuardDuty accounts in an AWS Organization.
- Includes existing AWS Control Tower accounts as GuardDuty members of the GuardDuty administrator in the same region.

&nbsp;
#### 9 AWS Service Catalog:

- Account Factory Customization (AFC) is a feature of AWS Control Tower.

&nbsp;
#### 10 AWS Config


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nkkkp4jfzg15rkriizen.png)



- AWS Config continuously monitors and records the configurations of AWS resources.
- It captures configuration details, including relationships between resources.
- It assesses how configuration changes impact resources and checks for compliance.
- AWS Config allows auditing of resource configurations to detect drift from desired configurations.
- It records configuration history, enabling the checking of past configurations of resources.

&nbsp;
#### 11 AWS Config Rule

- AWS Config rules specify how AWS resources should be configured.
- They evaluate configurations and check for any compliance or drift issues.
- When a non-compliant resource is detected, AWS Config sends notifications.
- AWS Config rules automate the monitoring of resource configurations and compliance.

<u>Example:</u>
S3 bucket policy can have the "Block Public Access" setting applied at the account level or bucket level.




<br/>&nbsp; <br/>&nbsp; 

## GuardDuty Account Architecture

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tw6wc5t6jhpnel9djgas.png)

&nbsp;
#### Master account:

- Utilizes Service Control Policies (SCPs) and AWS Single Sign-On (SSO).
- The delegated GuardDuty administrator account serves as the AWS Control Tower audit account.

&nbsp;
#### Log archive account:

- Uses S3 to store CloudTrail and AWS Config logs.

&nbsp;
#### Audit account:

- Receives security and compliance notifications from Amazon CloudWatch Events, AWS CloudTrail, and AWS Config.
- Control Tower utilizes Amazon Simple Notification Service (SNS) to send alerts via email.
- Contains findings from all member accounts in all Regions.


<br/>&nbsp; <br/>&nbsp; 

## Overflow of enabled GuardDuty


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ic03jlf54drj6lfbyb68.png)

<u>Step 1:</u>
All AWS accounts in the AWS Control Tower environment are added as members of the GuardDuty administrator account, with GuardDuty enabled automatically in each member account.

<u>Step 2:</u>
The auto-enable setting is turned on in the GuardDuty administrator account to automate the addition of new AWS Control Tower accounts as members.

<u>Step 3:</u>
A S3 bucket is created in the AWS Control Tower log archive account.
A customer-managed KMS key is established in the GuardDuty management account in the same Region.
Member accounts encrypt their data using this KMS key before sending it to the S3 bucket.



<br/>&nbsp; <br/>&nbsp; 

## Policy-as-Code

Guardrails, also known as Policy-as-Code, can be implemented using tools such as AWS CloudFormation Guard.

&nbsp;
#### Benefits:
Compliance administrators can define rules using a policy-as-code language.
CloudFormation templates can be validated against these rules.

&nbsp;
#### Preventative Controls:

- Ensure S3 Block Public Access is used.
- Configure server-side encryption for S3 buckets.
- Utilize AWS managed keys for encryption of data in S3 buckets.
- Enforce HTTPS(TLS) connections only when reading or writing data using a bucket policy.
- Enforce server-side encryption during object puts/writes to the bucket using a bucket policy.
- Ensure automatic rotation of the AWS KMS key used with the S3 bucket.
- Do not allow cross-account key access in the AWS KMS key policy.

&nbsp;
#### Detective Controls:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p2g2nq4ce2k4t6o7s85s.png)

- Use Cloud Control API, AWS Config, and cfn-guard (AWS CloudFormation Guard) to validate deployed workloads against cfn-guard policies.
- Cloud Control API standardizes AWS application programming interfaces (APIs).

&nbsp;
#### Responsive Controls:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tcucdxbh84tn0pq1264a.png)

- Utilize AWS Systems Manager and AWS Config to remediate non-compliant resources as they are detected.

&nbsp;
#### Tool 1

- Open Policy Agent (OPA):
- Developed by Fugue.
- Regula is a command-line tool that uses OPA's Rego language to evaluate rules.
- Can be integrated into CI/CD pipelines such as GitHub Actions, GitLab CI/CD, and Bitbucket Pipelines.

&nbsp;
#### Tool 2

- cfn-guard and checkov:
- Used for validating AWS CDK and CloudFormation templates in a CI/CD pipeline.

&nbsp;
#### Tool 3

- CFN Lint
- Used to validate AWS CloudFormation YAML/JSON templates.



<br/>&nbsp; <br/>&nbsp; 

## Best Practices Against Ransomware

&nbsp;
#### Identity Management:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p5f0sgxtirji9tep7i89.png)

<u>Identity and Access Management (IAM):</u>

- Grant IAM users and roles the minimum required permissions.

<u>Key Management Service (KMS):</u>

- Encrypt data at rest and in transit.
- IAM User:
- Enforce strong password policies or Multi-Factor Authentication (MFA).

&nbsp;
#### Security Posture Management


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bnzrjdqr4zz8oa3i007y.png)

<u>Amazon Inspector:</u>

- Detects newly launched instances, Lambdas, and container images on Elastic Container Registry (ECR).
- Continuously scans AWS workloads to identify potential security issues.
- Scans for unintended network access.
- Utilize open-source products such as OWASP Dependency-Check, Snyk, and OpenVAS.

<u>AWS Security Hub:</u>

- A centralized hub for security state and vulnerability management across AWS accounts.
- Integrates data from Inspector and Patch Manager.

<u>Amazon GuardDuty:</u>

- Monitors for unusual and potentially unauthorized activity.
- Detects potential vulnerabilities or exploits.

<u>Amazon Macie:</u>

- Helps protect data stored in S3 buckets by discovering and classifying sensitive data like Personally Identifiable Information (PII).
- Can alert on buckets that are publicly accessible.

&nbsp;
#### Patch Software Vulnerabilities:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vzjb8scdkts1hs18y8s5.png)

<u>AWS Systems Manager Patch Manager:</u>

- Automates the process of patching managed instances.
- Defines patch baselines that specify which patches should be installed.

&nbsp;
#### Codebase

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x9sxwgft79sa1tl8t5lj.png)

<u>Amazon CodeGuru:</u>

- Scans code and provides recommendations for remediating common security issues.
- Apply OWASP Foundation Source Code Analysis Tools (SAST tools).


&nbsp;
#### Network Security


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/562xzd4hq6spwum575i2.png)

<u>AWS Network Firewall:</u>
- Provides stateful firewalling at the network level.
- Offers intrusion detection and network security controls.
- Allows centralized configuration and application of security policies across VPCs.
- Supports Suricata-based Intrusion Prevention System (IPS) rules.

<u>AWS Network Firewall Flow Logs:</u>
- Monitors network traffic and provides visibility into traffic flowing into and out of VPCs, subnets, and network interfaces.

<u>Amazon VPC Security Groups:</u>
- Control traffic at the instance level.

<u>Amazon GuardDuty:</u>

- Provides threat detection and monitors for unusual traffic patterns, malicious activity, and unauthorized access.
- Automatically triggers blocking rules in response to detected threats.

<u>AWS Shield Advanced:</u>

- Blocks malicious traffic.
- Filters out known bad IP addresses and requests.

&nbsp;
#### Network Security Cases

<u>Case 1: Blocking Malicious Traffic</u>

- AWS Shield Advanced, AWS WAF, and AWS Network Firewall rules can be used to filter out known bad IP addresses and requests.
- GuardDuty can automatically trigger blocking rules in response to detected threats.

<u>Case 2: Intrusion Detection</u>

- AWS Network Firewall supports Suricata-based IPS rules for intrusion detection.
- GuardDuty monitors for unusual traffic patterns of malicious activity.

<u>Case 3: Firewall Capabilities</u>

- Network Firewall provides stateful firewalling at the network level.
- Security Groups control traffic at the instance level.

&nbsp;
#### Backup:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yf18u71y47xnp5hpx05n.png)

- Back up data to a location separate from the production environment.
- Identify critical data (customer, financial records, source code repositories).
- Store data in different AWS accounts/regions or on-premises storage.
- Utilize Amazon S3 for object storage backups.
- Take Amazon EBS snapshots for database/file system backups.
- Use AWS Storage Gateway for on-premises backups.
- Encrypt data at rest using SSE-S3 on S3 and EBS encryption.
- Configure automated, scheduled backups using AWS Backup.
- Verify backup integrity by periodically testing restore processes.
- Enforce strict access controls through IAM policies to retrieve backup data.
- Consider offsite/offline backups for disaster recovery.
- Retain multiple backup copies based on recovery point and time objectives (RPO/RTO).

&nbsp;
#### Restore and Data Recovery Plan

- Use AWS Backup to create a restore testing plan.
- Specify the recovery points, source backups, and frequency of restore testing.
- Trigger restore jobs based on the configured schedule.
- Restore selected recovery points to a predefined S3 bucket for testing.
- Validate that the backed-up data can be successfully recovered.
- Monitor the status of restore jobs via CloudWatch.

&nbsp;
#### Security Incident Response Plan

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q4irvzqgg2d6d3qtkqiz.png)

- Use redeployment mechanisms to address misconfigurations by redeploying resources with the proper configurations.
- Automate response mechanisms wherever possible to programmatically respond to common events.
- Choose scalable solutions to ensure the scalability of your organization's approach to cloud computing.

&nbsp;
#### Address incidents in the Service domain

- Check configurations and resource permissions before deployment.
- Infrastructure domain: Utilize digital forensics/incident response (DFIR) tooling to acquire incident-related data for forensic analysis.

&nbsp;
#### Address incidents in the Application domain: 

- Employ cloud threat detection and response playbooks to prevent incidents related to application code or software deployed to services.



<br/>&nbsp; <br/>&nbsp; 

## Why is Infrastructure as Code (IaC) Needed?

- IaC, such as CloudFormation and Terraform, is necessary because most vulnerabilities relate to misconfiguration rules.
- Terraform has built-in misconfiguration detection.
- It enables risk monitoring of asset vulnerabilities and cloud infrastructure misconfigurations.


<br/>&nbsp; <br/>&nbsp; 

## How to set up limited access on AWS?


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8sweqsu9ihmedmvm5zw5.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3yamt9dijthjsmq5mhwx.png)

<u>AWS Users: </u>
These are identities within an AWS account and are provided with unique credentials to access AWS services.

<u>Credentials: </u>
Each user is assigned an access key ID and secret access key to authenticate AWS API requests.

<u>Groups: </u>
Groups are containers for managing multiple users and applying common policies.

<u>Roles: </u>
Roles define a set of permissions that can be assumed by entities such as users and AWS services.

<u>Policies: </u>
Policies are JSON documents that define permissions and can be attached to users, groups, and roles.

<u>Methods:</u>

- Apply policies to groups and roles.
- Use federated SSO to grant individual access to AWS through an existing SSO solution.
- Regularly rotate access keys.
- Delete unused credentials.
- Use temporary security credentials (STS).


<br/>&nbsp; <br/>&nbsp; 

## How to collect, store, and protect logs?


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lqayu43jxb0o5cgm9iin.png)

&nbsp;
#### Collect 1: CloudTrail
CloudTrail provides auditing, monitoring, and governance of AWS account activity. It records and stores API call activity and related events, providing visibility into user and resource activity.

<u>Benefit: </u>
Create a trail for all regions and send all your logs to an S3 bucket to allow your trail to show activity from every AWS region.

&nbsp;
#### Collect 2: VPC Flow Logs
VPC Flow Logs show data on the IP traffic going to and from the network interfaces in your virtual private cloud (VPC).

<u>Benefit: </u>
VPC Flow Logs can help identify intra-VPC port scanning, network traffic anomalies, and known malicious IP addresses.

&nbsp;
#### Store: AWS Route 53
AWS Route 53 is a highly available domain name system (DNS) web service that allows you to control the routing of internet traffic to your domain names. It is used for registering domain names, configuring DNS settings, and resolving domain names to IP addresses.

<u>Benefit:</u>
Route 53 can log DNS queries for auditing purposes.

&nbsp;
#### Protect: Encrypt log files with SSE-KMS
(Server-Side Encryption with AWS Key Management Service) is a data encryption feature that protects data at rest. It uses the AWS Key Management Service (KMS) to generate and manage encryption keys, ensuring data security and compliance.

<u>Benefit:</u>
Encrypting log files with SSE-KMS provides an additional level of defense by enabling server-side encryption.



<br/>&nbsp; <br/>&nbsp; 

## Monitor, detect, and react

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/czows5hkd8wlbpgzvhuc.png)

&nbsp;
#### CloudWatch alarms
Set up CloudWatch alarms to send an email to the team if the system has unauthorized API calls or VPC changes.

<u>Benefit: </u>
The team can immediately react to the identified risks.

&nbsp;
#### GuardDuty
GuardDuty uses CloudTrail, VPC Flow Logs, and DNS logs to detect and alert suspicious behavior.

<u>Benefit: </u>
GuardDuty helps monitor security at all network levels.

&nbsp;
#### Security Information and Event Management (SIEM)
SIEM provides real-time monitoring, correlation, and analysis of security events and logs from various sources to identify and respond to security incidents and threats. It can detect and investigate security events and generate alerts.

&nbsp;
#### File Integrity Monitoring (FIM)
FIM is a security practice that involves monitoring and detecting unauthorized changes. It compares the current state of files (permissions, size, and checksums) against a known baseline to identify any modifications, deletions, or additions. FIM can indicate potential security breaches or unauthorized activities.



<br/>&nbsp; <br/>&nbsp; 

## IDS & IPS

&nbsp;
#### What is a Virtual Patch?

- A Virtual Patch proactively repairs the part of the code that causes the vulnerability patching.
- Virtual Patching started with IPS (Intrusion Prevention System) Vendors.
- It helps prevent malicious payloads from accessing the vulnerable system.

&nbsp;
#### Intrusion Detection Systems (IDS)

- IDS monitors networks and systems for malicious activity or policy violations.

&nbsp;
#### Intrusion Prevention Systems (IPS)

- IPS is placed behind firewalls and provides an additional layer of security.
- It scans and analyzes suspicious content for potential threats.

&nbsp;
#### Benefits of IDS and IPS

- IDS and IPS alert administrators of possible incidents.
- They report activity to systems administrators and event management (SIEM) systems.

&nbsp;
#### Protection Against Attacks

- Dropping malicious packets.
- Blocking traffic from the source address.
- Resetting the connection.

&nbsp;
#### Detecting Vulnerabilities

- Host Intrusion Detection Systems monitor inbound and outbound packets.

&nbsp;
#### Industry Standards for Security Controls

- Center for Internet Security (CIS) Controls.
- SANS Critical Security Controls (SANS Top 20).
- NIST, ISO 27001, NERC CIP, or IEC 62443.



<br/>&nbsp; <br/>&nbsp; 

## Server-side Request Forgery (SSRF)

- SSRF allows an attacker to cause the server-side application to make requests to an unintended location.
- It is a web application vulnerability that can allow unauthorized access to sensitive resources by manipulating the target server to send a crafted request.
- It can bypass security controls.

&nbsp;
#### Protection Against SSRF

- Validate user input.
- Limit the scope of what a server can access.
- Use the Security Token Service (STS) AssumeRole API to provide temporary security credentials and limit actions and resources.
- Use VPC endpoints to access services over the Amazon private network, preventing external access.
- Implement a Web Application Firewall (WAF) to block suspicious web requests, such as those containing suspicious patterns or injected payloads.
- Apply a firewall to AWS CloudFront, Elastic Load Balancing, or Amazon API Gateway.
- Keep software up to date.



<br/>&nbsp; <br/>&nbsp; 

## Cross-Site Scripting (XSS)

- XSS is a system vulnerability that allows an attacker to inject malicious scripts.
- It occurs due to a lack of proper input validation and sanitization in code.
- Types of XSS include stored XSS, reflected XSS, DOM-based XSS, and phishing-based XSS.

&nbsp;
#### Protection Against XSS

<u>Prevention of XSS</u>

- Implement Content Security Policy (CSP) using security libraries and frameworks like OWASP ESAPI and Spring Security.
- Use AWS Web Application Firewall (WAF) to create rules that block XSS attack patterns.
- Utilize AWS Shield for protection against DDoS attacks, XSS, and SQL injection.

<u>Web Application Firewall (WAF)</u>

- WAF covers SQL Injection, XSS, and OWASP Top 10 vulnerabilities.
- It applies rules to filter web traffic based on conditions, including IP addresses.
- It provides an additional layer of protection from web attacks and blocks common web exploits.

<u>Virtual Private Cloud (Amazon VPC) Security Groups</u>

- Security groups allow control of network access.
- They enable adding rules that control inbound and outbound traffic.



<br/>&nbsp; <br/>&nbsp; 

## What is a Whaling attack?

- It is a phishing attack that targets high-profile or senior individuals, such as CEOs.
- The goal is to deceive the target into sharing sensitive information or performing actions like transferring money.
- The attacker impersonates trusted contacts of the target through spoofed emails.
- They may use urgent requests for wire transfers or password resets.
- It is a social engineering attack that relies on deceiving users.



<br/>&nbsp; <br/>&nbsp; 

## Cloud Security Posture Management (CSPM)

- CSPM involves continuously monitoring and managing the security posture of cloud environments.
- It assesses, identifies, and remediates security risks and misconfigurations.
- CSPM can automatically fix misconfigurations as soon as they are detected.
- It flags issues before anything is deployed and ensures compliance with security best practices.
- It observes cloud configurations against security policies and baselines to identify vulnerabilities.
- CSPM generates reports and alerts to notify security teams.

&nbsp;
#### Benefits of CSPM

- Unifying AWS with on-premises security.
- Enhancing the organization's cybersecurity posture.
- Consolidating security data in one set of tools.
- Automating the deployment of new AWS infrastructure ensures compliance with the baseline.
- It automatically flags or terminates infrastructure that is not in compliance.


<br/>&nbsp; <br/>&nbsp; 

## Reference

**AWS builders**

[What is a Whaling Attack?](https://dev.to/aws-builders/what-is-a-whaling-attack-544l)

[AWSecurity Best Practices](https://dev.to/aws-builders/awsecurity-best-practices-3l0g)

[AWS Security Stories (7 Part Series)](https://dev.to/aws-builders/aws-security-tip001-virtual-patching-479m)

[Vulnerability Management at Scale With Amazon Inspector](https://dev.to/asankab/vulnerability-management-at-scale-with-amazon-inspector-26fo)

[Unlocking AWS Security with Security Hub](https://dev.to/aws-builders/unlocking-aws-security-with-security-hub-6m5)

[Securing AWS Environments Against Ransomware](https://dev.to/aws-builders/securing-aws-environments-against-ransomware-3a0d)

[How do you enforce & ensure AWS S3 secured transit - AWS Config Rule](https://dev.to/aws-builders/how-do-you-enforce-ensure-aws-s3-secured-transit-aws-config-rule-p10)

**Docunment**

[Security control recommendations for protecting infrastructure](https://docs.aws.amazon.com/prescriptive-guidance/latest/security-controls-by-caf-capability/infrastructure-controls.html)

[Appendix: AWS services for edge computing](https://docs.aws.amazon.com/whitepapers/latest/security-at-the-edge/appendix-aws-services-for-edge-computing.html)

[Restore testing](https://docs.aws.amazon.com/aws-backup/latest/devguide/restore-testing.html)

[Getting started 5: View your backup jobs and recovery points](https://docs.aws.amazon.com/aws-backup/latest/devguide/view-protected-resources.html)

[RestoreTestingPlanForUpdate](https://docs.aws.amazon.com/aws-backup/latest/devguide/API_RestoreTestingPlanForUpdate.html
RestoreTestingPlanForUpdate)

[AWS Security Incident Response Guide](https://docs.aws.amazon.com/whitepapers/latest/aws-security-incident-response-guide/introduction.html)

[SEC10-BP02 Develop incident management plans](https://docs.aws.amazon.com/wellarchitected/2022-03-31/framework/sec_incident_response_develop_management_plans.html)

[Building a landing zone](https://docs.aws.amazon.com/prescriptive-guidance/latest/migration-aws-environment/building-landing-zones.html)

[AWS Prescriptive Guidance glossary](https://docs.aws.amazon.com/prescriptive-guidance/latest/amazon-emr-hardware/apg-gloss.html)

[Landing zone patterns and anti-patterns: Balance agility and safety](https://d1.awsstatic.com/events/Summits/reinvent2023/FSI308-R_Landing-zone-patterns-and-anti-patterns-Balance-agility-and-safety-REPEAT_NO-NOTES.pdf)

[How to Detect and Mitigate Guardrail Violation with AWS Control Tower](https://aws.amazon.com/blogs/mt/how-to-detect-and-mitigate-guardrail-violation-with-aws-control-tower/)

[Policy-as-code](https://catalog.us-east-1.prod.workshops.aws/workshops/9da471a0-266a-4d36-8596-e5934aeedd1f/en-US/introduction)

[Using-policy-as-code-to-deploy-new-applications-in-minutes](https://d1.awsstatic.com/events/Summits/reinvent2022/COP313_Goldman-Sachs-Using-policy-as-code-to-deploy-new-applications-in-minutes.pdf)

[Components of an AWS Config Rule](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_components.html)

[Management and governance](https://docs.aws.amazon.com/whitepapers/latest/aws-overview/management-governance.html)

[put-config-rule](https://docs.aws.amazon.com/cli/latest/reference/configservice/put-config-rule.html)

[SIEM Software Features](https://www.paloaltonetworks.com/cyberpedia/what-is-siem-software#:~:text=SIEM%20Software%20Features,-SIEM%20software%20typically&text=Monitor%20security%20events%20in%20real,potential%20security%20incidents%20or%20threats.&text=Use%20advanced%20analytics%20and%20correlation%20algorithms%20to%20identify%20potential,and%20anomalies%20in%20user%20behavior.)

[AWS Security Maturity Model](https://maturitymodel.security.aws.dev/)