Skip to content

Commit

Permalink
More /dev/tcp rule tweaks for GitLab healthcheck script (chainguard-d…
Browse files Browse the repository at this point in the history
…ev#372)

* More /dev/tcp rule tweaks for GitLab healthcheck script

Signed-off-by: egibs <[email protected]>

* Refresh test data

Signed-off-by: egibs <[email protected]>

---------

Signed-off-by: egibs <[email protected]>
  • Loading branch information
egibs authored Jul 19, 2024
1 parent 47737ba commit a038cc6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 6 additions & 3 deletions rules/shell/bash_dev_tcp.yara
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ rule bash_dev_tcp : high exfil {
strings:
$ref = "/dev/tcp"
$posixly_correct = "POSIXLY_CORRECT"
$not_comment = "# Check that both our processes are running on their tcp port"
$not_get = /GET \/ HTTP\/1.1\n{1,2} >/
$not_localhost_8080 = "/dev/tcp/127.0.0.1/8080"
condition:
$ref and not $posixly_correct
$ref and not $posixly_correct and none of ($not*)
}


Expand All @@ -19,8 +22,8 @@ rule bash_dev_tcp_hardcoded_ip : critical {
strings:
$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_get = /GET \/ HTTP\/1.1\n{1,2} >/
$not_localhost_8080 = "/dev/tcp/127.0.0.1/8080"
condition:
$dev_tcp and none of ($not_*)
$dev_tcp and none of ($not*)
}
1 change: 0 additions & 1 deletion samples/Linux/clean/healthcheck.simple
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Linux/clean/healthcheck
net/http/request
ref/path/dev
shell/bash_dev_tcp
shell/exec

0 comments on commit a038cc6

Please sign in to comment.