OpenSSH 9.8+ PerSourcePenalties causes scan interruptions and false negatives
メンテナーはふだん 17 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start by reading the connection handling and DHEat rate test entry points, then compare how connection failures are reported with the OpenSSH penalty behavior described here. The issue names no files or tests, so locate those paths in the repository first. Done means penalty induced drops are reported and the DHEat result is marked inconclusive when its measurement is affected.
索引モデルが issue の本文から書いたものです。
説明
Summary
OpenSSH 9.8 (released July 2024) introduced PerSourcePenalties, which penalizes source IPs for connections that close without an authentication attempt (noauth penalty). Since ssh-audit never authenticates, every connection it makes accumulates penalty points. With default settings, a full audit scan triggers a temporary IP ban mid-scan, which can cause incomplete results and a silent false negative on the DHEat rate test.
Background: OpenSSH PerSourcePenalties
OpenSSH 9.8 added per-source-IP penalty tracking in sshd. The default configuration is:
PerSourcePenalties crash:90 authfail:5 noauth:1 invaliduser:5 grace-exceeded:10 refuseconnection:10 max:600 min:15
Every connection that closes before an authentication attempt contributes noauth:1 (1 penalty second). Once accumulated penalty points exceed min:15, the source IP is blocked for at least 15 seconds.
What ssh-audit does
A standard audit against a server that advertises N host-key types and M GEX algorithms opens the following connections:
- 1 connection — banner grab + KEXINIT exchange
- N connections — one per host-key type (banner + KEXINIT + KEXDH_INIT + KEXDH_REPLY → host key fingerprint and modulus size)
- up to 2 × several connections — GEX modulus size sweep (multiple size probes per algorithm)
- up to 38 connections — DHEat rate test (TCP-only burst to measure connection rate)
None of these connections authenticate. On a typical OpenSSH server with 4 host-key types and DH-GEX enabled, the connection count exceeds the min:15 threshold before the rate test even starts.
Observed behavior (OpenSSH 10.3, default config)
Before penalty triggers — connections close normally:
sshd-session[10415]: Connection closed by ::1 port 41760 [preauth]
sshd-session[10417]: Connection closed by ::1 port 41764 [preauth]
...
After ~15 connections — penalty activates and drops further connections:
sshd[1419]: srclimit_penalise: ::1/128: activating ipv6 penalty of 15.847 seconds
for penalty: connections without attempting authentication
sshd[1419]: drop connection #2 from [::1]:41962 on [::1]:22
penalty: connections without attempting authentication
(repeated 7x)
SSH_MSG_DISCONNECT does not help
Sending SSH_MSG_DISCONNECT before closing each connection makes sshd log clean disconnects:
sshd-session[11253]: Received disconnect from ::1 port 45202:11: [preauth]
sshd-session[11253]: Disconnected from ::1 port 45202 [preauth]
However, the penalty is still triggered immediately after:
sshd[1419]: srclimit_penalise: ::1/128: activating ipv6 penalty of 15.790 seconds
for penalty: connections without attempting authentication
The penalty reason is noauth — it applies regardless of whether the connection ends with a clean disconnect or an abrupt TCP close. The method of closing is irrelevant; the only thing that matters is that no authentication was attempted.
Two concrete impacts
1. Incomplete scan results
If the penalty ban activates before all host-key or GEX connections complete, those tests are silently skipped. Host-key fingerprints, RSA modulus sizes, or GEX modulus sizes may be missing from the output without any error message to indicate why.
2. Silent false negative on DHEat rate test
The DHEat rate test measures how many TCP connections per second the server allows. If the penalty system is already active when the rate test runs, connections are dropped by the penalty mechanism — not by actual DH rate limiting. The measured rate falls below MAX_SAFE_RATE (25/sec), so no DHEat warning is emitted, even though the server does not have proper DH rate limiting configured. The server appears protected when it is not.
Suggested improvements
-
Detect penalty-induced connection drops — if a connection attempt is refused or drops immediately after the TCP handshake, warn the user that
PerSourcePenaltiesmay be active and that scan results may be incomplete. -
Detect DHEat false negative — if connections are being dropped during the rate test (rather than the server responding with
Exceeded MaxStartups), the rate measurement is not meaningful. The tool should recognize this case and report it as inconclusive rather than "not vulnerable". -
Document
--skip-rate-testfor OpenSSH 9.8+ — the existing flag reduces the total connection count significantly and may keep the scan below the penalty threshold in many configurations. This should be prominently documented as the recommended approach for OpenSSH 9.8+ targets.
Related
Issue #335 ("Intermittent failures when ssh-audit is run using Ansible") describes the same root cause. The reporter experienced repeated [exception] did not receive banner: Connection reset by peer errors when Ansible ran ssh-audit in a retry loop. Each retry triggered additional noauth penalties, which extended the ban and caused every subsequent attempt to fail immediately — a self-reinforcing cycle. The issue was closed without identifying PerSourcePenalties as the cause; the reporter concluded independently that "a rate limiting feature in newer versions of OpenSSH" was responsible.
Environment
- ssh-audit version:
v3.4.0-dev - Target: OpenSSH 10.3 (default
sshd_config,PerSourcePenaltiesat defaults) - Python: 3.13
- 主要言語
- Python
- スター
- 4.3k
- フォーク
- 233
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
jtesta/ssh-audit のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 17 日以内に返信
-
Wrong algorithm recommendation for OpenSSH 10.6対応中かも @rylena が 14 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
jtesta/ssh-audit#393 · リアクション 1 件 ·
メンテナーはふだん 17 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 17 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
メンテナーはふだん 17 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 52/100
jtesta/ssh-audit#396 · コメント 1 件 ·
メンテナーはふだん 17 日以内に返信
jtesta/ssh-audit の issue をすべて見る
似ている issue
-
priority: low research
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
LearningCircuit/local-deep-research#10088 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
WebOfTrust/keripy#1787 ·
メンテナーはふだん 1 日以内に返信
-
smarter-api: SmarterTokenAuthentication.authenticate_credentials() logs the api key owner's username at INFO on every api-key request対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンlogging pod-log-review security severity: medium
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
smarter-sh/smarter#1124 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
resource-submission validation-passed
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
hesreallyhim/awesome-claude-code#3773 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
lightninglabs/layertree#28 ·