Nmap Development mailing list archives

Re: Status report #6 of 15


From: Djalal Harouni <tixxdz () gmail com>
Date: Tue, 8 Jun 2010 23:50:47 +0100

On 2010-06-08 14:57:49 +0200, Drazen Popovic wrote:
Priorities:
      * Start coding the "ndr.lua". This is crucial to avoid code
        duplication as "msrpctypes.lua"  doesn't correctly handle
        alignment of various types, as well as structure packing. Most
        of "ndr.lua" will use existing "msrpctypes.lua" code.
I have also mentioned this to Patrick in our meeting, I think that for
future code we should write a common NDR and XDR (External Data Representation) library.

This library will handle the common types shared between NDR and XDR,
and put the other stuff specific to each protocol in it's own library,
I've coded some basic functions to decode/unmarshall some of the NFS data
types and for future NFS features I'll write more code that marshall and
writes data to the network.

Notes:
As stated before, NDR translations represent the biggest issue in every
MSRPC implementation I've seen to this point. It was similar to banging
my head against the wall, every RPC procedure I made ended up with an
nca_s_fault_ndr (0x000006f7) error also known as RPC_X_BAD_STUB_DATA [],
which somewhat clearly defines the problem as bad NDR translation. So
for everyone out there fighting NDR, don't forget the ALIGNMENT (every
NDR type has one)!!! That seems to cause all the fuzz. As well as
structure packing.
So what was the solution, SAMBA code which deals with NDR and also
PYMSRPC [].
I don't know for NDR but for XDR the base type must be 4 bytes, so the
small types (int16) must be padded/packed in a 4 bytes variable, for other
big data types as strings etc they must be dividable by 4 bytes.

-- 
tixxdz
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: