Bug 21270 - nmap reports weird open ports that is "fixed" by killing/restarting nfslock
nmap reports weird open ports that is "fixed" by killing/restarting nfslock
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: nfs-utils (Show other bugs)
7.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Pete Zaitcev
David Lawrence
: Security
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-11-22 18:49 EST by Henri Schlereth
Modified: 2007-04-18 12:30 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-12-19 11:15:28 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Henri Schlereth 2000-11-22 18:49:01 EST
As a security test I ran nmap -O against a fresh server install + updates of RH7
The first scan showed 1024 kdm active. A restart then showed 1031 iad2 active. A stop/start
made things normal.  ???? WTF?

A reboot brings kdm active again.

<scratches head in very puzzled manner but reports it anyway>
Comment 1 Daniel Roesen 2000-11-22 20:08:00 EST
Ports in that range are dynamically assigned. Same 'problem' exists with gnome-
panel which also opens a dynamically assigned listening socket (so you can't 
filter it). nmap by default scans only "usual" ports (found in /etc/services 
and some others IIRC).

By restarting the services they get other ports assigned by the kernel. This is 
what you are experiencing. After reboot kdm is obviously the first process in 
the bootup execution sequence which acquires a dynamic socket so it gets 1024 
(the first in the 1024-4999 range) again.

After all: NOTABUG (but a security problem IMHO). Perhaps changing the 
component to the KDE package containing kdm is a good idea if you want to raise 
the security question (I don't know any reason why kdm needs a dynamic 
listening socket by default at all) and change severity to "security".
Comment 2 Henri Schlereth 2000-11-22 20:49:03 EST
I am sorry but I am going to have to disagree with this line of reasoning, I did a server install, no GNOME, no KDE, just
XFS server and libs and XFS is turned off. Whatever is hanging off that socket may be reported as kdm but it isnt. And I do not
have iad2 installed running on port 1031 either. So either nmap is on the fritz or something is grabbing sockets that it
shouldnt.
To verify all else, the machine is behind the firewall and uses rfc1918 fixed IP addresses.And it goes away by stopping/
starting nfslock.

Comment 3 Henri Schlereth 2000-11-22 21:39:14 EST
Additional information:
Using ntsysv I disabled nfslock, problem goes away
When I re-enable, reboot, problem returns
two initscript restarts 1.) shows kdm  1024 2.) shows iad2 1031
and then the problem goes away. I run nmap between each step.

I rebooted and ran rpcinfo

[root@kesrith /root]# rpcinfo -p cave
   program vers proto   port
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
    100021    1   udp   1024  nlockmgr
    100021    3   udp   1024  nlockmgr
    100024    1   udp   1025  status
    100024    1   tcp   1024  status
    100001    3   udp    669  rstatd
    100001    2   udp    669  rstatd
    100001    1   udp    669  rstatd

you will note the 1024 port showing nlockmgr holding the socket and 1025  status (something that nmap didnt catch).
Comment 4 Daniel Roesen 2000-11-22 22:00:26 EST
Sorry, but this is how NFS&RPC works.

RPC services use dynamically assigned ports, for which portmap acts as a 
broker. rpcinfo -p shows the registered RPC services and the ports they listen 
to. nlockmgr and status (rpc.statd) listen on dynamically assigned ports 
(default range is 1024-4999).

Your restarts have the consequence, that rpc.statd etc. gets restarted and gets 
a new port (1031 e.g.). Verify this with rpcinfo -p after you restarted the 
nfslock package. You can see the services "moving" up the dynport range after 
restarts.
Comment 5 Henri Schlereth 2000-11-22 22:55:54 EST
Really? And why doesnt it exhibit this behavior under RH6.2? 
Repeated restarts under RH6.2 show the same ports re-used over and over again.
nfs-utils-0.1.9.1-1

1024 for nlockmgr
957 status
959 status

The dynamic model has changed. This makes it a fingerprint to determine if they
are scanning
an RH7 box, is this supposed to be an improvement? This explains the presence of
kdm
in my security logs when I counter-scan an intrusion attempts.

And nmap only shows the last two as unkown. And doesnt see 1024 at all.

Now I dont want to step on any feet but I assume that either droesen works for
RedHat or
is on the beta team as I am. If you dont work for RedHat why not let the
assigned to person tell
me I am barking up the wrong tree?
Comment 6 Daniel Roesen 2000-11-23 08:43:44 EST
will do so now.
Comment 7 Pete Zaitcev 2002-10-08 19:57:31 EDT
Firewall should block by TCP SYN flag, not by port number,
and have defaults set to reject. Running NFS over the Internet
is not a sane idea.

If nmap can detect open ports, a firewall is misconfigured.

Note You need to log in before you can comment on or make changes to this bug.