RE: [Dev-C++] Help with application security (hiding strings in compiled binaries)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: P.D. v. Z. <pa...@my...> - 2003-08-16 22:49:33
|
Well, it appears that if you specify your passwords as separate
characters in a character array, it won't turn up in the executable as a
string literal. I just tested this, as I was curious myself...
The following code will generate an executable with the string literal
"jack" in it, but "jill" won't show up as a literal (at least, not on my
compiler... GCC 3.2 [Dev-C++ 4.9.8.2]):
#include <iostream>
using std::cout;
using std::endl;
int main()
{
char szUser[] = "jack";
char szPass[] = { 'j', 'i', 'l', 'l', '\0'};
cout << szUser << endl;
cout << szPass << endl;
return 0;
}
Hope this helps you somewhat,
Paul
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Ed
Cottrell
Sent: Sunday, August 17, 2003 12:02 AM
To: 'Michael D. Smith'; dev...@li...
Subject: RE: [Dev-C++] Help with application security (hiding strings in
compiled binaries)
Hi Mike & others,
I know I can't make it impossible to find, but I'd like it to be more
difficult than it is. The user logging in to the database will have
limited capabilities, of course, but one (the trickiest to secure) is
SELECT capability, by necessity...
I'm not sure how I could separate the logon program from the main
program (and put it in a secured directory) without losing
functionality; the end user HAS to be able to login to the database
servers from the program itself, but without having access other than
through the program's own controls. In other words, when he/she runs my
app, he/she should then have limited access to the database, but without
knowing the authentication used to get there. If the user is going to
somehow invoke a separate login program, that requires yet another layer
of security, right? The user will be accessing some of the data over the
net, and I don't want just anybody to run a login script... (NOTE:
traffic sniffing isn't a concern with this data
- no credit cards or anything; somebody logging in and getting lots at
once, though, is).
NOTE: I don't mind encrypting it, somehow; I'm just not thrilled about
it, because it would result in definite penalties in file size,
execution speed, and development time.
How else can I make this more discrete?
-Ed
-----Original Message-----
From: Michael D. Smith [mailto:for...@hi...]
Sent: Friday, August 15, 2003 10:14 PM
To: Ed Cottrell
Subject: Re: [Dev-C++] Help with application security (hiding strings in
compiled binaries)
I've done a good bit of computer security work over the years, I first
programmed a UNIVAC 9200 in 1969, but I'm just now learning C, so from
that
perspective...
The situation is that you can't make it impossible to the truly
determined.
You might could make it take 200 people 3 years though, which is no
doubt
much, much, much better than "anyone" and "notepad"
It depends on the specifics which of course you don't want to give for
obvious reasons. The first thing that comes to my mind is you should ask
yourself "why do people logging on have access to the logon program?" If
you could stop that, that alone would go a long way towards making you
more
secure. See if you can't do something with the file/directory
permissions
to make that impossible.
YOu could store it packed (as binary) but anyone can read that as well
if
it's in a known code. I'm not 100% sure but I think putting it in a
"struct" does that in C. If not, there's certainly someway to convert
it.
They would have to be a "little" (very little) more determined to crack
it
but it could still be done. Still it's better than "anyone" and
"notepad."
Even though you don't like encoding, it certainly could work. There's a
world of possibilities out there. Just be aware, a "good" code is going
to
cost you in processing time. Maybe as much as 30 seconds per user. If
you're already at, or close to capacity that could be a hit. Of course
with
processing speed doubling every few months "they say" you're not
supposed
to worry about that. Of course with everyone not worrying about that ...
:)
And of course the current hot programming thinking is OOP (object
oriented
programming). For some reason, the way they push OOP these days leaves
out
the fact that it's purpose was/is security. But it too has security
holes
for those in the know. I guess they figure that if you don't know that's
it's purpose, you don't make it your purpose to find the security holes.
You give the users an object that only allows them to use your method
(subroutine) to access/change the database or perhaps to logon to start
with. Your subroutine of course only does access/changes that you
approve
of. I suspect this would involve rewriting the whole program which, if
your
not interested in encoding, you're probably not interested in rewriting
the
whole thing either. That too very much depends on your program being in
a
directory they don't have permission to access.
By necessity, as I don't know much C, and don't have any specifics, I've
been rather vague but if there's anything else I can do to help (yea
right:) -- write anytime.
Good luck.
ms
At 04:10 PM 8/15/03, you wrote:
>Hi,
>
>I have an application that, as one of its primary features, connects to
>numerous databases with semi-sensitive to highly sensitive info in
>them. The end users of this will be employees of a large organization,
>and they should not have ANY direct access to the databases,
>themselves. So, rather than giving them a username and password, I want
>to hard-code that into the application.
>
>This is currently being done like this (simplified pseudo code):
>
> char myconnectionstring =
> "DSN=something;server=myserver;username=myname;password=mypass";
> MyConnectionFunction(myconnectionstring);
>
>The compiled file (binary), though, contains this info in plain text.
>I.e., anybody can open it up in Notepad, find the usernames and
>passwords, and go hack the databases. That won't work.
>
>So, how can I hide those strings in the compiled code, other than
>building
>in some sort of encryption? Would building the passwords from
individual
>characters (ASCII values) work? Other ideas?
>
>Thanks!
>
>-Ed
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01
/01
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|