Skip to main content

Triage and Remediation

Remediation

Using Console

To remediate the “Unrestricted Netbios Access Should Not Be Allowed” misconfiguration in AWS using the AWS console, you can follow these steps:
  1. Log in to your AWS Management Console.
  2. Go to the Amazon VPC dashboard.
  3. Click on “Security Groups” from the left-hand menu.
  4. Select the security group that has unrestricted NetBIOS access.
  5. Click on the “Inbound Rules” tab.
  6. Locate the rule that allows unrestricted NetBIOS access (usually port 137-139).
  7. Click on the “Edit” button next to the rule.
  8. Change the source IP address to a specific IP address or range of IP addresses that should be allowed to access NetBIOS.
  9. Click on the “Save” button to save the changes.
By following these steps, you have successfully remediated the “Unrestricted Netbios Access Should Not Be Allowed” misconfiguration in AWS.

To remediate the unrestricted NetBIOS access issue in AWS using AWS CLI, follow these steps:
  1. Open the AWS CLI and run the following command to list all the security groups in your AWS account:
  2. Identify the security group that has unrestricted NetBIOS access.
  3. Run the following command to revoke the inbound rule that allows unrestricted NetBIOS access:
    Note: Replace <security-group-id> with the ID of the security group that you identified in step 2.
  4. Run the following command to revoke the inbound rule that allows unrestricted NetBIOS access:
    Note: Replace <security-group-id> with the ID of the security group that you identified in step 2.
  5. Verify that the inbound rules have been revoked by running the following command:
    Note: Replace <security-group-id> with the ID of the security group that you identified in step 2.
  6. Repeat steps 3-5 for all the security groups in your AWS account that have unrestricted NetBIOS access.
  7. Once you have revoked the inbound rules for all the security groups, the unrestricted NetBIOS access issue will be remediated.
To remediate the “Unrestricted Netbios Access Should Not Be Allowed” misconfiguration for AWS using python, you can follow these steps:
  1. Import the necessary AWS SDK and modules in your python script.
  1. Create an AWS client for EC2 service.
  1. Get a list of all the security groups in your AWS account.
  1. Loop through each security group and check if it has unrestricted NetBIOS access. To do this, check if any of the inbound rules of the security group has the protocol set to “UDP” or “TCP”, the port range set to “137-139”, and the source IP range set to “0.0.0.0/0” or ”::/0”.
  1. If you find any security group that has unrestricted NetBIOS access, remove the offending inbound rule from the security group using the revoke_security_group_ingress() method of the AWS EC2 client. You will need to provide the security group ID, the protocol, the port range, and the source IP range of the offending rule as parameters to this method.
  1. After removing the offending rule, you can verify that the security group no longer allows unrestricted NetBIOS access by repeating step 4.
Note: Make sure you have the necessary permissions to modify security groups in your AWS account.
If your existing aws_security_group currently has ingress rules with cidr_blocks = ["0.0.0.0/0"] or ipv6_cidr_blocks = ["::/0"] for TCP 139 or UDP 137/138, delete those specific ingress {} blocks (or narrow their CIDRs as shown). This mirrors the CLI revoke-security-group-ingress by permanently removing those inbound rules; the security group itself is not replaced, only its rules change, but loss of those ports may impact any workloads relying on them.Verification: terraform plan should show the security group being updated with the offending ingress rules removed (or modified to trusted CIDRs), and no new rules for TCP 139 / UDP 137 / UDP 138 open to 0.0.0.0/0 or ::/0.