The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
Address Cursor Bugbot review on threat-rules pack
Souvik Banerjee8a7fca787766
diff --git a/rules/credential-access/browser-session-store-read.rule.yaml b/rules/credential-access/browser-session-store-read.rule.yamlindex a6d5a123..53235a7a 100644--- a/rules/credential-access/browser-session-store-read.rule.yaml+++ b/rules/credential-access/browser-session-store-read.rule.yaml@@ -1,10 +1,14 @@id: browser-session-store-read-version: 1+version: 2title: Agent read a browser session/cookie storedescription: >- The agent read a browser cookie jar or saved-login store (Cookies / cookies.sqlite- / logins.json / "Login Data"). These carry live session material that can hijack a- SaaS session past password + MFA. Ported from blastradius `is_browser_session_path`.+ The agent read a browser cookie jar or saved-login store (cookies.sqlite /+ logins.json by name, or the ambiguous basenames Cookies / "Login Data" only inside a+ known browser profile directory — Chrome/Chromium/Brave/Edge/Firefox/Safari). These+ carry live session material that can hijack a SaaS session past password + MFA. The+ browser-dir requirement keeps a non-browser file named "cookies" from firing, and+ matches the read step of the browser-session-read-then-egress correlation. Ported+ from blastradius is_browser_session_path.severity: highstatus: stableposture: detect@@ -13,8 +17,10 @@ taxonomy:mitre_atlas: AML.T0024match: >- e.event.action == "file.read" &&- e.file.path.matches("(?i)(^|/)(cookies\\.sqlite|logins\\.json|cookies|login data)$")+ e.event.action == "file.read" && (+ e.file.path.matches("(?i)(^|/)(cookies\\.sqlite|logins\\.json)$") ||+ e.file.path.matches("(?i)/(google-chrome|chromium|chrome|brave[ -]?browser|bravesoftware|microsoft-?edge|edge|firefox|mozilla|safari)/.*(cookies|login data)$")+ )emit:reason: "Agent read a browser session/cookie store (session-hijack material)"@@ -32,9 +38,27 @@ tests:- event: { action: file.read }file: { path: "/home/u/.config/google-chrome/Default/Login Data" }session: { id: s1 }+ - name: read_chrome_bare_cookies+ verdict: match+ events:+ - event: { action: file.read }+ file: { path: "/home/u/.config/google-chrome/Default/Cookies" }+ session: { id: s1 }+ - name: read_brave_cookies+ verdict: match+ events:+ - event: { action: file.read }+ file: { path: "/home/u/.config/BraveSoftware/Brave-Browser/Default/Cookies" }+ session: { id: s1 }- name: source_file_named_cookiesverdict: no_matchevents:- event: { action: file.read }file: { path: "src/cookies.test.ts" }session: { id: s1 }+ - name: non_browser_cookies_file+ verdict: no_match+ events:+ - event: { action: file.read }+ file: { path: "recipes/cookies" }+ session: { id: s1 }diff --git a/rules/risky-command/privileged-container-run.rule.yaml b/rules/risky-command/privileged-container-run.rule.yamlindex eb4d941c..4f93a9a0 100644--- a/rules/risky-command/privileged-container-run.rule.yaml+++ b/rules/risky-command/privileged-container-run.rule.yaml@@ -1,8 +1,9 @@id: privileged-container-run-version: 3+version: 4title: Container started with host-escaping privilegesdescription: >- A docker/podman run or exec grants container-escape primitives — --privileged,+ A docker/podman run or exec — including Compose v2 (`docker compose run`) and the+ legacy `docker-compose` binary — grants container-escape primitives: --privileged,host namespace sharing (--pid/--net/--network/--ipc/--uts host), a root-filesystembind mount (-v /:...), a kernel capability add (--cap-add), or a mount of the dockersocket. The docker/podman token is anchored to command/segment start (allowing a@@ -17,7 +18,7 @@ taxonomy:match: >e.event.action == "command.executed" &&- e.command.command.matches("(?i)(^|;|&&|\\|\\|)\\s*(sudo(\\s+-\\S+)*\\s+|env\\s+|([A-Za-z_][A-Za-z0-9_]*=\\S*\\s+)+)*(docker|podman)\\s+(container\\s+)?(run|exec)\\b") &&+ e.command.command.matches("(?i)(^|;|&&|\\|\\|)\\s*(sudo(\\s+-\\S+)*\\s+|env\\s+|([A-Za-z_][A-Za-z0-9_]*=\\S*\\s+)+)*(docker|podman)(-compose)?\\s+(container\\s+|compose\\s+)?(run|exec)\\b") &&e.command.command.matches("(?i)(--privileged|--(pid|net|network|ipc|uts)[= ]host|-v\\s+/:|--volume\\s+/:|--cap-add[= ]|/var/run/docker\\.sock\\b)")emit:@@ -36,6 +37,18 @@ tests:- event: { action: command.executed }command: { command: "docker container run --privileged ubuntu" }session: { id: s1 }+ - name: docker_compose_run_privileged+ verdict: match+ events:+ - event: { action: command.executed }+ command: { command: "docker compose run --privileged web" }+ session: { id: s1 }+ - name: docker_compose_legacy_binary+ verdict: match+ events:+ - event: { action: command.executed }+ command: { command: "docker-compose run --privileged web" }+ session: { id: s1 }- name: podman_run_host_pidverdict: matchevents:diff --git a/rules/risky-command/world-writable-chmod.rule.yaml b/rules/risky-command/world-writable-chmod.rule.yamlindex f1926028..051c0b6f 100644--- a/rules/risky-command/world-writable-chmod.rule.yaml+++ b/rules/risky-command/world-writable-chmod.rule.yaml@@ -1,12 +1,13 @@id: world-writable-chmod-version: 2+version: 3title: chmod grants world-writable or full permissionsdescription: >- A command makes a file or tree world-writable / fully permissive (chmod 777 / 0777,- or a symbolic mode that grants write to other/all). A common step for planting an- executable others can tamper with or for loosening a sensitive file. Ported from- blastradius DangerousCategory::WorldWritableChmod; chmod is anchored to the acting- command position so it is not matched as an argument to another program.+ A command makes a file or tree world-writable — chmod 777 / 0777, or a symbolic mode+ (via + or =) that grants write to other or all (e.g. o+w, a+rwx, a=rwx, o=rwx,+ ugo+rwx). Owner- or group-only grants (u+w, g=rw) are intentionally excluded because+ they are not world-writable. chmod is anchored to the acting command position so it+ is not matched as an argument to another program. Ported from blastradius+ DangerousCategory::WorldWritableChmod, broadened to the = symbolic form.severity: mediumstatus: stableposture: detect@@ -15,7 +16,7 @@ taxonomy:match: >e.event.action == "command.executed" &&- e.command.command.matches("(?i)(^|[;&|]\\s*)chmod\\s+([^;&|]*\\s)?(0?777\\b|[ugoa]*\\+[rwx]*w[rwx]*\\b)")+ e.command.command.matches("(?i)(^|[;&|]\\s*)chmod\\s+([^;&|]*\\s)?(0?777\\b|([ugoa]*[oa][ugoa]*)[+=][rwx]*w[rwx]*\\b)")emit:reason: "chmod grants world-writable or fully permissive access"@@ -45,6 +46,18 @@ tests:- event: { action: command.executed }command: { command: "chmod o+w /etc/app/config" }session: { id: s1 }+ - name: chmod_a_equals_rwx+ verdict: match+ events:+ - event: { action: command.executed }+ command: { command: "chmod a=rwx /srv/app" }+ session: { id: s1 }+ - name: chmod_o_equals_rwx+ verdict: match+ events:+ - event: { action: command.executed }+ command: { command: "chmod o=rwx /srv/app/file" }+ session: { id: s1 }- name: chmod_after_cd_separatorverdict: matchevents:@@ -63,6 +76,18 @@ tests:- event: { action: command.executed }command: { command: "chmod o+r /etc/hosts" }session: { id: s1 }+ - name: chmod_owner_write_only+ verdict: no_match+ events:+ - event: { action: command.executed }+ command: { command: "chmod u+w src/main.go" }+ session: { id: s1 }+ - name: chmod_group_write_only+ verdict: no_match+ events:+ - event: { action: command.executed }+ command: { command: "chmod g=rw shared.log" }+ session: { id: s1 }- name: chmod_restrictive_modeverdict: no_matchevents:diff --git a/rules/sensitive-edit/auth-security-code-modified.rule.yaml b/rules/sensitive-edit/auth-security-code-modified.rule.yamlindex 13842b53..3401fbfc 100644--- a/rules/sensitive-edit/auth-security-code-modified.rule.yaml+++ b/rules/sensitive-edit/auth-security-code-modified.rule.yaml@@ -1,14 +1,17 @@id: auth-security-code-modified-version: 3+version: 4title: Authentication, payment, or security source modifieddescription: >The agent modified a source file in the auth / payment / security surface (basenamecontaining auth, login, session, password, payment, billing, charge, stripe, checkout,- security, crypto, token, oauth, jwt, rbac, acl, permission, credential). Changes here- carry outsized risk and warrant review. Ported from blastradius+ security, crypto, token, oauth, jwt, rbac, permission, credential). Changes here carry+ outsized risk and warrant review. Ported from blastradiusis_auth_payment_security_path; documentation (.md/.txt), lockfiles, CI workflowmanifests, and credential stores (credentials.json/.toml — covered by- credential-file-read) are excluded so they are not double-counted.+ credential-file-read) are excluded so they are not double-counted. Keyword matching+ is substring-based (faithful to the ported source), so a basename that embeds a+ keyword (e.g. tokenizer) may match; the 3-char `acl` needle was dropped because it+ false-matched unrelated words (oracle, miracle).severity: mediumstatus: stableposture: detect@@ -17,7 +20,7 @@ taxonomy:match: >e.event.action == "file.modified" &&- e.file.path.matches("(?i)[^/]*(auth|login|session|password|passwd|credential|payment|billing|charge|stripe|checkout|security|crypto|token|oauth|jwt|rbac|acl|permission)[^/]*\\.[a-z0-9]+$") &&+ e.file.path.matches("(?i)[^/]*(auth|login|session|password|passwd|credential|payment|billing|charge|stripe|checkout|security|crypto|token|oauth|jwt|rbac|permission)[^/]*\\.[a-z0-9]+$") &&!e.file.path.matches("(?i)\\.(md|txt|lock)$") &&!e.file.path.matches("(?i)\\.github/workflows/[^/]*\\.ya?ml$") &&!e.file.path.matches("(?i)(^|/)credentials\\.(json|toml)$")@@ -74,6 +77,12 @@ tests:- event: { action: file.modified }file: { path: "src/auth/index.ts" }session: { id: s1 }+ - name: oracle_not_acl_false_match+ verdict: no_match+ events:+ - event: { action: file.modified }+ file: { path: "src/db/oracle.go" }+ session: { id: s1 }- name: ordinary_source_editverdict: no_matchevents:diff --git a/rules/source-control/git-remote-tampering.rule.yaml b/rules/source-control/git-remote-tampering.rule.yamlindex ba894fe3..8e5f889f 100644--- a/rules/source-control/git-remote-tampering.rule.yaml+++ b/rules/source-control/git-remote-tampering.rule.yaml@@ -1,14 +1,14 @@id: git-remote-tampering-version: 3+version: 4title: Git remote repointed or force-push to remotedescription: >A command repoints a git remote (remote set-url / remote add, or the config-keyform remote.<name>.url set to a value), force-pushes (--force / --force-with-lease /-f / a leading + refspec), or installs an insteadOf URL rewrite — ways to redirect- code to an attacker-controlled destination or overwrite remote history. git is- anchored to a command boundary and each clause is kept within one command segment so- a benign mention or a read-only `git config --get` does not fire. Ported from- blastradius is_git_write_shape (source_control_mutation_path).+ code to an attacker-controlled destination or overwrite remote history. Every clause+ is git-anchored to a command boundary and kept within one command segment, so a+ benign mention, a `grep insteadOf`, or a read-only `git config --get` does not fire.+ Ported from blastradius is_git_write_shape (source_control_mutation_path).severity: highstatus: stableposture: detect@@ -20,7 +20,7 @@ match: >e.command.command.matches("(?i)(^|[;&|]\\s*)git\\b[^;&|]*\\bremote\\b\\s+(set-url|add)\\b") ||e.command.command.matches("(?i)(^|[;&|]\\s*)git\\b[^;&|]*\\bconfig\\b[^;&|]*\\bremote\\.[^ ]+\\.url\\b\\s+\\S") ||e.command.command.matches("(?i)(^|[;&|]\\s*)git\\b[^;&|]*\\bpush\\b[^;&|]*(\\s--force(-with-lease)?\\b|\\s-f\\b|\\s\\+)") ||- e.command.command.matches("(?i)\\binsteadof\\b")+ e.command.command.matches("(?i)(^|[;&|]\\s*)git\\b[^;&|]*\\binsteadof\\b"))emit:@@ -57,6 +57,12 @@ tests:- event: { action: command.executed }command: { command: "git config remote.origin.url https://attacker.example/x.git" }session: { id: s1 }+ - name: instead_of_rewrite+ verdict: match+ events:+ - event: { action: command.executed }+ command: { command: "git config url.https://attacker.example/.insteadOf https://github.com/" }+ session: { id: s1 }- name: ordinary_pushverdict: no_matchevents:@@ -81,3 +87,9 @@ tests:- event: { action: command.executed }command: { command: "echo git remote set-url is dangerous" }session: { id: s1 }+ - name: grep_insteadof_docs+ verdict: no_match+ events:+ - event: { action: command.executed }+ command: { command: "man git-config | grep insteadOf" }+ session: { id: s1 }