Code Monkey home page Code Monkey logo

dcerpc's Introduction

macOS Status Linux Status Coverity Status

DCE/RPC

This project is a fork of the Likewise DCE/RPC renovation. The Likewise git repository was once available here and can probably still be found somewhere on the internet.

Build notes

The build system for DCE/RPC is relatively complex, partly due to the use of automake and libtool and partly because it does a lot of code generation.

Xcode does not support this sort of thing particularly well, so we make heavy use of shell script build phases and "workarounds".

Our basic approach to cross-compilation is to separate the build into two phases. We have a dceidl project that builds the IDL compiler and installs it into the SDK. Then we have the dcerpc project that builds the DCERPC framework using the previously installed IDL compiler.

The dcerpc and dceidl projects should typically by run with different build architectures, since dceidl is expected to run on the build host, and dcerpc is expected to run on the target host. Inside Apple, the build group has all this preconfigured.

We assume that the IDL compiler is actually an IDL cross-compiler. This assumption is valid because the autotools build system uses the "generic" architecture, and everything that depends on the target architecture is determined at compilation time without the use of autoconf tests.

We do use autoconf tests to select available features when we are building the DCERPC framework, and this relies on the fact that features vary between target SDKs, but not between target architectures. You can only target a single SDK, and within that SDK, the feature set is constant, and independent of the suported architecture. Therefore it is valid to do a single configure pass followed by a multi-architecture build.

On macOS, the Homebrew versions of Flex and Bison are required, since the versions shipped with the base system are too old.

Build instructions are on the website here.

DCE/RPC Documentation

Open Group documentation

C706 is the primary specification for DCE/RPC 1.1. This document describes the concepts, protocol and internal mechanisms of the RPC architecture. The Open Group also has the DCE 1.2.2 documentation set available for purchase. This contains some useful RPC information, particularly in the Application Development Guide.

Microsoft documentation

Since DCE/RPC is the basis for the Windows RPC implementation, Microsoft provide a lot of useful documentation. Windows extensions to the DCE/RPC protocols are documented in MS-RPCE. The Remote Procedure Call section of MSDN provides a wealth of information about the Windows RPC implementation. The O'Reilly Microsoft RPC programming guide is a nice introduction to RPC programming on Windows. Most of it can be directly applied to DCE/RPC just by changing the function names.

Other documentation

The RPC Internals document is dated and incomplete, but provides a useful insight into some of the source code architecture and conventions.

The porting guide contains some historical information about porting DCE/RPC to new platforms. It's not particularly relevant any more, but it occasionally explains some of the rationale for the strange things that you find in the source.

dcerpc's People

Contributors

ataridreams avatar bsuinn avatar jpeach avatar kapilth avatar philippelatulippe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dcerpc's Issues

[dcerpc + cuda 11] Crash in rpc_string_binding_compose when establishing a connection

Hello

I am stuck on an issue since we upgraded our software dependencies from cuda 10.1 to cuda 11.7 (in order to support the lastest NVidia GPU).

I was able to simplify the faulty code enough to write a simple test underlining the issue.

To sum up :
I wrote a dcerpc client which establish a connection with a distant server. The code works fine, unless I link with some NVidia Cuda libraries. In this case, when estabishing a connection, a thread cannot be created (#define EINVAL 22 /* Invalid argument */), and dcethread__delete crashed (probably because the thread is null and this case is not correctly handled).

And we are stuck here.

I don't know why the behavior changes when the app is linked with 4 specifics cuda lib (we need all of them 4).

By any chance can someone help us ?

Release bits

Can you build and release the binary for consumption. I am intereated in dcerpcd service. I am taking a dependency on this and want my users to be able to download binary directly rather than building it locally.

Does not compile on macOS 10.13.3

When attempting to compile on 10.13.3, I am getting errors on both CFStringEncodingConverter and wc16str. It looks like the CF framework was removed from macOS and is causing those errors. Additional errors include:

ld: library not found for -lCrashReporterClient
clang: error: linker command failed with exit code 1 (use -v to see invocation)

dcerpc-opensource/dcerpc/ncklib/gssauthcn.h:100:10: fatal error: 'GSS/gssapi_spi.h' file not found
#include <GSS/gssapi_spi.h>

gssapi_spi appears to be part of the Heimdal private framework.

Any suggestion on getting the framework to compile on macOS 10.13?

DCE-rpc package

Is there a package for unbuntu or any Linux Distro where I can directly download the bits without requiring to build locally?

Build Fails

I am using Ubuntu and build fails when making idl_compiler
this is the error when I run make

  CC       libdcethread_la-dcethread_frame_push.lo
  CC       libdcethread_la-dcethread_frame_pop.lo
  CCLD     libdcethread.la
libtool: warning: '-version-info/-version-number' is ignored for convenience libraries
ar: `u' modifier ignored since `D' is the default (see `U')

