Skip to main content

More Info:

Identifies roles held by the managed identities of networking services, together with the permissions those roles carry. Permissions here often reach routing, firewall and peering configuration, where a change quietly reroutes or exposes traffic instead of breaking something visibly. Confirm each role is still in use and scope it to the specific network resources it manages.

Risk Level

High

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration of “Roles Assumable By Network Services” in Azure using the Azure console, follow these steps:
  1. Sign in to the Azure portal (https://portal.azure.com) using your Azure account credentials.
  2. In the Azure portal’s search bar, type “Azure Active Directory” and select the “Azure Active Directory” service from the suggestions.
  3. In the Azure Active Directory blade, click on “Roles and administrators” in the left-hand navigation menu.
  4. On the Roles and administrators page, click on “Roles” tab.
  5. In the Roles tab, you will see a list of built-in roles. Look for roles that are assigned to Network Services, such as “Network Contributor” or “Network Contributor (Classic)”.
  6. Select the Network Service role that you want to remediate by clicking on it.
  7. In the Network Service role’s overview page, click on “Assignments” in the left-hand navigation menu.
  8. Review the list of role assignments for the Network Service role. Identify any inappropriate or unnecessary assignments.
  9. To remove an assignment, select the checkbox next to the assignment and click on the “Remove” button at the top of the page. Confirm the removal when prompted.
  10. Repeat steps 8 and 9 for all inappropriate or unnecessary role assignments.
  11. To prevent future misconfigurations, consider implementing a least privilege access model by creating custom roles with specific permissions for network-related tasks, rather than using the built-in Network Service roles.
  12. Click on “Add assignment” button to assign the appropriate roles to the network services based on their required responsibilities.
  13. In the “Add assignments” page, search for the appropriate role in the “Role” search bar.
  14. Select the desired role from the search results.
  15. In the “Select” section, choose the appropriate scope for the assignment (subscription, resource group, or specific resource).
  16. Specify the user, group, or application that should be assigned the role in the “Members” section.
  17. Click on the “Review + assign” button to review the assignment details.
  18. Review the assignment details and ensure they are correct. If everything looks good, click on the “Assign” button to complete the assignment.
  19. Repeat steps 13-18 for all necessary role assignments for the Network Services.
By following these steps, you can remediate the misconfiguration of “Roles Assumable By Network Services” in Azure using the Azure console.

To remediate the misconfiguration of “Roles Assumable By Network Services” in Azure using Azure CLI, follow these steps:
  1. Install Azure CLI: If you don’t have Azure CLI installed, follow the official documentation to install it on your system.
  2. Authenticate to Azure: Open the Azure CLI and log in to your Azure account using the following command:
  3. List the existing network service roles: Run the following command to list all the existing network service roles in your Azure subscription:
    This command will display the details of the network service role, including its name, ID, and other properties.
  4. Remove the network service role assignment: Identify the role assignment that needs to be removed. You can find the role assignment by looking for the “RoleDefinitionName” property in the output of the previous command. To remove the network service role assignment, use the following command, replacing <role-assignment-id> with the actual ID of the role assignment:
    This command will delete the specified role assignment, removing the network service’s access to the resources.
  5. Verify the removal: To ensure that the network service role assignment has been successfully removed, run the following command again:
    If the command does not return any results, it means that the network service role assignment has been successfully remediated.
By following these steps, you will remediate the misconfiguration related to “Roles Assumable By Network Services” in Azure using Azure CLI.
To remediate the misconfiguration “Roles Assumable By Network Services” in Azure IAM using Python, follow these steps:
  1. Install the required Python packages:
  2. Import the necessary libraries in your Python script:
  3. Authenticate with Azure using the DefaultAzureCredential:
  4. Retrieve the list of role assignments for network services:
  5. Remove the role assignments for network services:
  6. Run the Python script to remediate the misconfiguration.
Note: Make sure you have the necessary permissions to delete role assignments.
Substitute:
  • NETWORKING_SERVICE_MI_NAME / NETWORKING_SERVICE_MI_RG_NAME with the networking service’s managed identity name and resource group.
  • TARGET_VNET_NAME / TARGET_VNET_RG_NAME with the specific network resource it should manage (or change data.azurerm_virtual_network to another resource type whose id you want as scope).
Changing the scope or role_definition_id on an existing azurerm_role_assignment forces replacement of the role assignment object itself, but does not cause downtime for the networking service; it only changes what it is allowed to do.Verification: terraform plan should show the previous overly broad azurerm_role_assignment being destroyed (if you remove it from code) and a new azurerm_role_assignment.networking_service_vnet_scope created with the narrower scope.