@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/index.js CHANGED
@@ -24774,8 +24774,12 @@ var DEFAULT_RULES = [
24774
24774
  },
24775
24775
  {
24776
24776
  id: "ssh-success-after-failures",
24777
- title: "SSH Login After Failed Attempts",
24778
- description: "Successful SSH login from an IP that had recent failures",
24777
+ title: "SSH Login Accepted",
24778
+ // Honest description: this rule does NOT correlate with earlier failures —
24779
+ // it matches any accepted login. It is an alert, and it declares no
24780
+ // remediation precisely because banning the person who just logged in is
24781
+ // never the right response.
24782
+ description: "Successful SSH login (alert only \u2014 never grounds for a ban)",
24779
24783
  version: "1.0.0",
24780
24784
  category: "auth",
24781
24785
  severity: "critical",
@@ -24802,7 +24806,9 @@ var DEFAULT_RULES = [
24802
24806
  match: {
24803
24807
  field: "message",
24804
24808
  operator: "regex",
24805
- value: "(failed|accepted).*\\broot\\b"
24809
+ // Attempts only. Matching `accepted` here meant a successful root login
24810
+ // banned the administrator who had just made it.
24811
+ value: "failed.*\\broot\\b"
24806
24812
  },
24807
24813
  threshold: 1,
24808
24814
  window_seconds: 60,
@@ -25479,6 +25485,9 @@ var SEVERITY_RANK4 = {
25479
25485
  high: 3,
25480
25486
  critical: 4
25481
25487
  };
25488
+ function isSuccessfulAuth(message) {
25489
+ return /login accepted|accepted (?:publickey|password|keyboard-interactive)|session opened/i.test(message);
25490
+ }
25482
25491
  function explainBlockFailure(err, backend) {
25483
25492
  const raw = err.message || String(err);
25484
25493
  const denied = /not permitted|EACCES|EPERM|permission denied|must be root/i.test(raw);
@@ -25533,6 +25542,11 @@ var RemediationManager = class {
25533
25542
  const eventRank = SEVERITY_RANK4[event.severity] ?? 0;
25534
25543
  const minRank = SEVERITY_RANK4[this.config.min_severity] ?? 3;
25535
25544
  if (eventRank < minRank) return;
25545
+ if (isSuccessfulAuth(event.message)) return;
25546
+ if (event.details?.rule_id) {
25547
+ const remediation = event.details?.remediation;
25548
+ if (remediation?.action !== "block") return;
25549
+ }
25536
25550
  const ip = event.source_ip;
25537
25551
  if (!ip || (0, import_node_net5.isIP)(ip) === 0) return;
25538
25552
  if (this.isAllowlisted(ip)) return;