Seltsames Verhalten von nmap

Nagios, Munin, Serverstats, etc.
Post Reply
noiz
Posts: 36
Joined: 2007-06-21 14:58
 

Seltsames Verhalten von nmap

Post by noiz »

Hallo!

Ich verwende nmap in einem meiner daily-cron-Scripte um die lokalen Netzwerkinterfaces auf meinem Server abzuklopfen. Seit einigen Tagen laufen diese Scripte nicht mehr richtig. Nach etwas Recherche habe ich herausgefunden, dass nmap ein eigenartiger Verhalten an den Tag legt:

Wenn ich nmap als Root starte, dann laufen die Scans immer als SYN Stealth-Scan, als normaler Nutzer jedoch nicht. Beispiel: Scan auf localhost als root:

Code: Select all

nmap -vvv localhost -p 25

Starting Nmap 4.68 ( http://nmap.org ) at 2009-02-26 12:35 CET
Initiating SYN Stealth Scan at 12:35
Scanning localhost (127.0.0.1) [1 port]
Completed SYN Stealth Scan at 12:35, 2.04s elapsed (1 total ports)
Host localhost (127.0.0.1) appears to be up ... good.
Scanned at 2009-02-26 12:35:11 CET for 2s
Interesting ports on localhost (127.0.0.1):
PORT   STATE    SERVICE
25/tcp filtered smtp
und als normaler Benutzer:

Code: Select all

nmap -vvv localhost -p 25

Starting Nmap 4.68 ( http://nmap.org ) at 2009-02-26 12:35 CET
Initiating Ping Scan at 12:35
Scanning 127.0.0.1 [1 port]
Completed Ping Scan at 12:35, 0.00s elapsed (1 total hosts)
Initiating Connect Scan at 12:35
Scanning localhost (127.0.0.1) [1 port]
Discovered open port 25/tcp on 127.0.0.1
Completed Connect Scan at 12:35, 0.00s elapsed (1 total ports)
Host localhost (127.0.0.1) appears to be up ... good.
Scanned at 2009-02-26 12:35:31 CET for 0s
Interesting ports on localhost (127.0.0.1):
PORT   STATE SERVICE
25/tcp open  smtp
Außerdem fällt bei den beiden Beispielen auf, dass bei dem root-Scan der offene Port 25 (exim4) als "filtered" angezeigt wird, beim Scan als unpriviligierter Benutzer jedoch als "open"
Wie kann das sein, dass das nmap bei identischem Aufruf einmal einen SYN Stealth-Scan und einmal einen normalen Scan durchführt? Das gleiche Problem habe ich übrigens auch, wenn ich eine externe IP scanne, und nicht nur localhost.

Grüße

Nico
Last edited by noiz on 2009-02-26 13:18, edited 1 time in total.
User avatar
Joe User
Project Manager
Project Manager
Posts: 11191
Joined: 2003-02-27 01:00
Location: Hamburg
Contact:
 

Re: Seltsames Verhalten von nmap

Post by Joe User »

noiz wrote:Wie kann das sein, dass das nmap bei identischem Aufruf einmal einen SYN Stealth-Scan und einmal einen normalen Scan durchführt?
Weil Ersteres root-Rechte benötigt und Letzteres eben nicht...
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
noiz
Posts: 36
Joined: 2007-06-21 14:58
 

Re: Seltsames Verhalten von nmap

Post by noiz »

Joe User wrote:
noiz wrote:Wie kann das sein, dass das nmap bei identischem Aufruf einmal einen SYN Stealth-Scan und einmal einen normalen Scan durchführt?
Weil Ersteres root-Rechte benötigt und Letzteres eben nicht...
Klingt plausibel, was mir aber nicht klar ist: Das Script verwende ich jetzt schon ~ 1,5 Jahre, aber erst seit vorgestern tritt dieser Fehler auf! Habe eben noch mal nachgeschaut, ob vielleicht die Tage ein Update für nmap dabei war. Ist aber nicht der Fall. Könnte das auch mit seLinux zusammenhängen? Laut meinem Log von apt wurde vor wenigen Tagen die libsepolicy geupdated...

Noch ne Idee?

Grüße

Nico
User avatar
Joe User
Project Manager
Project Manager
Posts: 11191
Joined: 2003-02-27 01:00
Location: Hamburg
Contact:
 

Re: Seltsames Verhalten von nmap

Post by Joe User »

noiz wrote:Könnte das auch mit seLinux zusammenhängen? Laut meinem Log von apt wurde vor wenigen Tagen die libsepolicy geupdated...
In dem Fall solltest Du die Policy für nmap anpassen, siehe Doku zu SELinux.
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Post Reply