@profullstack/threatcrush 0.12.4 → 0.12.5
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/dist/daemon.js +17 -3
- package/dist/daemon.js.map +1 -1
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/daemon.js
CHANGED
|
@@ -8530,8 +8530,12 @@ var DEFAULT_RULES = [
|
|
|
8530
8530
|
},
|
|
8531
8531
|
{
|
|
8532
8532
|
id: "ssh-success-after-failures",
|
|
8533
|
-
title: "SSH Login
|
|
8534
|
-
description:
|
|
8533
|
+
title: "SSH Login Accepted",
|
|
8534
|
+
// Honest description: this rule does NOT correlate with earlier failures —
|
|
8535
|
+
// it matches any accepted login. It is an alert, and it declares no
|
|
8536
|
+
// remediation precisely because banning the person who just logged in is
|
|
8537
|
+
// never the right response.
|
|
8538
|
+
description: "Successful SSH login (alert only \u2014 never grounds for a ban)",
|
|
8535
8539
|
version: "1.0.0",
|
|
8536
8540
|
category: "auth",
|
|
8537
8541
|
severity: "critical",
|
|
@@ -8558,7 +8562,9 @@ var DEFAULT_RULES = [
|
|
|
8558
8562
|
match: {
|
|
8559
8563
|
field: "message",
|
|
8560
8564
|
operator: "regex",
|
|
8561
|
-
|
|
8565
|
+
// Attempts only. Matching `accepted` here meant a successful root login
|
|
8566
|
+
// banned the administrator who had just made it.
|
|
8567
|
+
value: "failed.*\\broot\\b"
|
|
8562
8568
|
},
|
|
8563
8569
|
threshold: 1,
|
|
8564
8570
|
window_seconds: 60,
|
|
@@ -9233,6 +9239,9 @@ var SEVERITY_RANK4 = {
|
|
|
9233
9239
|
high: 3,
|
|
9234
9240
|
critical: 4
|
|
9235
9241
|
};
|
|
9242
|
+
function isSuccessfulAuth(message) {
|
|
9243
|
+
return /login accepted|accepted (?:publickey|password|keyboard-interactive)|session opened/i.test(message);
|
|
9244
|
+
}
|
|
9236
9245
|
function explainBlockFailure(err, backend) {
|
|
9237
9246
|
const raw = err.message || String(err);
|
|
9238
9247
|
const denied = /not permitted|EACCES|EPERM|permission denied|must be root/i.test(raw);
|
|
@@ -9287,6 +9296,11 @@ var RemediationManager = class {
|
|
|
9287
9296
|
const eventRank = SEVERITY_RANK4[event.severity] ?? 0;
|
|
9288
9297
|
const minRank = SEVERITY_RANK4[this.config.min_severity] ?? 3;
|
|
9289
9298
|
if (eventRank < minRank) return;
|
|
9299
|
+
if (isSuccessfulAuth(event.message)) return;
|
|
9300
|
+
if (event.details?.rule_id) {
|
|
9301
|
+
const remediation = event.details?.remediation;
|
|
9302
|
+
if (remediation?.action !== "block") return;
|
|
9303
|
+
}
|
|
9290
9304
|
const ip = event.source_ip;
|
|
9291
9305
|
if (!ip || (0, import_node_net4.isIP)(ip) === 0) return;
|
|
9292
9306
|
if (this.isAllowlisted(ip)) return;
|