Making all in idl_compiler

make  all-am

  CC       acf_y.o
In file included from ./nidl.h:179:0,
                 from acf_y.y:112:
./nidlmsg.h:79:1: warning: "/*" within comment [-Wcomment]
 /*!  NAME:                                                                    */
 ^
In file included from acf_y.y:118:0:
./nidlmsg.h:79:1: warning: "/*" within comment [-Wcomment]
 /*!  NAME:                                                                    */
 ^
acf_y.y: In function ‘acf_parser_alloc’:
acf_y.y:1299:19: warning: unused parameter ‘cmd_val_arr’ [-Wunused-parameter]
     void        **cmd_val_arr,  /* [in] Array of command option values */
                   ^
  CC       acf_l.o
In file included from ./nidl.h:179:0,
                 from acf_l.l:99:
./nidlmsg.h:79:1: warning: "/*" within comment [-Wcomment]
 /*!  NAME:                                                                    */
 ^
In file included from acf_l.l:100:0:
acf_y.h:118:18: error: unknown type name ‘acf_parser_state_t’
 int acf_yyparse (acf_parser_state_t * acf);
                  ^
In file included from acf_l.l:102:0:
./nidlmsg.h:79:1: warning: "/*" within comment [-Wcomment]
 /*!  NAME:                                                                    */
 ^
acf_l.c: In function ‘yy_get_next_buffer’:
acf_l.c:1411:47: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
                                               ^
acf_l.l: At top level:
acf_l.c:1491:17: warning: ‘yyunput’ defined but not used [-Wunused-function]
     static void yyunput (int c, char * yy_bp , yyscan_t yyscanner)
                 ^
acf_l.c:1539:16: warning: ‘input’ defined but not used [-Wunused-function]
     static int input  (yyscan_t yyscanner)

Switching kerberos cache

I am using the dceprc project in my open source project to submit certificate signing requests to Active Directory:

https://bitbucket.org/twocanoes/tcscertrequest

The user sometimes has multiple kerberos cache's and i'd like to be able to switch between them prior to submitting the certificate request. However, after the app is running, running kswitch to switch the default credential store doesn't change the credentials used when submitting the request. It is possible to set rpc_c_authz_name in rpc_binding_set_auth_info to use a different kerberos principal? Is there a better way to approach this?

Here is what I am doing (error checking/et al removed for clarity):

protocol_family = "ncacn_ip_tcp";

sprintf(partial_string_binding, "%s:%s[]",
        protocol_family,
        servername);

rpc_binding_from_string_binding((unsigned char *)partial_string_binding,
                                &binding_handle,
                                &status);

snprintf((char *)server_princ_name,1024,"host/%s",servername);

rpc_ep_resolve_binding(binding_handle,
                       ICertPassage_v0_0_c_ifspec,
                       &status);

 
rpc_binding_set_auth_info(binding_handle,
                          (unsigned_char_p_t)server_princ_name,
                          authn_level,
                          authn_protocol,
                          NULL,
                          rpc_c_authz_name,
                          &status);
    
DWORD dwFlags=0xFF;

char *pwszAuthority=calloc(1024,1);
c_to_utf16((char*)ca_name,(char *)pwszAuthority,&outlength);

pctbRequest.pb=(unsigned char *)[inCSR bytes];
pctbRequest.cb=(unsigned int)inCSR.length;

int attribute_string_len;
char *c_attributes=calloc(1024,1);
sprintf(c_attributes, "CertificateTemplate:%s",cert_template);
char *attributes=calloc(2048,1);

c_to_utf16(c_attributes,attributes,&attribute_string_len);
pctbAttribs.pb=(unsigned char *)attributes; 
pctbAttribs.cb=attribute_string_len+2;

DCETHREAD_TRY {
    DWORD outstatus=CertServerRequest(binding_handle,dwFlags,(unsigned short *)pwszAuthority,&pdwRequestId,&pdwDisposition,&pctbAttribs,&pctbRequest,&pctbCert,&pctbEncodedCert,&pctbDispositionMessage);
}

buildconf is missing from the source

As per instructions for Linux:
To build on Linux or other UNIX-like systems, use the autotools build system.

~/dcerpc.git $ cd dcerpc
~/dcerpc.git $ ./buildconf
~/dcerpc.git $ ./configure && make
~/dcerpc.git $ sudo make install

buildconf is missing in the distribution, making this source code impossible to build on Linux.

Can't Browse remote SMB shares on OSX.

