@profullstack/threatcrush 0.13.72 → 0.13.74
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 +1 -1
- package/dist/daemon.js +65 -11
- package/dist/daemon.js.map +1 -1
- package/dist/index.js +65 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -37589,7 +37589,8 @@ var SECRET_RULES = [
|
|
|
37589
37589
|
pattern: /-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY(?: BLOCK)?-----/,
|
|
37590
37590
|
severity: "critical",
|
|
37591
37591
|
cwe: "CWE-798",
|
|
37592
|
-
consequence: "Key material, committed. Rotation is the only remediation."
|
|
37592
|
+
consequence: "Key material, committed. Rotation is the only remediation.",
|
|
37593
|
+
confirm: (lines, index, match) => hasPemBody(lines, index, match)
|
|
37593
37594
|
},
|
|
37594
37595
|
{
|
|
37595
37596
|
id: "secret-slack-token",
|
|
@@ -37738,6 +37739,18 @@ var KNOWN_PLACEHOLDERS = [
|
|
|
37738
37739
|
function isKnownPlaceholder(text) {
|
|
37739
37740
|
return KNOWN_PLACEHOLDERS.some((pattern) => pattern.test(text));
|
|
37740
37741
|
}
|
|
37742
|
+
var PEM_BODY_LOOKAHEAD = 6;
|
|
37743
|
+
var PEM_BODY_RUN = /[A-Za-z0-9+/]{40,}/;
|
|
37744
|
+
var PEM_BODY_LINE = /^[\s'"`+(]*(?:\\n)?[A-Za-z0-9+/]{40,}={0,2}(?:\\n)?['"`,;+)\s]*$/;
|
|
37745
|
+
function hasPemBody(lines, index, match) {
|
|
37746
|
+
const rest = (lines[index] ?? "").slice(match.index + match[0].length).replace(/\\[nr]/g, " ");
|
|
37747
|
+
if (PEM_BODY_RUN.test(rest)) return true;
|
|
37748
|
+
const last = Math.min(lines.length - 1, index + PEM_BODY_LOOKAHEAD);
|
|
37749
|
+
for (let i = index + 1; i <= last; i++) {
|
|
37750
|
+
if (PEM_BODY_LINE.test(lines[i])) return true;
|
|
37751
|
+
}
|
|
37752
|
+
return false;
|
|
37753
|
+
}
|
|
37741
37754
|
function isPlaceholderAttribute(line2, value) {
|
|
37742
37755
|
const at = line2.lastIndexOf(value);
|
|
37743
37756
|
if (at === -1) return false;
|
|
@@ -37997,14 +38010,6 @@ function isSuppressed(suppressions, index, ruleId) {
|
|
|
37997
38010
|
if (!rules) return false;
|
|
37998
38011
|
return rules.has("*") || rules.has(ruleId);
|
|
37999
38012
|
}
|
|
38000
|
-
function pemPlaceholder(lines, index) {
|
|
38001
|
-
const first = lines[index] ?? "";
|
|
38002
|
-
const header2 = /-----BEGIN ((?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY(?: BLOCK)?)-----/.exec(first);
|
|
38003
|
-
if (!header2) return false;
|
|
38004
|
-
const tail = [first.slice(header2.index + header2[0].length), ...lines.slice(index + 1, index + 21)].join("\n").replace(/\\n/g, "\n");
|
|
38005
|
-
const end = tail.indexOf(`-----END ${header2[1]}-----`);
|
|
38006
|
-
return end >= 0 && ["your-pem-body-here", "your-private-key-here", "your-private-key-body-here"].includes(tail.slice(0, end).trim().toLowerCase());
|
|
38007
|
-
}
|
|
38008
38013
|
function isTestPath(relativePath) {
|
|
38009
38014
|
const p = relativePath.replace(/\\/g, "/");
|
|
38010
38015
|
return /(?:^|\/)(?:tests?|__tests__|__mocks__|spec|specs|fixtures?|mocks?|e2e|testdata|testutils?|harness)\//i.test(p) || /(?:^|\/)(?:test|conftest)_[^/]+$/i.test(p) || /[._-](?:test|spec)\.[a-z]+$/i.test(p) || /_test\.[a-z]+$/i.test(p);
|
|
@@ -38192,6 +38197,7 @@ function scanText(relativePath, text, language = languageOf(relativePath)) {
|
|
|
38192
38197
|
const match = rule.pattern.exec(line2);
|
|
38193
38198
|
if (!match) continue;
|
|
38194
38199
|
if (isKnownPlaceholder(match[0])) continue;
|
|
38200
|
+
if (rule.confirm && !rule.confirm(lines, index, match)) continue;
|
|
38195
38201
|
if (isSuppressed(suppressions, index, rule.id)) continue;
|
|
38196
38202
|
const value = match[1] ?? match[0];
|
|
38197
38203
|
if (isVariableReference(value)) continue;
|
|
@@ -38200,7 +38206,9 @@ function scanText(relativePath, text, language = languageOf(relativePath)) {
|
|
|
38200
38206
|
test: inTests,
|
|
38201
38207
|
"test-block": inlineTests.has(index),
|
|
38202
38208
|
suppressed: foreignSecurityMark(line2),
|
|
38203
|
-
|
|
38209
|
+
// A dummy PEM body (`your-pem-body-here`) never reaches here: it is not a
|
|
38210
|
+
// base64 body, so `hasPemBody` already dropped it.
|
|
38211
|
+
placeholder: isPlaceholderAttribute(line2, value),
|
|
38204
38212
|
"self-describing": rule.keywordShaped === true && describesItsOwnKey(line2, value)
|
|
38205
38213
|
});
|
|
38206
38214
|
findings2.push({
|
|
@@ -49964,6 +49972,9 @@ var import_node_path42 = require("path");
|
|
|
49964
49972
|
|
|
49965
49973
|
// src/daemon/rules/default-rules.ts
|
|
49966
49974
|
var AT_CRS_THRESHOLD = { field: "severity", operator: "regex", value: "^(high|critical)$" };
|
|
49975
|
+
var SSHD_IDENT = String.raw`\[sshd(?:-session|-auth)?\]`;
|
|
49976
|
+
var SSHD_LINE = `^${SSHD_IDENT}`;
|
|
49977
|
+
var NOT_SSHD_LINE = `^(?!${SSHD_IDENT})`;
|
|
49967
49978
|
var DEFAULT_RULES = [
|
|
49968
49979
|
{
|
|
49969
49980
|
id: "ssh-brute-force",
|
|
@@ -50364,7 +50375,14 @@ var DEFAULT_RULES = [
|
|
|
50364
50375
|
match: {
|
|
50365
50376
|
field: "severity",
|
|
50366
50377
|
operator: "equals",
|
|
50367
|
-
value: "critical"
|
|
50378
|
+
value: "critical",
|
|
50379
|
+
// sshd's pre-auth failures are logged at syslog priority 2, so they used
|
|
50380
|
+
// to land here and every SSH bot arrived titled "Critical System Error".
|
|
50381
|
+
// They belong to `ssh-preauth-rejected` below. Excluded on `message`, not
|
|
50382
|
+
// on `details.process`: matchesCondition fails a condition whose field is
|
|
50383
|
+
// undefined, so an `and` on `process` would stop this rule matching every
|
|
50384
|
+
// critical line that has no process (the kernel's, for one).
|
|
50385
|
+
and: [{ field: "message", operator: "regex", value: NOT_SSHD_LINE }]
|
|
50368
50386
|
},
|
|
50369
50387
|
threshold: 1,
|
|
50370
50388
|
window_seconds: 60,
|
|
@@ -50372,6 +50390,42 @@ var DEFAULT_RULES = [
|
|
|
50372
50390
|
tags: ["system", "critical"],
|
|
50373
50391
|
enabled: true
|
|
50374
50392
|
},
|
|
50393
|
+
{
|
|
50394
|
+
// Anthony, 2026-11-04, on being called for these: "it can call me when
|
|
50395
|
+
// unauthorized access, i want to know" — so this stays `critical` and pages
|
|
50396
|
+
// exactly as `system-critical-error` did (store.ts pages on `critical`, or
|
|
50397
|
+
// on a rule in PAGED_ATTEMPT_RULES). What changes is what the page says.
|
|
50398
|
+
//
|
|
50399
|
+
// sshd logs a rejected handshake at priority 2 — "fatal: userauth_pubkey:
|
|
50400
|
+
// parse publickey packet: incomplete message [preauth]", "banner exchange:
|
|
50401
|
+
// ... invalid format" — so a bot that never authenticated used to raise
|
|
50402
|
+
// "Critical System Error", and because `dedupe_key` is
|
|
50403
|
+
// `detection:<server>:<rule_id>` it shared ONE incident with unrelated
|
|
50404
|
+
// critical lines (a local `sudo` password typo, say). A rule of its own
|
|
50405
|
+
// splits those apart and names what actually happened.
|
|
50406
|
+
//
|
|
50407
|
+
// No `remediation`: like the rule it came from, this one only reports. The
|
|
50408
|
+
// ban for these addresses comes from the ssh-* rules that match the
|
|
50409
|
+
// accompanying "Invalid user" line, which carries a source_ip to ban.
|
|
50410
|
+
id: "ssh-preauth-rejected",
|
|
50411
|
+
title: "SSH Connection Rejected Before Login",
|
|
50412
|
+
description: "A remote client failed the SSH handshake before authenticating; no session was established",
|
|
50413
|
+
version: "1.0.0",
|
|
50414
|
+
category: "auth",
|
|
50415
|
+
severity: "critical",
|
|
50416
|
+
source_types: ["user-journal", "system"],
|
|
50417
|
+
match: {
|
|
50418
|
+
field: "severity",
|
|
50419
|
+
operator: "equals",
|
|
50420
|
+
value: "critical",
|
|
50421
|
+
and: [{ field: "message", operator: "regex", value: SSHD_LINE }]
|
|
50422
|
+
},
|
|
50423
|
+
threshold: 1,
|
|
50424
|
+
window_seconds: 60,
|
|
50425
|
+
cooldown_seconds: 300,
|
|
50426
|
+
tags: ["ssh", "auth", "pre-auth", "reconnaissance"],
|
|
50427
|
+
enabled: true
|
|
50428
|
+
},
|
|
50375
50429
|
{
|
|
50376
50430
|
id: "exploit-probe-pattern",
|
|
50377
50431
|
title: "Exploit Probe Pattern",
|