Skip to content

Commit

Permalink
Fix GitLab healthcheck script false positive (chainguard-dev#364)
Browse files Browse the repository at this point in the history
Signed-off-by: egibs <[email protected]>
  • Loading branch information
egibs authored Jul 15, 2024
1 parent 003d03a commit d70cd9a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rules/shell/bash_dev_tcp.yara
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ rule bash_dev_tcp_hardcoded_ip : critical {
meta:
description = "hardcoded /dev/tcp host:port"
strings:
$dev_tcp = /\/dev\/tcp\/[\w\.]{8,16}\/\d{1,6}/
$dev_tcp = /\/dev\/tcp\/[\w\.]{8,16}\/\d{1,6}/
$not_comment = "# Check that both our processes are running on their tcp port"
$not_get = "GET / HTTP/1.1 >"
$not_localhost_8080 = "/dev/tcp/127.0.0.1/8080"
condition:
$dev_tcp
$dev_tcp and none of ($not_*)
}
6 changes: 6 additions & 0 deletions samples/Linux/clean/healthcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -e

# Check that both our processes are running on their tcp port
printf "GET / HTTP/1.1\n\n" > /dev/tcp/127.0.0.1/8080
5 changes: 5 additions & 0 deletions samples/Linux/clean/healthcheck.simple
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Linux/clean/healthcheck
net/http/request
ref/path/dev
shell/bash_dev_tcp
shell/exec

0 comments on commit d70cd9a

Please sign in to comment.