nmap doesn't save received service detection fingerprint data on connection error

オープン
#3,200 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
cpp
領域
networking

調査の方向性

service_scan.cc の servicescan_read_handler から始め、サービスフィンガープリントの処理と併せて NSE_STATUS_ERROR ブランチを調べてください。報告された reproducer は利用できない内部サービスであるため、提示された期待される動作と周辺の service-scan ロジックを使って、受信データがどのように保持されるかを判断してください。接続エラーが発生する前に受信したデータが、エラー処理を妨げることなくサービスフィンガープリントに反映されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Nmap

Describe the bug
During service detection, if the connection goes into an error state nmap throws away any received data already read from the connection. This creates a situation where certain services can provide data which gets soft matched, but no hard match is seen and no fingerprint data is given to create better match statements.

To Reproduce
Reproduced with an internal company service sorry :/

Expected behavior
Add fingerprint data if any data was received.

Version info (please complete the following information):

  • OS: Linux (any)
  • Output of nmap --version:
Nmap version 7.97 ( https://nmap.org )
Platform: x86_64-unknown-linux-gnu
Compiled with: nmap-liblua-5.4.7 openssl-1.1.1zc nmap-libssh2-1.11.1 libz-1.2.7 nmap-libpcre2-10.45 nmap-libpcap-(with nmap-libdnet-1.18.0 ipv6
Compiled without:
Available nsock engines: epoll poll select

Additional context

Patch file to fix this:

diff --git i/service_scan.cc w/service_scan.cc
index 147a6c5..33c448a 100644
--- i/service_scan.cc
+++ w/service_scan.cc
@@ -2588,6 +2588,10 @@ static void servicescan_read_handler(nsock_pool nsp, nsock_event nse, void *myda
       startNextProbe(nsp, nsi, SG, svc, true);
     }
   } else if (status == NSE_STATUS_ERROR) {
+    // even with error, we may have received data
+    readstr = svc->getcurrentproberesponse(&readstrlen);
+    if (readstrlen > 0)
+      svc->addToServiceFingerprint(svc->currentProbe()->getName(), readstr, readstrlen);
     // Errors might happen in some cases ... I'll worry about later
     int err = nse_errorcode(nse);
     bool show_err = true;
主要言語
C
スター
14k
フォーク
3k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nmap/nmap のほかの issue

nmap/nmap の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。