[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71FMCPK5NQW4H3QQHTWV0T3":3,"skill-same:01M71FMCPK5NQW4H3QQHTWV0T3":88},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":61,"commitSha":62,"skillDirectory":63,"forksCount":14,"repositoryHtmlUrl":64,"repositoryHomepageUrl":6,"ownerHtmlUrl":65,"ownerBlogUrl":6,"ownerDescription":66,"updatedAt":67,"install":68,"resources":81},"01M71FMCPK5NQW4H3QQHTWV0T3","firewall-gcp-exploit",null,"Implementing and auditing GCP VPC firewall rules to enforce network segmentation, restrict ingress and egress traffic, apply hierarchical firewall policies across the organization, and monitor firewall rule effectiveness using VPC Flow Logs.","DCx7C5\u002Fai-marketplace","DCx7C5","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F42419559?v=4","01M71C01G2AZV3NTNGWAWSHJPP","DC","01M71C01GQW6G50S2BYMS7PP3E",0,"MIT","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fnetwork\u002Ffirewall\u002Fgcp\u002Fexploit\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"gcp","exploit","firewall gcp exploit","firewall","read","cloud-security","organization","de","t1078","across","logs","Bash","cybersecurity","traffic","network segmentation","implementing","cm","segmentation","firewall-rules","vpc","2026-11-10 10:12:30",false,"---\nname: firewall-gcp-exploit\ndescription: Implementing and auditing GCP VPC firewall rules to enforce network segmentation, restrict ingress and egress traffic, apply hierarchical firewall policies across the organization, and monitor firewall rule effectiveness using VPC Flow Logs.\ndomain: cybersecurity\nsubdomain: cloud-security\ntags:\n- cloud-security\n- gcp\n- vpc\n- firewall-rules\n- network-security\n- segmentation\nnist_csf:\n- PR.IR-01\n- ID.AM-08\n- GV.SC-06\n- DE.CM-01\nmodel: sonnet\nmaxTurns: 20\ntools: [Read, Bash, Glob, Grep]\nmitre_attack:\n- T1078.004\n- T1562.004\ncapec: []\n---\n\n# Implementing GCP VPC Firewall Rules\n\n## When to Use\n\n- When deploying new GCP workloads that require network-level access controls\n- When auditing existing firewall configurations for overly permissive rules\n- When implementing zero trust network segmentation within GCP VPC networks\n- When responding to Security Command Center findings about open firewall rules\n- When building hierarchical firewall policies across a GCP organization\n\n**Do not use** for application-layer filtering (use Cloud Armor WAF), for DNS-based filtering (use Cloud DNS response policies), or for VPN\u002Finterconnect traffic filtering without understanding that VPC firewall rules apply to traffic within the VPC.\n\n## Prerequisites\n\n- GCP project with Compute Engine API enabled\n- IAM roles: `roles\u002Fcompute.securityAdmin` for firewall management, `roles\u002Fcompute.networkViewer` for auditing\n- Organization Admin role for hierarchical firewall policies\n- gcloud CLI authenticated with appropriate permissions\n- VPC Flow Logs enabled on target subnets for monitoring\n\n## Workflow\n\n### Step 1: Audit Existing Firewall Rules for Security Gaps\n\nEnumerate all firewall rules and identify overly permissive configurations.\n\n```bash\n# List all firewall rules in the project\ngcloud compute firewall-rules list \\\n  --format=\"table(name, network, direction, priority, allowed[].map().firewall_rule().list():label=ALLOWED, sourceRanges, targetTags)\"\n\n# Find rules allowing all traffic from 0.0.0.0\u002F0\ngcloud compute firewall-rules list \\\n  --filter=\"direction=INGRESS AND sourceRanges=0.0.0.0\u002F0\" \\\n  --format=\"table(name, network, allowed, priority, targetTags)\" \\\n  --sort-by=priority\n\n# Find rules allowing all protocols and ports\ngcloud compute firewall-rules list \\\n  --filter=\"direction=INGRESS AND allowed[].IPProtocol=all\" \\\n  --format=\"table(name, network, sourceRanges, targetTags)\"\n\n# Find rules with SSH (22) or RDP (3389) open to the internet\ngcloud compute firewall-rules list \\\n  --filter=\"direction=INGRESS AND sourceRanges=0.0.0.0\u002F0 AND (allowed[].ports=22 OR allowed[].ports=3389)\" \\\n  --format=\"table(name, network, allowed, sourceRanges)\"\n\n# Check for disabled rules\ngcloud compute firewall-rules list \\\n  --filter=\"disabled=true\" \\\n  --format=\"table(name, network, direction)\"\n```\n\n### Step 2: Create Restrictive Ingress Firewall Rules\n\nImplement least-privilege ingress rules using network tags and service accounts for targeting.\n\n```bash\n# Create rule allowing HTTPS from the internet to web servers only\ngcloud compute firewall-rules create allow-https-web \\\n  --network=production-vpc \\\n  --direction=INGRESS \\\n  --action=ALLOW \\\n  --rules=tcp:443 \\\n  --source-ranges=0.0.0.0\u002F0 \\\n  --target-tags=web-server \\\n  --priority=1000 \\\n  --description=\"Allow HTTPS to web servers from internet\"\n\n# Create rule allowing SSH only from bastion host subnet\ngcloud compute firewall-rules create allow-ssh-bastion \\\n  --network=production-vpc \\\n  --direction=INGRESS \\\n  --action=ALLOW \\\n  --rules=tcp:22 \\\n  --source-ranges=10.0.1.0\u002F24 \\\n  --target-tags=ssh-allowed \\\n  --priority=1000 \\\n  --description=\"Allow SSH only from bastion subnet\"\n\n# Create rule allowing internal communication between app tiers\ngcloud compute firewall-rules create allow-app-to-db \\\n  --network=production-vpc \\\n  --direction=INGRESS \\\n  --action=ALLOW \\\n  --rules=tcp:5432 \\\n  --source-tags=app-server \\\n  --target-tags=db-server \\\n  --priority=1000 \\\n  --description=\"Allow PostgreSQL from app tier to database tier\"\n\n# Create service-account-based rule (more secure than tags)\ngcloud compute firewall-rules create allow-api-internal \\\n  --network=production-vpc \\\n  --direction=INGRESS \\\n  --action=ALLOW \\\n  --rules=tcp:8080 \\\n  --source-service-accounts=api-client@project.iam.gserviceaccount.com \\\n  --target-service-accounts=api-server@project.iam.gserviceaccount.com \\\n  --priority=1000\n```\n\n### Step 3: Implement Egress Restrictions\n\nConfigure egress firewall rules to control outbound traffic and prevent data exfiltration.\n\n```bash\n# Deny all egress by default (low priority)\ngcloud compute firewall-rules create deny-all-egress \\\n  --network=production-vpc \\\n  --direction=EGRESS \\\n  --action=DENY \\\n  --rules=all \\\n  --destination-ranges=0.0.0.0\u002F0 \\\n  --priority=65534 \\\n  --description=\"Default deny all egress traffic\"\n\n# Allow egress to Google APIs via restricted VIP\ngcloud compute firewall-rules create allow-google-apis \\\n  --network=production-vpc \\\n  --direction=EGRESS \\\n  --action=ALLOW \\\n  --rules=tcp:443 \\\n  --destination-ranges=199.36.153.4\u002F30 \\\n  --priority=1000 \\\n  --description=\"Allow HTTPS to Google APIs restricted VIP\"\n\n# Allow DNS resolution\ngcloud compute firewall-rules create allow-dns-egress \\\n  --network=production-vpc \\\n  --direction=EGRESS \\\n  --action=ALLOW \\\n  --rules=udp:53,tcp:53 \\\n  --destination-ranges=169.254.169.254\u002F32,8.8.8.8\u002F32,8.8.4.4\u002F32 \\\n  --priority=1000 \\\n  --description=\"Allow DNS resolution to metadata and Google DNS\"\n\n# Allow egress to specific external services\ngcloud compute firewall-rules create allow-external-apis \\\n  --network=production-vpc \\\n  --direction=EGRESS \\\n  --action=ALLOW \\\n  --rules=tcp:443 \\\n  --destination-ranges=PARTNER_CIDR\u002F32 \\\n  --target-tags=api-client \\\n  --priority=1000\n```\n\n### Step 4: Deploy Hierarchical Firewall Policies\n\nCreate organization and folder-level firewall policies that apply across all projects.\n\n```bash\n# Create an organization-level firewall policy\ngcloud compute firewall-policies create \\\n  --organization=ORG_ID \\\n  --short-name=org-security-policy \\\n  --description=\"Organization-wide security firewall policy\"\n\n# Add rule to block known malicious IP ranges at org level\ngcloud compute firewall-policies rules create 100 \\\n  --firewall-policy=org-security-policy \\\n  --organization=ORG_ID \\\n  --direction=INGRESS \\\n  --action=deny \\\n  --src-ip-ranges=THREAT_INTEL_CIDR_1,THREAT_INTEL_CIDR_2 \\\n  --layer4-configs=all \\\n  --description=\"Block known malicious IPs organization-wide\"\n\n# Add rule to enforce HTTPS-only ingress at org level\ngcloud compute firewall-policies rules create 200 \\\n  --firewall-policy=org-security-policy \\\n  --organization=ORG_ID \\\n  --direction=INGRESS \\\n  --action=allow \\\n  --src-ip-ranges=0.0.0.0\u002F0 \\\n  --layer4-configs=tcp:443 \\\n  --description=\"Allow only HTTPS from external sources\"\n\n# Associate policy with the organization\ngcloud compute firewall-policies associations create \\\n  --firewall-policy=org-security-policy \\\n  --organization=ORG_ID\n```\n\n### Step 5: Enable VPC Flow Logs for Monitoring\n\nConfigure VPC Flow Logs to monitor traffic patterns and validate firewall rule effectiveness.\n\n```bash\n# Enable flow logs on a subnet\ngcloud compute networks subnets update production-subnet \\\n  --region=us-central1 \\\n  --enable-flow-logs \\\n  --logging-aggregation-interval=interval-5-sec \\\n  --logging-flow-sampling=1.0 \\\n  --logging-metadata=include-all\n\n# Query flow logs in Cloud Logging for denied traffic\ngcloud logging read '\n  resource.type=\"gce_subnetwork\"\n  AND jsonPayload.disposition=\"DENIED\"\n  AND timestamp>=\"2026-02-22T00:00:00Z\"\n' --limit=50 --format=json\n\n# Find traffic hitting overly permissive rules\ngcloud logging read '\n  resource.type=\"gce_subnetwork\"\n  AND jsonPayload.rule_details.reference:\"\u002Ffirewall-rules\u002Fdefault-allow-\"\n' --limit=100 --format=\"table(jsonPayload.connection.src_ip,jsonPayload.connection.dest_ip,jsonPayload.connection.dest_port)\"\n\n# Export flow logs to BigQuery for analysis\ngcloud logging sinks create vpc-flow-bq \\\n  bigquery.googleapis.com\u002Fprojects\u002FPROJECT\u002Fdatasets\u002Fvpc_flow_logs \\\n  --log-filter='resource.type=\"gce_subnetwork\"'\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| VPC Firewall Rule | Stateful network-level access control that allows or denies traffic to and from VM instances based on IP ranges, protocols, ports, and tags |\n| Hierarchical Firewall Policy | Organization or folder-level firewall policy that is evaluated before VPC-level rules and applies across all child projects |\n| Network Tag | Label applied to VM instances that determines which firewall rules apply, used for targeting ingress and egress rules |\n| Service Account Firewall Rule | Firewall rule that targets instances based on their attached service account, providing more secure targeting than mutable network tags |\n| VPC Flow Logs | Network telemetry captured at the subnet level that records traffic metadata for monitoring, forensics, and firewall rule validation |\n| Implied Rules | Default GCP firewall rules that allow egress to all destinations and deny ingress from all sources, with lowest priority (65535) |\n\n## Tools & Systems\n\n- **gcloud compute firewall-rules**: CLI commands for creating, listing, and managing VPC firewall rules in GCP\n- **Hierarchical Firewall Policies**: Organization and folder-level policies enforcing security controls across all projects\n- **VPC Flow Logs**: Subnet-level traffic logging for monitoring, troubleshooting, and validating firewall effectiveness\n- **Cloud Logging**: Query engine for analyzing VPC Flow Logs and firewall rule hit counts\n- **Security Command Center**: GCP-native security platform with findings for overly permissive firewall configurations\n\n## Common Scenarios\n\n### Scenario: Locking Down a Production VPC After Discovery of Overly Permissive Rules\n\n**Context**: A security audit reveals that the production VPC has default-allow rules permitting SSH from `0.0.0.0\u002F0` and unrestricted egress. SCC reports 14 firewall findings.\n\n**Approach**:\n1. Enumerate all existing rules with `gcloud compute firewall-rules list` and categorize by risk\n2. Enable VPC Flow Logs on all subnets to capture baseline traffic patterns for 7 days\n3. Analyze flow logs to identify legitimate traffic that needs explicit allow rules\n4. Create targeted ingress rules for each application tier (web: 443, app: 8080, db: 5432)\n5. Replace the SSH-from-anywhere rule with SSH-from-bastion-subnet-only\n6. Implement default-deny egress and add explicit allow rules for required outbound destinations\n7. Delete the overly permissive default-allow rules after verifying applications function correctly\n\n**Pitfalls**: Deleting firewall rules without understanding traffic patterns causes outages. Always enable flow logs and analyze traffic before removing rules. Network tags can be added by anyone with compute.instances.setTags permission, making them less secure than service-account-based targeting for critical rules.\n\n## Output Format\n\n```\nGCP VPC Firewall Audit Report\n================================\nProject: production-project\nVPC Network: production-vpc\nAudit Date: 2026-02-23\n\nRULE INVENTORY:\n  Total firewall rules: 34\n  Ingress rules: 22\n  Egress rules: 12\n  Disabled rules: 3\n\nCRITICAL FINDINGS:\n[FW-001] SSH Open to Internet\n  Rule: default-allow-ssh\n  Source: 0.0.0.0\u002F0 -> tcp:22\n  Target: All instances (no tags)\n  Priority: 65534\n  Remediation: Restrict to bastion subnet CIDR\n\n[FW-002] No Egress Restrictions\n  Issue: Only implied allow-all-egress rule exists\n  Risk: No controls on outbound data exfiltration\n  Remediation: Add default-deny egress and explicit allow rules\n\nREMEDIATION ACTIONS COMPLETED:\n  Rules deleted: 3 (overly permissive defaults)\n  Rules created: 8 (targeted allow rules)\n  Egress deny rule: Created at priority 65534\n  Flow logs enabled: 6 subnets\n```\n","# Implementing GCP VPC Firewall Rules\n\n## When to Use\n\n- When deploying new GCP workloads that require network-level access controls\n- When auditing existing firewall configurations for overly permissive rules\n- When implementing zero trust network segmentation within GCP VPC networks\n- When responding to Security Command Center findings about open firewall rules\n- When building hierarchical firewall policies across a GCP organization\n\n**Do not use** for application-layer filtering (use Cloud Armor WAF), for DNS-based filtering (use Cloud DNS response policies), or for VPN\u002Finterconnect traffic filtering without understanding that VPC firewall rules apply to traffic within the VPC.\n\n## Prerequisites\n\n- GCP project with Compute Engine API enabled\n- IAM roles: `roles\u002Fcompute.securityAdmin` for firewall management, `roles\u002Fcompute.networkViewer` for auditing\n- Organization Admin role for hierarchical firewall policies\n- gcloud CLI authenticated with appropriate permissions\n- VPC Flow Logs enabled on target subnets for monitoring\n\n## Workflow\n\n### Step 1: Audit Existing Firewall Rules for Security Gaps\n\nEnumerate all firewall rules and identify overly permissive configurations.\n\n```bash\n# List all firewall rules in the project\ngcloud compute firewall-rules list \\\n  --format=\"table(name, network, direction, priority, allowed[].map().firewall_rule().list():label=ALLOWED, sourceRanges, targetTags)\"\n\n# Find rules allowing all traffic from 0.0.0.0\u002F0\ngcloud compute firewall-rules list \\\n  --filter=\"direction=INGRESS AND sourceRanges=0.0.0.0\u002F0\" \\\n  --format=\"table(name, network, allowed, priority, targetTags)\" \\\n  --sort-by=priority\n\n# Find rules allowing all protocols and ports\ngcloud compute firewall-rules list \\\n  --filter=\"direction=INGRESS AND allowed[].IPProtocol=all\" \\\n  --format=\"table(name, network, sourceRanges, targetTags)\"\n\n# Find rules with SSH (22) or RDP (3389) open to the internet\ngcloud compute firewall-rules list \\\n  --filter=\"direction=INGRESS AND sourceRanges=0.0.0.0\u002F0 AND (allowed[].ports=22 OR allowed[].ports=3389)\" \\\n  --format=\"table(name, network, allowed, sourceRanges)\"\n\n# Check for disabled rules\ngcloud compute firewall-rules list \\\n  --filter=\"disabled=true\" \\\n  --format=\"table(name, network, direction)\"\n```\n\n### Step 2: Create Restrictive Ingress Firewall Rules\n\nImplement least-privilege ingress rules using network tags and service accounts for targeting.\n\n```bash\n# Create rule allowing HTTPS from the internet to web servers only\ngcloud compute firewall-rules create allow-https-web \\\n  --network=production-vpc \\\n  --direction=INGRESS \\\n  --action=ALLOW \\\n  --rules=tcp:443 \\\n  --source-ranges=0.0.0.0\u002F0 \\\n  --target-tags=web-server \\\n  --priority=1000 \\\n  --description=\"Allow HTTPS to web servers from internet\"\n\n# Create rule allowing SSH only from bastion host subnet\ngcloud compute firewall-rules create allow-ssh-bastion \\\n  --network=production-vpc \\\n  --direction=INGRESS \\\n  --action=ALLOW \\\n  --rules=tcp:22 \\\n  --source-ranges=10.0.1.0\u002F24 \\\n  --target-tags=ssh-allowed \\\n  --priority=1000 \\\n  --description=\"Allow SSH only from bastion subnet\"\n\n# Create rule allowing internal communication between app tiers\ngcloud compute firewall-rules create allow-app-to-db \\\n  --network=production-vpc \\\n  --direction=INGRESS \\\n  --action=ALLOW \\\n  --rules=tcp:5432 \\\n  --source-tags=app-server \\\n  --target-tags=db-server \\\n  --priority=1000 \\\n  --description=\"Allow PostgreSQL from app tier to database tier\"\n\n# Create service-account-based rule (more secure than tags)\ngcloud compute firewall-rules create allow-api-internal \\\n  --network=production-vpc \\\n  --direction=INGRESS \\\n  --action=ALLOW \\\n  --rules=tcp:8080 \\\n  --source-service-accounts=api-client@project.iam.gserviceaccount.com \\\n  --target-service-accounts=api-server@project.iam.gserviceaccount.com \\\n  --priority=1000\n```\n\n### Step 3: Implement Egress Restrictions\n\nConfigure egress firewall rules to control outbound traffic and prevent data exfiltration.\n\n```bash\n# Deny all egress by default (low priority)\ngcloud compute firewall-rules create deny-all-egress \\\n  --network=production-vpc \\\n  --direction=EGRESS \\\n  --action=DENY \\\n  --rules=all \\\n  --destination-ranges=0.0.0.0\u002F0 \\\n  --priority=65534 \\\n  --description=\"Default deny all egress traffic\"\n\n# Allow egress to Google APIs via restricted VIP\ngcloud compute firewall-rules create allow-google-apis \\\n  --network=production-vpc \\\n  --direction=EGRESS \\\n  --action=ALLOW \\\n  --rules=tcp:443 \\\n  --destination-ranges=199.36.153.4\u002F30 \\\n  --priority=1000 \\\n  --description=\"Allow HTTPS to Google APIs restricted VIP\"\n\n# Allow DNS resolution\ngcloud compute firewall-rules create allow-dns-egress \\\n  --network=production-vpc \\\n  --direction=EGRESS \\\n  --action=ALLOW \\\n  --rules=udp:53,tcp:53 \\\n  --destination-ranges=169.254.169.254\u002F32,8.8.8.8\u002F32,8.8.4.4\u002F32 \\\n  --priority=1000 \\\n  --description=\"Allow DNS resolution to metadata and Google DNS\"\n\n# Allow egress to specific external services\ngcloud compute firewall-rules create allow-external-apis \\\n  --network=production-vpc \\\n  --direction=EGRESS \\\n  --action=ALLOW \\\n  --rules=tcp:443 \\\n  --destination-ranges=PARTNER_CIDR\u002F32 \\\n  --target-tags=api-client \\\n  --priority=1000\n```\n\n### Step 4: Deploy Hierarchical Firewall Policies\n\nCreate organization and folder-level firewall policies that apply across all projects.\n\n```bash\n# Create an organization-level firewall policy\ngcloud compute firewall-policies create \\\n  --organization=ORG_ID \\\n  --short-name=org-security-policy \\\n  --description=\"Organization-wide security firewall policy\"\n\n# Add rule to block known malicious IP ranges at org level\ngcloud compute firewall-policies rules create 100 \\\n  --firewall-policy=org-security-policy \\\n  --organization=ORG_ID \\\n  --direction=INGRESS \\\n  --action=deny \\\n  --src-ip-ranges=THREAT_INTEL_CIDR_1,THREAT_INTEL_CIDR_2 \\\n  --layer4-configs=all \\\n  --description=\"Block known malicious IPs organization-wide\"\n\n# Add rule to enforce HTTPS-only ingress at org level\ngcloud compute firewall-policies rules create 200 \\\n  --firewall-policy=org-security-policy \\\n  --organization=ORG_ID \\\n  --direction=INGRESS \\\n  --action=allow \\\n  --src-ip-ranges=0.0.0.0\u002F0 \\\n  --layer4-configs=tcp:443 \\\n  --description=\"Allow only HTTPS from external sources\"\n\n# Associate policy with the organization\ngcloud compute firewall-policies associations create \\\n  --firewall-policy=org-security-policy \\\n  --organization=ORG_ID\n```\n\n### Step 5: Enable VPC Flow Logs for Monitoring\n\nConfigure VPC Flow Logs to monitor traffic patterns and validate firewall rule effectiveness.\n\n```bash\n# Enable flow logs on a subnet\ngcloud compute networks subnets update production-subnet \\\n  --region=us-central1 \\\n  --enable-flow-logs \\\n  --logging-aggregation-interval=interval-5-sec \\\n  --logging-flow-sampling=1.0 \\\n  --logging-metadata=include-all\n\n# Query flow logs in Cloud Logging for denied traffic\ngcloud logging read '\n  resource.type=\"gce_subnetwork\"\n  AND jsonPayload.disposition=\"DENIED\"\n  AND timestamp>=\"2026-02-22T00:00:00Z\"\n' --limit=50 --format=json\n\n# Find traffic hitting overly permissive rules\ngcloud logging read '\n  resource.type=\"gce_subnetwork\"\n  AND jsonPayload.rule_details.reference:\"\u002Ffirewall-rules\u002Fdefault-allow-\"\n' --limit=100 --format=\"table(jsonPayload.connection.src_ip,jsonPayload.connection.dest_ip,jsonPayload.connection.dest_port)\"\n\n# Export flow logs to BigQuery for analysis\ngcloud logging sinks create vpc-flow-bq \\\n  bigquery.googleapis.com\u002Fprojects\u002FPROJECT\u002Fdatasets\u002Fvpc_flow_logs \\\n  --log-filter='resource.type=\"gce_subnetwork\"'\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| VPC Firewall Rule | Stateful network-level access control that allows or denies traffic to and from VM instances based on IP ranges, protocols, ports, and tags |\n| Hierarchical Firewall Policy | Organization or folder-level firewall policy that is evaluated before VPC-level rules and applies across all child projects |\n| Network Tag | Label applied to VM instances that determines which firewall rules apply, used for targeting ingress and egress rules |\n| Service Account Firewall Rule | Firewall rule that targets instances based on their attached service account, providing more secure targeting than mutable network tags |\n| VPC Flow Logs | Network telemetry captured at the subnet level that records traffic metadata for monitoring, forensics, and firewall rule validation |\n| Implied Rules | Default GCP firewall rules that allow egress to all destinations and deny ingress from all sources, with lowest priority (65535) |\n\n## Tools & Systems\n\n- **gcloud compute firewall-rules**: CLI commands for creating, listing, and managing VPC firewall rules in GCP\n- **Hierarchical Firewall Policies**: Organization and folder-level policies enforcing security controls across all projects\n- **VPC Flow Logs**: Subnet-level traffic logging for monitoring, troubleshooting, and validating firewall effectiveness\n- **Cloud Logging**: Query engine for analyzing VPC Flow Logs and firewall rule hit counts\n- **Security Command Center**: GCP-native security platform with findings for overly permissive firewall configurations\n\n## Common Scenarios\n\n### Scenario: Locking Down a Production VPC After Discovery of Overly Permissive Rules\n\n**Context**: A security audit reveals that the production VPC has default-allow rules permitting SSH from `0.0.0.0\u002F0` and unrestricted egress. SCC reports 14 firewall findings.\n\n**Approach**:\n1. Enumerate all existing rules with `gcloud compute firewall-rules list` and categorize by risk\n2. Enable VPC Flow Logs on all subnets to capture baseline traffic patterns for 7 days\n3. Analyze flow logs to identify legitimate traffic that needs explicit allow rules\n4. Create targeted ingress rules for each application tier (web: 443, app: 8080, db: 5432)\n5. Replace the SSH-from-anywhere rule with SSH-from-bastion-subnet-only\n6. Implement default-deny egress and add explicit allow rules for required outbound destinations\n7. Delete the overly permissive default-allow rules after verifying applications function correctly\n\n**Pitfalls**: Deleting firewall rules without understanding traffic patterns causes outages. Always enable flow logs and analyze traffic before removing rules. Network tags can be added by anyone with compute.instances.setTags permission, making them less secure than service-account-based targeting for critical rules.\n\n## Output Format\n\n```\nGCP VPC Firewall Audit Report\n================================\nProject: production-project\nVPC Network: production-vpc\nAudit Date: 2026-02-23\n\nRULE INVENTORY:\n  Total firewall rules: 34\n  Ingress rules: 22\n  Egress rules: 12\n  Disabled rules: 3\n\nCRITICAL FINDINGS:\n[FW-001] SSH Open to Internet\n  Rule: default-allow-ssh\n  Source: 0.0.0.0\u002F0 -> tcp:22\n  Target: All instances (no tags)\n  Priority: 65534\n  Remediation: Restrict to bastion subnet CIDR\n\n[FW-002] No Egress Restrictions\n  Issue: Only implied allow-all-egress rule exists\n  Risk: No controls on outbound data exfiltration\n  Remediation: Add default-deny egress and explicit allow rules\n\nREMEDIATION ACTIONS COMPLETED:\n  Rules deleted: 3 (overly permissive defaults)\n  Rules created: 8 (targeted allow rules)\n  Egress deny rule: Created at priority 65534\n  Flow logs enabled: 6 subnets\n```\n",{"name":5,"tags":44,"capec":46,"model":47,"tools":48,"domain":31,"maxTurns":52,"nist_csf":53,"subdomain":24,"description":7,"mitre_attack":58},[24,19,38,37,45,36],"network-security",[],"sonnet",[49,30,50,51],"Read","Glob","Grep",20,[54,55,56,57],"PR.IR-01","ID.AM-08","GV.SC-06","DE.CM-01",[59,60],"T1078.004","T1562.004","main","a91f1293287ffa9f4f1b8f486cd6e835a1568c84","skills\u002Fnetwork\u002Ffirewall\u002Fgcp\u002Fexploit","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace","https:\u002F\u002Fgithub.com\u002FDCx7C5","#Python","2026-09-01 11:21:00",{"source":8,"skillName":5,"commands":69,"prompt":79,"zipAvailable":80},[70,73,76],{"tool":71,"command":72},"npx","npx skills add DCx7C5\u002Fai-marketplace --skill firewall-gcp-exploit",{"tool":74,"command":75},"bunx","bunx skills add DCx7C5\u002Fai-marketplace --skill firewall-gcp-exploit",{"tool":77,"command":78},"pnpm","pnpm dlx skills add DCx7C5\u002Fai-marketplace --skill firewall-gcp-exploit","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fnetwork\u002Ffirewall\u002Fgcp\u002Fexploit\u002FSKILL.md",true,[82],{"path":83,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":86,"sourceHtmlUrl":87},"index.json","REFERENCE","参考文档",675,"https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fnetwork\u002Ffirewall\u002Fgcp\u002Fexploit\u002Findex.json",[89,112,130,151,173,189],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":39},"01M71HAPZ01KQ30RKTB0FFSQ05","services-wmi-persistence-detect","Detect WMI event subscription persistence by enumerating ActiveScriptEventConsumer, CommandLineEventConsumer, and permanent subscriptions in the WMI repository.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fservices\u002Fwmi\u002Fpersistence\u002Fdetect\u002FSKILL.md",[],[96,97,98,99,100,26,35,101,102,103,104,105,106,107,108,109,110,31,111],"services","detect","services wmi persistence detect","wmi","persistence","process","activescript","event","subscriptions","commandline-consumer","repository","subscription","event-subscription","t1546.003","forensics","process-forensics",{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":39},"01M71HAK6JTTTS229T17WJMMCG","services-wmi-exec-exploit","Perform lateral movement across Windows networks using WMI-based remote execution techniques including Impacket wmiexec.py, CrackMapExec, and native WMI commands for stealthy post-exploitation during red team engagements.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fservices\u002Fwmi\u002Fexec\u002Fexploit\u002FSKILL.md",[],[20,96,119,99,120,121,32,31,30,122,123,28,124,125,26,126,127,23,128,129],"services wmi exec exploit","exec","remote","analysis","team","crackmapexec","native","command","lateral movement","lateral-movement","Impacket",{"skillNo":131,"name":132,"nameZh":6,"description":133,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":134,"categories":135,"keywords":136,"publishedAt":39},"01M71HAG6MHKNQV8KDZKMT4886","registry-artifact-extract","Extract and analyze Windows Registry hives to uncover user activity, installed software, autostart entries, and evidence of system compromise.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fregistry\u002Fartifact\u002Fextract\u002FSKILL.md",[],[137,138,139,140,141,142,31,30,143,122,144,145,26,23,146,147,148,149,150,47],"artifact","registry","registry artifact extract","extract","evidence-collection","artifact-analysis","collection","analyze","uncover","software","activity","digital-forensics","windows-registry","regripper",{"skillNo":152,"name":153,"nameZh":6,"description":154,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":157,"publishedAt":39},"01M71HACR4A8XTWTTSXK4124AA","processes-token-impersonate-detect","Detect Windows token impersonation and privilege abuse including SeImpersonatePrivilege exploitation via Potato attacks and token stealing techniques.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fprocesses\u002Ftoken\u002Fimpersonate\u002Fdetect\u002FSKILL.md",[],[97,158,159,160,161,162,163,35,164,31,111,165,166,167,168,169,170,171,172,26],"processes token impersonate detect","token","processes","attacks","windows","escalation","techniques","privilege-escalation","seimpersonate","token-impersonation","printspoofer","exploitation","potato","impersonation","via",{"skillNo":174,"name":175,"nameZh":6,"description":176,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":177,"categories":178,"keywords":179,"publishedAt":39},"01M71HAABSB4Z6QFSXEG00R4RK","processes-thread-injection-detect","Detect Windows thread injection techniques including CreateRemoteThread, QueueUserAPC, NtCreateThreadEx, and thread hijacking via process memory analysis.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fprocesses\u002Fthread\u002Finjection\u002Fdetect\u002FSKILL.md",[],[180,181,97,182,160,162,183,35,184,164,31,111,122,185,186,187,188,172,26,101],"thread","processes thread injection detect","injection","memory","process-injection","api","apc-injection","thread-injection","nt-api",{"skillNo":190,"name":191,"nameZh":6,"description":192,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":193,"categories":194,"keywords":195,"publishedAt":39},"01M71HA7H311V5G14WMX58HQSS","processes-hollow-technique-detect","Detect process hollowing (RunPE) by identifying processes with mismatched image paths between PEB and VAD tree, or unmapped PE headers in memory.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fprocesses\u002Fhollow\u002Ftechnique\u002Fdetect\u002FSKILL.md",[],[196,97,160,197,183,35,198,199,31,111,200,201,202,203,204,205,26,101,206,207],"processes hollow technique detect","tree","memory-forensics","process-hollow","peb","runpe","image","pe-header","in memory","with","mismatched","headers"]