This example demonstrates how to automatically close GuardDuty Execution:Runtime/NewBinaryExecuted findings for GitHub Actions runners. This is a common pattern for CI/CD environments where runners regularly execute newly created binaries as part of the build process.
When using GitHub Actions runners (self-hosted or ephemeral), GuardDuty Runtime Monitoring generates NewBinaryExecuted findings when containers or EC2 instances execute newly created binaries. This is expected behavior for CI/CD workflows but creates noise in Security Hub.
For example:
- Build tools creating and executing compiled binaries
- Package managers downloading and running install scripts
- Test runners executing newly built test binaries
- Deployment tools creating temporary executables
Use an auto-close rule that:
- Matches the specific finding type (
Execution:Runtime/NewBinaryExecuted) - Filters by resource tags (e.g.,
component-type=github-action-runners) - Automatically suppresses the finding
- Skips Slack notifications (since it's not a security issue)
export APP_AUTO_CLOSE_RULES='[
{
"name": "auto-close-github-runner-new-binaries",
"enabled": true,
"filters": {
"finding_types": [
"Execution:Runtime/NewBinaryExecuted"
],
"resource_tags": [
{
"name": "component-type",
"value": "github-action-runners"
}
]
},
"action": {
"status_id": 5,
"comment": "Auto-closed: Expected behavior for GitHub Actions CI/CD runners"
},
"skip_notification": true
}
]'For better readability in the AWS Console, you can format it on a single line:
{"name":"auto-close-github-runner-new-binaries","enabled":true,"filters":{"finding_types":["Execution:Runtime/NewBinaryExecuted"],"resource_tags":[{"name":"component-type","value":"github-action-runners"}]},"action":{"status_id":5,"comment":"Auto-closed: Expected behavior for GitHub Actions CI/CD runners"},"skip_notification":true}
Then wrap it in an array:
[{...}]
Add this inline policy to your Lambda execution role:
When GuardDuty Runtime Monitoring detects a newly created binary being executed, Security Hub receives the finding and EventBridge triggers your Lambda:
{
"source": "aws.securityhub",
"detail-type": "Findings Imported V2",
"detail": {
"findings": [{
"finding_info": {
"title": "A container has executed a newly created binary file.",
"types": [
"Threats",
"Execution:Runtime/NewBinaryExecuted"
]
},
"resources": [{
"tags": [
{"name": "component-type", "value": "github-action-runners"},
{"name": "ghr:Application", "value": "github-action-runner"},
// ...
]
}],
"evidences": [{
"actor": {
"process": {
"name": "kubectl",
"path": "/opt/actions-runner/_work/_tool/kind/v0.22.0/amd64/kubectl/bin/kubectl"
}
}
}]
}]
}
}The bot:
- Parses the OCSF finding
- Checks if finding type matches:
Execution:Runtime/NewBinaryExecuted✓ - Searches resources for tag:
component-type=github-action-runners✓ - Rule matches!
The bot calls BatchUpdateFindingsV2:
input := &securityhub.BatchUpdateFindingsV2Input{
MetadataUids: []string{"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"},
StatusId: aws.Int32(5), // SUPPRESSED
Comment: aws.String("Auto-closed: Expected behavior for GitHub Actions CI/CD runners"),
}Since skip_notification: true, no Slack message is sent.
- Finding status:
New→Suppressed - Finding comment: "Auto-closed: Expected behavior for GitHub Actions CI/CD runners"
- Slack: No notification
- CloudWatch Logs:
auto-closed finding ... using rule 'auto-close-github-runner-new-binaries'
See fixtures/samples.json (1st finding) for the exact OCSF structure that matches this rule. The finding includes:
- Process ancestry showing GitHub Actions runner chain
- File hash of executed binary (SHA-256)
- EC2 instance details with runner tags
- Network interface information
Keep Slack notifications enabled for visibility:
{
"name": "auto-close-github-runner-new-binaries",
"enabled": true,
"filters": {
// ...
},
"action": {
// ...
},
"skip_notification": false // changed from true
}Use broader tag patterns to match different runner deployments:
{
"name": "auto-close-all-ci-runner-binaries",
"enabled": true,
"filters": {
"finding_types": [
"Execution:Runtime/NewBinaryExecuted"
],
"resource_tags": [
{
"name": "environment",
"value": "ci"
}
]
},
"action": {
"status_id": 5,
"comment": "Auto-closed: Expected behavior for CI/CD environment"
},
"skip_notification": true
}Auto-close findings in dedicated CI/CD accounts:
{
"name": "auto-close-ci-account-new-binaries",
"enabled": true,
"filters": {
"finding_types": [
"Execution:Runtime/NewBinaryExecuted"
],
"accounts": [
"123456789012"
]
},
"action": {
"status_id": 5,
"comment": "Auto-closed: Expected behavior in CI/CD account"
},
"skip_notification": true
}{
"action": {
"status_id": 3, // RESOLVED instead of SUPPRESSED
"comment": "Auto-resolved: Known safe behavior for GitHub Actions runners"
}
}Look for these log messages:
Rule matched:
processing finding: eeeeeeee... (status: New, severity: Medium)
finding matched rule: auto-close-github-runner-new-binaries
auto-closed finding eeeeeeee... using rule 'auto-close-github-runner-new-binaries'
Rule not matched:
processing finding: abc123... (status: New, severity: High)
(No "matched rule" message - finding proceeds to normal notification)
- Navigate to Security Hub v2 → Threats
- Search for finding type:
Execution:Runtime/NewBinaryExecuted - Find the specific instance finding and check "Finding history" tab
- Should see update with:
- Status: New → Suppressed
- Comment: "Auto-closed: Expected behavior for GitHub Actions CI/CD runners"
- Updated by: aws-securityhubv2-bot
Combine multiple CI/CD-related auto-close rules:
[
{
"name": "auto-close-github-runner-new-binaries",
"enabled": true,
"filters": {
"finding_types": ["Execution:Runtime/NewBinaryExecuted"],
"resource_tags": [{"name": "component-type", "value": "github-action-runners"}]
},
"action": {
"status_id": 5,
"comment": "Auto-closed: Expected behavior for GitHub Actions CI/CD runners"
},
"skip_notification": true
},
{
"name": "auto-close-github-runner-docker-commands",
"enabled": true,
"filters": {
"finding_types": ["Execution:Runtime/DockerCommandWithUnknownArgs"],
"resource_tags": [{"name": "component-type", "value": "github-action-runners"}]
},
"action": {
"status_id": 5,
"comment": "Auto-closed: Expected Docker behavior in CI/CD runners"
},
"skip_notification": true
},
{
"name": "auto-close-build-environment-network-activity",
"enabled": true,
"filters": {
"finding_types": ["UnauthorizedAccess:EC2/MaliciousIPCaller"],
"resource_tags": [{"name": "environment", "value": "ci"}]
},
"action": {
"status_id": 5,
"comment": "Auto-closed: Known build dependency sources in CI environment"
},
"skip_notification": false
}
]Note: Rules are evaluated in order. The first matching rule wins.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowAutoCloseFindings", "Effect": "Allow", "Action": [ "securityhub:BatchUpdateFindingsV2" ], "Resource": "*" } ] }