|
Softpanorama |
May the source be with you, but remember the KISS principle ;-)
Softpanorama Search
|
| Summary | OSI Protocol Layers | Recommended Books | Recommended Links | Lecture Notes | Unix System Calls | |
| Security Issues | MSBlaster Worm | Microsoft RPC | Humor | Etc |
There are two ways of starting RPC services: at boot time via RC files or on demand.
At boot time RPC services vai /etc/rc2.d/s71rpc startup script that initializes the rpcbind service After the system starts up, the rpcbind daemon starts listening at port 111. The rpcbind process associates RPC program numbers with port numbers above 32768. The port number used by the rpcbind daemon is listed in the /etc/inet/services file. To view the port number and protocol, perform the command:
grep rpcbind /etc/services
sunrpc 111/udp rpcbind
sunrpc 111/tcp rpcbind
For a client to make request to the server the rpcbind service must be running on the server system. When an RPC service starts at boot, it communicates port and RPC number to the rpcbind process: If the RPC service has registered its current port number with the rpcbind daemon during startup, the current port number of the RPC service is returned to the client.
Some rpcbind services start only on demand. They are listed in
inetd.conf file and are controlled by inetd daemon.
The rpcinfo command is used to list and delete RPC services. Two corresponding options are -p and -d:
# grep sprayd /etc/rpc
sprayd 100012 spray
Sun Microsystems's invented RPC in mid 80th. The original version of RPC was defined in RFC 1050. RPC is a powerful technique for constructing distributed, client-server based applications. It is based on extending the notion of conventional, or local procedure calling, so that the called procedure need not exist in the same address space as the calling procedure.
RPC opened new possibilities in network programming making possible such protocols as NFS, NIS, rsh, etc. Network File System (NFS) is a network file sharing system application that is a good example of how RPC can be used. Version 2 of RPC is defined in RFC 1057 and RFC 1831.
RPC services are not typically assigned to well-known ports. Rather than tying applications to particular ports, RPC provides a port mapping service whereby RPC assigns port numbers above 1024 to applications that are written to request RPC for ports. The lookup services that can be used for this include PORTMAPPER (PMAP) and RPCBIND and are described in RFC 1833. Portmapper has a fixed port (either UDP or TCP) number 111 to which an application (RPC service) makes a call to gain a port number to use. This lookup service program must be started first and remain operational throughout the runtime of the application.
The list of RPC services includes:
While originated in Sun RPC spread first to other Unixes and then to other OSes like Windows becoming pretty much a cross-platform protocol. Even command line utilities are often replicated. For example, Windows has rpcinfo utilities that operates pretty much like its Unix counterpart. To ensure cross-platform compatibility RPC data now are encoded using eXternal Data Representation (XDR), which defines how integers, floating point numbers and strings are represented(RFC 1832). This Presentation Layer protocol enables different computers with different operating systems to interact seamlessly. There is no formal message header or protocol system for XDR. XDR uses an 8-bit byte, with the lower bytes being the most significant. The RFC defines that all integer data types are converted to 4-byte integers, (there is also available an extended 64-bit integer format). IEEE 32-bit formats are used for floating-point numbers, where the mantissa is the lower 23 bits, the exponent takes 8 bits, and the sign of the number is 1 bit. Where data takes less than 4 bytes for any type, padding is added to ensure 4-byte lengths
RPC services started at boot time with startup scripts run on available ports above 32768. The rpcbind process associates RPC program numbers with port numbers.
The rpcbind service must be running on the server system for you to make RPC requests to the server. When an RPC service starts at boot, it communicates the following information to the rpcbind process:
If a client wants to make an RPC call to a given program number, it must
first contact the rpcbind service
on the server machine to obtain the port address before it can send the
RPC requests. If the RPC service has registered its current port number
with the rpcbind daemon during
startup, the current port number of the RPC service is returned to the
client.
In Solaris the /etc/rc2.d/s71rpc startup script initializes the rpcbind service. The port number used by the rpcbind daemon is listed in the /etc/inet/services file. After the system starts up, the rpcbind daemon starts listening at port 111. To view the port number and protocol, grep the /etc/inet/services for string "rpcbind":
# grep rpcbind /etc/services
sunrpc 111/udp rpcbind
sunrpc 111/tcp rpcbind
Some rpcbind services start
only on demand. The port numbers are registered with the
rpcbind process during boot. When
a client application requests a service, the rpcbind
process returns the port number of the service to the client machine. The
client machine generates a new request using the port number that it just
received for the requested service.
RPC services on demand, such as the sprayd service, are implemented as follows:
The rpcinfo command makes an RPC call to an RPC server, and reports what it finds. Two frequently used options to the rpcinfo command are -p and -d.
Registration of RPC services. RPC services need to be registered. You can list services and unregister any services with rpcinfo. Note – Using the command rpcinfo -p host command returns information about registered RPC services on the specified host.
rpcinfo -p [ host ]
For example:
# rpcinfo -p
program vers proto port service
100000 4 tcp 111 rpcbind
100000 3 tcp 111 rpcbind
100000 2 tcp 111 rpcbind
100000 4 udp 111 rpcbind
100000 3 udp 111 rpcbind
100000 2 udp 111 rpcbind
100232 10 udp 32772 sadmind
100083 1 tcp 32771
...
<output truncated>
...
The columns are as follows:
To unregister the RPC service given a specified prognum (program number) and versnum (version number), perform the rpcinfo command:
This command unregisters the RPC service with program number
100012 and version number 1.
Note – When using the
rpcinfo -d command to unregister
an RPC service, the RPC service can be identified using either
the service name or the program number.
The deleted RPC service that uses program number 100012 is sprayd. To
register the sprayd service again, send a HUP signal to the inetd daemon
as follows:
# pkill -HUP inetd
|
|||||||
Remote Procedure Calls (RPC) by Dave Marshall (1/5/1999)
A Tutorial on Sockets and RPCs
Remote Procedure Call -- Carnegue-Mellon
docs.sun.com Introduction to the Solaris Development Environment
docs.sun.com NIS+ and DNS Setup and Configuration Guide
Solaris - Tuning Your TCP-IP Stack
TCP-wrapped rpcbind for Solaris
Client Server Computing - Unix Sockets and RPC
http://csrc.ncsl.nist.gov/publications/nistpubs/800-7/node184.html
http://www.netsys.com/sunmgr/1997-12/msg00124.html
http://www.rrzn.uni-hannover.de/ZentralSys/Vektor/manual/manlib/C/nuae/nuae18/nuae0298.htm
Denial of Service in Applications Using RPC over Named Pipes
See also MSBlaster Worm -- the most high profile exploitation of RPC vulnerabilities in MS Windows.
There are several problems with RPC itself, some more security related than others. The portmapper itself can be persuaded to "forward" requests to services which may then be fooled into thinking that they come from the local machine. The standard portmappers provide very little in the way of access control or logging. Wietse Venema has a version of the portmapper which does provide these extra services. [Solaris 10 implements this wrapper -NNB].
The more common problems are with the RPC services themselves. They are typically appallingly badly written from the security perspective and are a common source of network weaknesses..,
Microsoft has published an advisory regarding buffer overflow vulnerability present in the windows RPC Service. The RPC service provides remote procedure calls between objects executing on two remote machines running the Windows operating system.
SCOPE
An attacker can exploit this vulnerability by crafting a specifically malformed RPC packet and sending it to a vulnerable server. The attacker will need access to the vulnerable server RPC interface that is located at port 135.A malicious attacker may use this vulnerability to execute code of his choice on the victim machine. Since the RPC service executes with SYSTEM privileges an attacker executing code as the result of this attack can fully compromise the vulnerable server
VERSIONS AFFECTED
Apply the MS03-039 patch (includes MS03-026 patch) Please refer to:
Windows NT 4.0 - All service packs
Windows 2000 - All service packs
- Microsoft Security Bulletin MS03-026 for more information: http://www.microsoft.com/technet/treeview/default.asp? url=/technet/security/bulletin/MS03-026.asp
- Microsoft Security Bulletin MS03-039 for more information: http://www.microsoft.com/technet/treeview/default.asp? url=/technet/security/bulletin/MS03-039.asp
2. Block port 135 when RPC service is not required
W32.Blaster.Worm is a worm that exploits the DCOM RPC vulnerability (first described in Microsoft Security Bulletin MS03-026)(users are recommended to patch this vulnerability by applying Microsoft Security Bulletin MS03-039) using TCP port 135. The worm targets only Windows 2000 and Windows XP machines. While Windows NT and Windows 2003 Server machines are vulnerable to the aforementioned exploit (if not properly patched), the worm is not coded to replicate to those systems. This worm attempts to download the msblast.exe file to the %WinDir%\system32 directory and then execute it. W32.Blaster.Worm does not have a mass-mailing functionality.
Copyright © 1996-2009 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
Disclaimer:
Last modified: August 09, 2009