I am having an issue connecting to a specific SMB server from OSX El Capitan (10.11.6). I am able to connect to and browse shares on other servers. So, I am trying to figure out what is wrong with the problem SMB server. I'm assuming this library is used on OSX due to the error code that appears in the console log. See below.

I have traced the session traffic between OSX and both these servers and the traffic looks good, and mostly similar, yet OSX will not issue the DCE bind request to srvsvc in the bad case. Rather it will negotiate the session, connect to the IPC share, open the srvsvc pipe, but then promptly disconnects from the share.

I am trying to connect using the Finder and "Connect to Server...". In the failure case, I will receive the following popup:

"there was a problem connecting to the server "badserver".

"There are no shares available or you are not allowed to access them on the server. Please contact your system administrator to resolve the problem"

If I look at the console log messages, there is one clue:

8/29/16 9:50:36.072 AM NetAuthSysAgent[74269]: RPC to srvsrvc gave error 0x16c9a034

Some research points to the error 0x16c9034 being a rpc_s_cannot_connect. Unfortunately, not very helpful.

The perplexing part is that the OSX stack has found the server, successfully authenticated, mounted the IPC share, AND opened the srvsvc file. But fails to issue the Bind request and netshareenum. I am not sure why it cannot connect although I have a suspicion. I am hoping somone has some experience with the SMB stack in OSX. I'm assuming it's the LikeWise stack (PBIS) from powerbroker and I've browsed through that code looking for clues but I end up lost in the weeds.

I can't upload the wireshark pcap files but I can email them if someone wants to take a look. I'll discuss them here instead.

In the Good scenario, I see:

  1. Negotiate Request
  2. Negotiate Response (success)
  3. Setup Request
  4. Setup Response (more processing required)
  5. Setup Request
  6. Setup Response (success)
  7. Tree Connect (IPC)
  8. Tree Connect Response (success)
  9. Create Request (srvsvc)
  10. Create Response (success)
  11. DCE Bind Request
  12. DCE Bind Response
  13. NetShareEnum Request
  14. NetShareEnum Response

In the Bad scenario, I see the following:

  1. Negotiate Request (same as good scenario)
  2. Negotiate Response (similar, but not returning a security blob. Not negotiating GSSAPI/SPNEGO)
  3. Setup Request (same as good scenario)
  4. Setup Response (more processing required, and with NTLMv2 security blob. Not wrapped in GSSAPI/SPNEGO)
  5. Setup Request (valid NTLMv2 Security Response)
  6. Setup Response (success)
  7. Tree Connect Request (IPC) (same as good scenario)
  8. Tree Connect Response (success)
  9. Create Request (srvsvc) (same as good scenario)
  10. Create Response (success)
  11. Tree Disconnect Request (IPC) (here is the question. WHY??? Why won't it go forward with the bind request)
  12. Tree Disconnect Response (success)

The hypothesis I have is that the OSX SMB stack will not send a bind request on a session that has not negotiated GSSAPI/SPNEGO. Is that true? Does anyone have any visibility into this? Is there any way to enable more verbose logging of the stack? Is there source code for the OSX stack that perhaps I could instrument to see what is going on. I've tried to build dcerpc for OSX but it appears some updates are needed to get it to compile with the GSS framework supplied with OSX 10.11.6.

Any help is greatly appreciated.

** BUILD FAILED **

Hello, I tried to build the project on Mac OS X. But when I run the command xcodebuild -configuration Debug -target dceidl I get the error message ** BUILD FAILED ** with the description

/projects/dcerpc.git/BuildConfig/run-autoconf: line 130: ./buildconf: No such file or directory run-autoconf: error: buildconf failed

I can't find a buildconf in the project. Is it missing?

Error while running greet_server

I'm running on ubuntu-18.04.2-desktop-amd64, and following the instructions of DCE 1.2.2 documentation set, F201.
After successful compiling, when I run greet_server, I get this error:
Error: Can’t use protocol sequences - rpc_s_cant_listen_socket (dce / rpc)

Why is this happening? I also run dcerpcd with no arguments, so all protseqs are listened on.

You owe me 4 months of work and 5 Macs!!! Irreperable damages!

/System/Library/PrivateFrameworks/DCERPC.framework

Yeah bro... I ain't no fucking coder... That dumbass file right there cost me the last 4 months of fucking work and my parent called a shrink on me.. You don't know what the fuck your doing, pull this shit off the internet you fucking idiot. And I still haven't removed the shit... Broke 5 of my Macs fighting off the backdoor your dumbass opens up every day!!

Shit ain't fucking funny, you don't even have a download to fix the shit on your site, what an asshole... **

RPC is a CVE lister from March you DICK! OWN UP!

**

License file

Hi I don't see any license file. Can you post a license file?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.