Secure transmission of client information
Resources:
WebSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Allow HTTP inbound traffic
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 80
ToPort: 80
CidrIp: 0.0.0.0/0
WebInstance:
Type: AWS::EC2::Instance
Properties:
ImageId: ami-0c94855ba95c574c8
InstanceType: t2.micro
SecurityGroupIds:
- !Ref WebSecurityGroup
Tags:
- Key: Name
Value: HelloWorld
The following CloudFormation code creates an EC2 instance and a security group
that allows inbound HTTP traffic (port 80) from any source (0.0.0.0/0).
This configuration is vulnerable because HTTP transmits data in plain text
without encryption, allowing sensitive information to be easily intercepted
by attackers.
Resources:
WebSecurityGroupHTTPS:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Allow HTTPS inbound traffic
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 443
ToPort: 443
CidrIp: 0.0.0.0/0
WebInstance:
Type: AWS::EC2::Instance
Properties:
ImageId: ami-0c94855ba95c574c8
InstanceType: t2.micro
SecurityGroupIds:
- !Ref WebSecurityGroupHTTPS
Tags:
- Key: Name
Value: HelloWorld
The updated code replaces HTTP with HTTPS by only allowing inbound traffic
on port 443 (HTTPS). This ensures data transmission is encrypted using TLS.
Make sure the application and web server are properly configured with a valid
SSL/TLS certificate to support secure HTTPS connections.