ropey has asked for the wisdom of the Perl Monks concerning the following question:

Hi All, Now this isnt a pure perl question as it involves the full web application (which is written in perl), I hope nobody minds me asking the question here.

Right, I have a web application, in simplest terms its a online booking engine now it allows clients to create a booking and will take the clients credit card details. However the actual money is not taken online but used by the same companies payment gateway on a internally secure network, this gateway is beyond the scope of the question.

So to try to keep things as secure as possibly GPG encryption is in place on the webservers, so theres a public key stored on the web facing servers. When a user enters there details the details are encrypted and then stored temporarily on the mysql database (which is not in DMZ).

Now a seperate server on an internal network a script checks for new bookings and if found decrypts the details using the private key on this server (passphrase are passed in on script startup so not stored in code). It then encrypts again with another GPG key of the payment gateway and passes the details to the gateway (via FTP)... at this point is is beyond my control. As soon as this is completed the credit card details are wiped from the online database as it would be wrong to leave them around.

So Question 1)
is given the circumstances above I am still leaving potential holes in the security from the web application perspective ? I have no control over the payment gateway ?

The next part is a seperate interface, this is effectively a management system and allows authorised staff to view bookings, issue vouchers and do a variety of administration tasks which are needed to do. Now this whole system is used by multi parts of a large company, not all of them have the auto payment system and thus instead of the payment details being automatically entered into the payment gateway a member of staff will check for unprocessed bookings, when they select one if they have the rights then the cc details are decrypted (again passphrase passed in on web server start) and authorised user will enter the cc details manually into the payment gateway and close the booking which results in the cc details being wiped.

Now the actual login system is pretty simple which I think is one flaw, its a simple username/password system where password is a md5 encryption, theres a series of rights a user can have to be able to view informations, and have to have certain rights to see the details. Also the users are all well inside the companies LAN so *gulp* should be trusted users, to date there have been no known abuse of this system.

Question 2)
It is vital that the authorised users have access to the details, however with what I have mentioned above am I missing something. ?

Now this whole booking engine has proved so popular among the sub companies other companies not within the secure network wish to access this *administration tool*, already a few companies have limited access, to provide this access they go to a ssl section of the online engine this is restricted by using apache allowing only access by designated IP addresses (Who I ask the current partners to provide me and I validate) as well as the htaccess file. If they get past this point then I use mod_rewrite to act as a reverse proxy to the secure server inside the LAN. However only some pages are allowed access too.

Now the company wishes to allow trusted companies to also have access to where the authorised users can view credit card system, so whilst the above procedures will stay in place then the users will be able to see cc details (before wiped of course). They would be accessing over the internet (so going to a secure area of the online engine). I am very very dubious about allowing such access, if I restrict by IP and log all access and also use htaccess is this enough ? the alternative is forcing the companies to invest in a secure vpn or such not.

Question 3)
What do you all think of the above scenario ? is it too risky that we could get compromised, can anyone suggest a better way of doing it.

I am by far no expert on security which is why I am asking this, I of course use taint checking warnings and strict for the perl code.

Your help greatly appreciated

Replies are listed 'Best First'.
Re: A question of security
by Zaxo (Archbishop) on Mar 21, 2005 at 08:53 UTC

    One thing jumps out at me from your description. I'd be wary of storing the credit card information in the database, even temporarily and even encrypted. You haven't said who can see that database, but some of your comments sound like some people can, and that the number is growing.

    I'd suggest you get some in-house review of this if you can. We can comment more if you publish the code here, but you should show it to people with some responsibility to your company, too.

    After Compline,
    Zaxo

      Hi Zaxo
      Yes in a ideal world I would agree, I am unfortunately stuck in a bad situation as I would ideally have some online payment gateway to use but thats not the case and the powers that be are happy. With access to the database, thats locked down pretty tight and everything is encrypted so I dont think thats a real risk, the risk is the users who have access to the billing system but thats the same for many other systems as well that staff can view users details... I just want to reduce the risk as much as I can
Re: A question of security
by starbolin (Hermit) on Mar 21, 2005 at 17:10 UTC

    Excellent summary but after all the analysis is complete why then is the obvious conclusion dismissed?

    alternative is forcing the companies to invest in a secure vpn or such not.

    A vpn is not very hard nor very expensive. ( well.. I'm assuming that the systems aren't too proprietary; but on M$ or *nix they aren't hard.)

    Authority indeed proceeds from true reason, reason never proceeds from authority. - John Scot Eriugena