Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

We get that question all the time. Before we start, please note that we do not advise to ever put credentials as plain text into any kind of code. Use encrypted strings, store encrypted credentials in files or, if all else fails, prompt. Now, having said that we all know that sometimes schedules and pressure from “above” forces you to do things you normally wouldn’t do. So for the sake of argument we have created a variety of executables which use SUPERADMINUSER and SUPERSTRONGPASSWORD to run a WMI query on SUPERSECRETSERVER.

We used

  1. VBScript

    VBscript
     

  2. PowerShell

    Windows PowerShell
     

  3. C#

    C#
     

  4. C++

    C++
     

Obviously all of these won’t run in your environment unless you create a server with that name and add those credentials.
If you want to examine the resulting executable files yourself, download WMIQueryExecutables.zip here.

Now we take all these files and open them in PrimalScript as binary files and look for the user id and password, starting with the C++ version.

 

And here is your password, easily visible in the binary data:

C++: password is easily visible in the binary data

The spacing with NULL characters comes from the string being stored as unicode, so lets search for that in the C# version:

C#: password is easily visible in the binary data

 

As you can see, we didn’t have to look far. To make matters worse, if you take a disassembly tool to a .NET exe you don’t even have to read binary data:

if you take a disassembly tool to a .NET exe you don’t even have to read binary data

 

Now let’s try the script packages created by PrimalScript:

C++: script packages created by PrimalScript

and

C#: script packages created by PrimalScript

So you see, if you have to, absolutely have to put credentials somewhere, a packaged script is the way to go.
Go ahead, get the binaries and see for yourself.

If you have questions about our products, please post in our support forum.
For licensed customers, use the forum associated with your product in our Product Support Forums for Registered Customers.
For users of trial versions, please post in our Former and Future Customers - Questions forum.
Copyright © 2024 SAPIEN Technologies, Inc.