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: Ed C. <em...@to...> - 2003-08-16 22:02:00
|
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...]=20 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=20 programmed a UNIVAC 9200 in 1969, but I'm just now learning C, so from = that=20 perspective... The situation is that you can't make it impossible to the truly = determined.=20 You might could make it take 200 people 3 years though, which is no = doubt=20 much, much, much better than "anyone" and "notepad" It depends on the specifics which of course you don't want to give for=20 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=20 secure. See if you can't do something with the file/directory = permissions=20 to make that impossible. YOu could store it packed (as binary) but anyone can read that as well = if=20 it's in a known code. I'm not 100% sure but I think putting it in a=20 "struct" does that in C. If not, there's certainly someway to convert = it.=20 They would have to be a "little" (very little) more determined to crack = it=20 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=20 world of possibilities out there. Just be aware, a "good" code is going = to=20 cost you in processing time. Maybe as much as 30 seconds per user. If=20 you're already at, or close to capacity that could be a hit. Of course = with=20 processing speed doubling every few months "they say" you're not = supposed=20 to worry about that. Of course with everyone not worrying about that ... = :) And of course the current hot programming thinking is OOP (object = oriented=20 programming). For some reason, the way they push OOP these days leaves = out=20 the fact that it's purpose was/is security. But it too has security = holes=20 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=20 (subroutine) to access/change the database or perhaps to logon to start=20 with. Your subroutine of course only does access/changes that you = approve=20 of. I suspect this would involve rewriting the whole program which, if = your=20 not interested in encoding, you're probably not interested in rewriting = the=20 whole thing either. That too very much depends on your program being in = a=20 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=20 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.=20 >The end users of this will be employees of a large organization, and = they=20 >should not have ANY direct access to the databases, themselves. So, = rather=20 >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 =3D > = "DSN=3Dsomething;server=3Dmyserver;username=3Dmyname;password=3Dmypass"; > 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,=20 >and go hack the databases. That won't work. > >So, how can I hide those strings in the compiled code, other than=20 >building >in some sort of encryption? Would building the passwords from = individual=20 >characters (ASCII values) work? Other ideas? > >Thanks! > >-Ed |