database programming security

This is a discussion on database programming security within the MySQL Database forums, part of the Database Forums category; Hello, This question has come up numerous times in my career, and I was hoping some of you out there ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-16-2007
myheartinamerica
 
Posts: n/a
Default database programming security

Hello,

This question has come up numerous times in my career, and I was
hoping some of you out there might have some additional insight.
Essentially, where should the username and password for a database be
kept for an external program that accesses it?

For example, let's say I have a compiled C or C++ program. Is it okay
to put the username and password in a #define? What's a common
solution for web apps that need to access a database?

I have no good solution for the compile program. As for the web app,
I've been using a password file kept out of the web server's root. I
have no idea whether or not that is even remotely secure.

I appreciate your input on this topic,
Mick Charles Beaver

Reply With Quote
  #2 (permalink)  
Old 05-16-2007
Gordon Burditt
 
Posts: n/a
Default Re: database programming security

>This question has come up numerous times in my career, and I was
>hoping some of you out there might have some additional insight.
>Essentially, where should the username and password for a database be
>kept for an external program that accesses it?


It often turns out that there is no good answer, especially for
a shared web server leased from a host.

>For example, let's say I have a compiled C or C++ program. Is it okay
>to put the username and password in a #define?


I got energetic and put an ENCRYPTED password in the program. But,
the program has to be able to decrypt it. This protects against
running strings(1) on the executable, but not much else. A breakpoint
set on the call to mysql_connect(), or a tricked-up libmysqlclient,
would reveal it.

>What's a common
>solution for web apps that need to access a database?


>I have no good solution for the compile program. As for the web app,
>I've been using a password file kept out of the web server's root. I
>have no idea whether or not that is even remotely secure.


A password file kept out of the web server's document root is pretty
good on a non-shared web server against web threats. Now, can
people actually log in (not via web server) to that host? That's
another threat. How about FTP?

If it's a shared web server, you have the problem that other people's
PHP (or Perl or Ruby or whatever) scripts can read the password
just like your PHP scripts.

Reply With Quote
  #3 (permalink)  
Old 05-16-2007
kwan
 
Posts: n/a
Default Re: database programming security

On May 15, 7:26 pm, gordonb.9t...@burditt.org (Gordon Burditt) wrote:
> >This question has come up numerous times in my career, and I was
> >hoping some of you out there might have some additional insight.
> >Essentially, where should the username and password for a database be
> >kept for an external program that accesses it?

>
> It often turns out that there is no good answer, especially for
> a shared web server leased from a host.
>
> >For example, let's say I have a compiled C or C++ program. Is it okay
> >to put the username and password in a #define?

>
> I got energetic and put an ENCRYPTED password in the program. But,
> the program has to be able to decrypt it. This protects against
> running strings(1) on the executable, but not much else. A breakpoint
> set on the call to mysql_connect(), or a tricked-up libmysqlclient,
> would reveal it.
>
> >What's a common
> >solution for web apps that need to access a database?
> >I have no good solution for the compile program. As for the web app,
> >I've been using a password file kept out of the web server's root. I
> >have no idea whether or not that is even remotely secure.

>
> A password file kept out of the web server's document root is pretty
> good on a non-shared web server against web threats. Now, can
> people actually log in (not via web server) to that host? That's
> another threat. How about FTP?
>
> If it's a shared web server, you have the problem that other people's
> PHP (or Perl or Ruby or whatever) scripts can read the password
> just like your PHP scripts.


Put your password in secure place and do use encryption, disable all
the services that seem to be no used. call your file from other
directory that has your password and user in.

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:38 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0