Testing BlueRock Container Drift Alerts

One of the pre-configured policies included in the BlueRock Free Tier enables Container Drift Protection.

This mechanism is used to see, alert and block attacks which attempt to deposit and execute binaries or scripts that were not present in the original container image.

Testing Container Drift Protection

The steps below are used to trigger a container drift violation, generating alerts that will delivered to your CloudWatch service.

Step 1: Create a new 'container_drift' tool for the Weather MCP server & client.

Step 2: Run the updated Weather MCP server and client.

Step 3: Execute the new container_drift tool.

Step 4: View container_drift_violation alerts in CloudWatch

Step 1: Create a new 'container_drift' tool for the Weather MCP server

Login to your BlueRock Free Tier EC2 instance.

ssh -i <ssh-key-file> ec2-user@<ip-address>

Create new server with 'container_drift' tool

Create a file named: /opt/bluerock/mcp/weatherMCP/server-weatherMCP.container_drift.py with the source code below.

Create a Weather MCP client with the following source code.

Create a file named: /opt/bluerock/mcp/weatherMCP/client-weatherMCP.container_drift.py with the source code below.

Step 3: Execute the container_drift tool

Run the new server

In one terminal window, log into your BlueRock Free Tier EC2 instance and start the new server with the container_drift tool.

Run the new client

In a separate terminal window, log into your BlueRock Free Tier EC2 instance and start the new client with the container_drift tool.

The client will initialize, show the available tools and start its interactive CLI.

Run the container_drift tool.

This tool will perform three tests, each of which will trigger a container drift violation alert.

  • TEST 1: Execute a file that was not present in the container image.

  • TEST 2: Execute a script via a command line interpreter option.

  • TEST 3: Execute a script not present in the container image.

Step 4: View container drift violation logs

Log into your AWS console and open up CloudWatch:

  • <YOUR_AWS_REGION>

  • <YOUR_LOG_GROUP>

  • <YOUR_LOG_STREAM>

In the filter, type 'container_drift_violation'.

Last updated