Blocking SQL Injection (SQLi) Using GCP Cloud Armor

45 minutes
  • 5 Learning Objectives

About this Hands-on Lab

A critical step in securing a web app is to block injection attacks, like SQL injection (SQLi), from modifying or accessing the app’s SQL database. In this hands-on lab, you’ll use the Cloud Armor and Cloud Load Balancing services to block SQLi attacks against a vulnerable web app.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Configure Cloud Load Balancing HTTP(S) Settings
  1. Use the Cloud Load Balancing service to create an internet-facing and global (non-classic) HTTP(S) load balancer.
  2. Name the load balancer lb.
  3. Create a frontend service named frontend.
  4. Create a backend service named backend.
  5. Configure the backends of the new backend service to use the recently created instance group.
  6. Create a health check named hc, and set the check interval to 25 seconds and the timeout to 20 seconds.
Create a Cloud Armor Policy to Block SQLi
  1. Create a Cloud Armor security policy named cap with a default rule action of Allow.
  2. Create a rule named SQLi that uses the preconfigured expression for sqli-v33-stable, and set its priority to 1.
  3. Set the target to the recently created backend load balancer.
Enable Container Registry

Enable the Container Registry service using the GCP console.

Docker Pull, Tag, and Push the Container Image Using Cloud Shell

Use the Cloud Shell to perform the following actions:

  1. Pull the DVWA Docker image.
  2. Tag the DVWA Docker image.
  3. Push the DVWA Docker image.
Create an Instance Group
  1. Create an instance group using the GCP console.
  2. Create a new instance template based on the container pushed to the Container Registry.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?