@profullstack/threatcrush 0.13.50 → 0.13.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/daemon.js +141 -0
- package/dist/daemon.js.map +1 -1
- package/dist/index.js +469 -243
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
---
|
|
44
44
|
|
|
45
|
-
ThreatCrush is a security daemon that runs on your server, **reading your logs and watching inbound connections** for live attacks. It checks every nginx request against 96 OWASP CRS rules (paranoia level 1) +
|
|
45
|
+
ThreatCrush is a security daemon that runs on your server, **reading your logs and watching inbound connections** for live attacks. It checks every nginx request against 96 OWASP CRS rules (paranoia level 1) + 4 ThreatCrush rules with CRS anomaly scoring, runs 18 detection rules over auth, web and network events, auto-bans attackers, scans your codebase, spot-checks your URLs, and alerts you in real-time.
|
|
46
46
|
|
|
47
47
|
```
|
|
48
48
|
$ threatcrush monitor
|
|
@@ -137,7 +137,7 @@ threatcrush store publish https://github.com/you/my-module # Publish your own
|
|
|
137
137
|
|
|
138
138
|
| Component | What it covers |
|
|
139
139
|
|-----------|----------------|
|
|
140
|
-
| `log-watcher` | nginx access log + syslog — 96 OWASP CRS rules (PL1: SQLi, XSS, path traversal, RFI, RCE, PHP/Java injection, SSRF, scanners) +
|
|
140
|
+
| `log-watcher` | nginx access log + syslog — 96 OWASP CRS rules (PL1: SQLi, XSS, path traversal, RFI, RCE, PHP/Java injection, SSRF, scanners) + 4 ThreatCrush rules (OS files in the path; PHPUnit, ThinkPHP and XWiki RCE probes) scored on every request |
|
|
141
141
|
| `ssh-guard` | auth.log / secure — failed logins, brute force, root logins, user enumeration |
|
|
142
142
|
| `user-journal` | journald — the systemd journal |
|
|
143
143
|
| `network-monitor` | Inbound connections to your listening ports — port scans, SYN floods |
|
package/dist/daemon.js
CHANGED
|
@@ -8559,6 +8559,74 @@ var THREATCRUSH_RULES = [
|
|
|
8559
8559
|
"flags": "i",
|
|
8560
8560
|
"negated": false
|
|
8561
8561
|
}
|
|
8562
|
+
},
|
|
8563
|
+
{
|
|
8564
|
+
"id": 10002,
|
|
8565
|
+
"msg": "PHPUnit eval-stdin.php remote code execution probe (CVE-2017-9841)",
|
|
8566
|
+
"severity": "CRITICAL",
|
|
8567
|
+
"tags": [
|
|
8568
|
+
"attack-rce",
|
|
8569
|
+
"threatcrush",
|
|
8570
|
+
"cve-2017-9841"
|
|
8571
|
+
],
|
|
8572
|
+
"targets": [
|
|
8573
|
+
"REQUEST_FILENAME"
|
|
8574
|
+
],
|
|
8575
|
+
"transforms": [
|
|
8576
|
+
"utf8toUnicode",
|
|
8577
|
+
"urlDecodeUni",
|
|
8578
|
+
"normalizePathWin"
|
|
8579
|
+
],
|
|
8580
|
+
"op": {
|
|
8581
|
+
"type": "rx",
|
|
8582
|
+
"source": "/src/util/php/eval-stdin\\.php",
|
|
8583
|
+
"flags": "i",
|
|
8584
|
+
"negated": false
|
|
8585
|
+
}
|
|
8586
|
+
},
|
|
8587
|
+
{
|
|
8588
|
+
"id": 10003,
|
|
8589
|
+
"msg": "ThinkPHP namespace routing remote code execution probe",
|
|
8590
|
+
"severity": "CRITICAL",
|
|
8591
|
+
"tags": [
|
|
8592
|
+
"attack-rce",
|
|
8593
|
+
"threatcrush",
|
|
8594
|
+
"cve-2022-47945"
|
|
8595
|
+
],
|
|
8596
|
+
"targets": [
|
|
8597
|
+
"ARGS"
|
|
8598
|
+
],
|
|
8599
|
+
"transforms": [
|
|
8600
|
+
"urlDecodeUni"
|
|
8601
|
+
],
|
|
8602
|
+
"op": {
|
|
8603
|
+
"type": "rx",
|
|
8604
|
+
"source": "\\\\think\\\\(?:app|container|request|module|template\\\\driver\\\\file)\\b",
|
|
8605
|
+
"flags": "i",
|
|
8606
|
+
"negated": false
|
|
8607
|
+
}
|
|
8608
|
+
},
|
|
8609
|
+
{
|
|
8610
|
+
"id": 10004,
|
|
8611
|
+
"msg": "XWiki macro injection remote code execution probe (CVE-2025-24893)",
|
|
8612
|
+
"severity": "CRITICAL",
|
|
8613
|
+
"tags": [
|
|
8614
|
+
"attack-rce",
|
|
8615
|
+
"threatcrush",
|
|
8616
|
+
"cve-2025-24893"
|
|
8617
|
+
],
|
|
8618
|
+
"targets": [
|
|
8619
|
+
"ARGS"
|
|
8620
|
+
],
|
|
8621
|
+
"transforms": [
|
|
8622
|
+
"urlDecodeUni"
|
|
8623
|
+
],
|
|
8624
|
+
"op": {
|
|
8625
|
+
"type": "rx",
|
|
8626
|
+
"source": "\\{\\{\\s*(?:groovy|python|async|velocity)\\b",
|
|
8627
|
+
"flags": "i",
|
|
8628
|
+
"negated": false
|
|
8629
|
+
}
|
|
8562
8630
|
}
|
|
8563
8631
|
];
|
|
8564
8632
|
|
|
@@ -13190,6 +13258,43 @@ var CODE_RULES = [
|
|
|
13190
13258
|
languages: ["javascript", "typescript"],
|
|
13191
13259
|
pattern: /\[\s*['"]__proto__['"]\s*\]|\bObject\s*\.\s*assign\s*\(\s*[\w.$]*\.prototype\b|\.\s*__proto__\s*=/
|
|
13192
13260
|
},
|
|
13261
|
+
// ── GitHub Actions ───────────────────────────────────────────────────────
|
|
13262
|
+
//
|
|
13263
|
+
// A workflow runs with the repository's secrets on every push, so writing one
|
|
13264
|
+
// is the shortest path from "can commit" to "has every credential". In
|
|
13265
|
+
// October 2026 a public repository's hidden instructions got ChatGPT's GitHub
|
|
13266
|
+
// connector to commit exactly that into a victim's private repository; the
|
|
13267
|
+
// same file arrives by a compromised maintainer token or a careless merge.
|
|
13268
|
+
// Both rules look for the exfiltration itself, not for secrets being used:
|
|
13269
|
+
// `Authorization: Bearer ${{ secrets.X }}` to the API it belongs to is the
|
|
13270
|
+
// whole point of a secret and stays silent.
|
|
13271
|
+
{
|
|
13272
|
+
id: "gha-all-secrets-serialized",
|
|
13273
|
+
inherent: true,
|
|
13274
|
+
title: "every repository secret serialised into one value",
|
|
13275
|
+
consequence: "toJSON(secrets) is the full secret store as one string. Whatever step receives it can send every credential the repository holds anywhere it likes, and the runner masks it in logs, so nobody sees it leave.",
|
|
13276
|
+
cwe: "CWE-200",
|
|
13277
|
+
severity: "high",
|
|
13278
|
+
languages: ["config"],
|
|
13279
|
+
pattern: /\btoJSON\s*\(\s*secrets\s*\)/,
|
|
13280
|
+
fileRequires: /^\s*runs-on\s*:/m,
|
|
13281
|
+
guard: false
|
|
13282
|
+
},
|
|
13283
|
+
{
|
|
13284
|
+
id: "gha-secret-to-collector",
|
|
13285
|
+
inherent: true,
|
|
13286
|
+
title: "workflow sends secrets to a request-capture service",
|
|
13287
|
+
consequence: "The step posts repository secrets to a public request catcher, which is how stolen CI credentials are collected. Treat every secret the workflow can read as leaked and rotate it.",
|
|
13288
|
+
cwe: "CWE-200",
|
|
13289
|
+
severity: "critical",
|
|
13290
|
+
languages: ["config"],
|
|
13291
|
+
pattern: /\b(?:webhook\.site|requestbin\.(?:com|net)|[\w-]+\.m\.pipedream\.net|pipedream\.net|[\w-]+\.(?:ngrok(?:-free)?\.(?:io|app|dev)|trycloudflare\.com)|[\w-]+\.(?:oast\.(?:fun|live|me|online|pro|site)|interact\.sh|burpcollaborator\.net)|beeceptor\.com|hookbin\.com|requestcatcher\.com)\b/i,
|
|
13292
|
+
requires: /\$\{\{\s*(?:toJSON\s*\(\s*)?secrets\b/,
|
|
13293
|
+
fileRequires: /^\s*runs-on\s*:/m,
|
|
13294
|
+
guard: false,
|
|
13295
|
+
guardBack: 12,
|
|
13296
|
+
guardForward: 4
|
|
13297
|
+
},
|
|
13193
13298
|
// ── Shell ────────────────────────────────────────────────────────────────
|
|
13194
13299
|
//
|
|
13195
13300
|
// `shell` was a language the type system knew about and no rule targeted, so
|
|
@@ -20023,7 +20128,43 @@ async function runDaemon() {
|
|
|
20023
20128
|
}, 1 << 30);
|
|
20024
20129
|
}
|
|
20025
20130
|
|
|
20131
|
+
// src/core/user-agent.ts
|
|
20132
|
+
var USER_AGENT = `threatcrush/${PKG_VERSION} (node ${process.version}; ${process.platform})`;
|
|
20133
|
+
function isOurHost(url, api = apiUrl()) {
|
|
20134
|
+
let host;
|
|
20135
|
+
try {
|
|
20136
|
+
host = new URL(url).hostname.toLowerCase();
|
|
20137
|
+
} catch {
|
|
20138
|
+
return false;
|
|
20139
|
+
}
|
|
20140
|
+
let apiHost = "";
|
|
20141
|
+
try {
|
|
20142
|
+
apiHost = new URL(api).hostname.toLowerCase();
|
|
20143
|
+
} catch {
|
|
20144
|
+
}
|
|
20145
|
+
return host === apiHost || host === "threatcrush.com" || host.endsWith(".threatcrush.com");
|
|
20146
|
+
}
|
|
20147
|
+
function urlOf(input) {
|
|
20148
|
+
if (typeof input === "string") return input;
|
|
20149
|
+
if (input instanceof URL) return input.href;
|
|
20150
|
+
return input.url;
|
|
20151
|
+
}
|
|
20152
|
+
function installUserAgent(target = globalThis) {
|
|
20153
|
+
const base = target.fetch;
|
|
20154
|
+
if (!base || base.__threatcrushUA) return;
|
|
20155
|
+
const wrapped = ((input, init) => {
|
|
20156
|
+
if (!isOurHost(urlOf(input))) return base(input, init);
|
|
20157
|
+
const headers = new Headers(init?.headers ?? (input instanceof Request ? input.headers : void 0));
|
|
20158
|
+
if (headers.has("user-agent")) return base(input, init);
|
|
20159
|
+
headers.set("user-agent", USER_AGENT);
|
|
20160
|
+
return base(input, { ...init, headers });
|
|
20161
|
+
});
|
|
20162
|
+
wrapped.__threatcrushUA = true;
|
|
20163
|
+
target.fetch = wrapped;
|
|
20164
|
+
}
|
|
20165
|
+
|
|
20026
20166
|
// src/daemon-entry.ts
|
|
20167
|
+
installUserAgent();
|
|
20027
20168
|
runDaemon().catch((err) => {
|
|
20028
20169
|
console.error("threatcrushd failed to start:", err);
|
|
20029
20170
|
process.exit(1);
|