As a new security engineer for AnyCompany, I needed to identify weak areas in the company's network security and update our environment for better efficiency and optimization. I decided to use Amazon Inspector for this task.
Amazon Inspector runs scans that analyze all network configurations—such as security groups, network ACLs, route tables, and internet gateways—together to infer reachability. What's great is that it doesn't require sending packets across the VPC network or connecting to EC2 instance network ports. It's essentially packetless network mapping and reconnaissance.
I specifically used the network reachability package from Amazon Inspector to analyze our network configurations and find security vulnerabilities in our EC2 instances. The findings generated by Amazon Inspector also provided guidance about restricting access that was not secure.
My goals were to:
To create an assessment target for Amazon Inspector Classic to assess, I started by tagging the EC2 instances I wanted to include in the target. In this task, I tagged the BastionServer instance.
Every AWS tag consists of a key and value pair. I followed these steps:
Summary of Task 1
I successfully applied tags for the BastionServer instance, which allowed the security scan to find and scan this instance.
Next, I learned how to run an agentless network audit on our EC2 instances using Amazon Inspector. I used the network reachability rules package.
Use case: I realized it might not be possible to install agents on all hosts in our deployment, as not all types of operating systems support Amazon Inspector agents. Using this method, I would be able to run network audit on all hosts.
Here's what I did:
I saw a SUCCESS notification, which confirmed that the assessment run was initiated. It took about 3-5 minutes to complete.
While waiting, I took some time to learn more about Amazon Inspector.
To check the status of the scan:
Summary of Task 2
In this task, I created an assessment target (a collection of AWS resources for Amazon Inspector Classic to analyze). Then I created an assessment template (a blueprint to configure the assessment). I used the template to start an assessment run, which is the monitoring and analysis process that results in a set of findings.
The findings that these rules generated showed whether our ports were reachable from the internet through an internet gateway (including instances behind Application Load Balancers or Classic Load Balancers), a VPC peering connection, or a virtual private network (VPN) through a virtual gateway. These findings also highlighted network configurations that allow for potentially malicious access, such as mismanaged security groups, ACLs, and internet gateways.
I expanded the high-severity finding and saw the following key details:
Telnet is a text-based terminal emulation utility that is part of the TCP/IP suite of protocols. It allows a system to connect to a remote host to perform commands as if you were on the console of the remote machine.
I then expanded the medium-severity findings and analyzed the details:
SSH, like the Telnet utility, gives a user the ability to log in to a remote machine and perform commands as if they were on the console of that system. Telnet, however, is insecure because its data isn't encrypted when communicated. SSH provides a secure, encrypted tunnel to access another system remotely.
In this task, I explored a few remediation options for the security findings that Amazon Inspector discovered. The first option showed how to lock down port 22 to specific IP addresses.
Here's what I did:
The 0.0.0.0/0 IP address for inbound rules means that port 22 is accessible from anyone on the internet.
I decided to adjust the inbound rules so that only my IP address could access port 22. Although this option is much more secure, I understood it still has vulnerabilities. For example, someone could access the computer associated with that IP address and gain access.
The scan took approximately 30-60 seconds to complete.
I observed that the high-severity finding was now gone, but the medium-severity finding remained. Although port 22 was scoped down to allow access to only my IP address, port 22 was still technically open to the internet outside the VPC.
Summary of Task 4
In this task, I successfully updated the security group attached to the BastionServer so that it allows traffic from only my IP address instead of the open internet and removed the wide-open and no-longer-needed Telnet port.
In this final task, I replaced the BastionServer instance, which had primarily used SSH to connect to the AppServer within the private subnet. Instead, I opted to use Session Manager via Systems Manager.
I noted that Systems Manager is a secure end-to-end management solution for hybrid cloud environments. It's the operations hub for AWS applications and resources and consists of four core feature groups.
Here's what I did:
Next, I connected to the AppServer directly using Session Manager.
I learned that with Session Manager, I could quickly and securely access EC2 instances through an interactive one-click browser-based shell or through the AWS CLI without the need to open inbound ports, maintain bastion hosts, or manage SSH keys.
The output showed: /home/ssm-user
Summary of Task 5
I successfully improved the network security by adding an IAM role to the AppServer and removing the SSH inbound rule within the Bastion security group while making it even easier to connect using Session Manager provided by Systems Manager.
I successfully completed all the objectives of this lab:
Through this hands-on experience, I gained valuable skills in identifying and remediating security vulnerabilities in AWS environments using modern, secure methods for server access and management.