Skip to main content

More Info:

Ensure that Function endpoint is not open to the internet 0.0.0.0/0

Risk Level

Medium

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • Essential 8
  • HITRUST CSF
  • ISO 27001
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST CSF
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • PCI
  • Reserve Bank of India (RBI) Cyber Security Framework
  • Reserve Bank of India (RBI) Master Direction – Information Technology Framework
  • SOC2
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • Securities and Exchange Board of India (SEBI) - Cloud Security Adoption Framework
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

Sure, here are the step-by-step instructions to remediate the “Cloud Functions Endpoint Should Not Be Publicly Accessible” misconfiguration for GCP using the GCP console:
  1. Open the Google Cloud Console and select the project that contains the Cloud Function you want to remediate.
  2. In the navigation menu, go to “Cloud Functions” under the “Compute” section.
  3. Select the Cloud Function that you want to remediate.
  4. Click on the “Permissions” tab in the Cloud Function details page.
  5. Under the “Ingress settings” section, click on the “Allow internal traffic only” radio button.
  6. Click on the “Save” button to apply the changes.
  7. Verify that the Cloud Function is no longer publicly accessible by attempting to access the function’s endpoint URL from a browser or using a tool like curl. You should receive an error message stating that access is denied.
By following these steps, you have successfully remediated the “Cloud Functions Endpoint Should Not Be Publicly Accessible” misconfiguration for GCP using the GCP console.

To remediate the issue of Cloud Functions Endpoint being publicly accessible in GCP, you can follow the below steps using GCP CLI:
  1. Open the Cloud Functions page in the GCP console.
  2. Find the function that you want to remediate and click on it.
  3. In the function details page, click on the “Permissions” tab.
  4. Under the “Invokers” section, click on “Add Member”.
  5. In the “Add members” dialog box, enter the email address of the service account or user that needs to access the function.
  6. Select the appropriate role for the user/service account.
  7. Click on “Save” to add the user/service account to the function’s invokers list.
  8. Repeat steps 4-7 for all the users/service accounts that need access to the function.
By following the above steps, you can restrict the access to your Cloud Functions Endpoint and ensure that it is not publicly accessible.
To remediate the issue of Cloud Functions Endpoint being publicly accessible on GCP using Python, you can follow the below steps:
  1. Open the Cloud Functions Console in your GCP project.
  2. Select the function that you want to remediate and click on the “Edit” button.
  3. In the “Edit Function” screen, scroll down to the “Networking” section and click on “Add VPC connector”.
  4. In the “Add VPC connector” screen, select the VPC network that you want to use and click on “Save”.
  5. Once the VPC connector is added, scroll down to the “Ingress Settings” section and select “Allow internal traffic only”.
  6. Click on “Save” to save the changes.
Now, your Cloud Functions Endpoint will not be publicly accessible and can only be accessed internally within the VPC network that you have specified.To automate this process using Python, you can use the GCP Python client library. Here’s an example code snippet:
Make sure to replace the project_id, function_name, and vpc-connector-name variables with the appropriate values for your environment.
This change does not force replacement of the Cloud Function itself; it only updates IAM bindings. After applying, terraform plan should show removal (or absence) of any google_cloudfunctions_function_iam_* bindings with member = "allUsers" or "allAuthenticatedUsers" for roles/cloudfunctions.invoker, and creation/update of bindings that reference only specific principals.

Additional Reading: