tags:

views:

137

answers:

5

Hi, I am trying to learn how to secure a web form. Take a simple example, a contact form, name, phone, email. I found this:

Secure Email Techniques

But I don't know if it is the correct way to go. It is not shared hosting, if it matters, and I have full access to everything. I am tied to IIS 6 and Windows 2000 at the moment, so I will probably need to use asp.net 2.0, but can use other languages if necessary (that can run in IIS.)

I want to be able to fill out the form and have it email/send the form to the appropriate next step (I don't know that is.)

Also, do I use port 443 for the port of the form?

EDIT: Just so I am clear. Sorry. I need the entire process secure. It's not just getting the initial form securely. I need the data from the form securely once it's entered.

EDIT: I haven't been clear enough. Once I have my data from the user which I will have gotten via 443 and SSL, I want that data sent to me over the Internet with an email. Is it possible to do that securely? Or, is it just best to have my SSL, get the data over that, and then have the user that views that information (secretary, whatever), use that same SSL socket, just with a view app?

Any help is appreciated. Thank you.

+1  A: 

You need to buy an SSL certificate and configure IIS to use that certificate and only serve the pages over an SSL conenction. This will then mean that all connections to that site are secure from the users browser to your server.

ck
A: 

An SSL certificate would work for you. You don't necessarily need to buy one because they can be "self-signed" although your uses will see one of those windows pop up telling them that the certificate isn't valid. But even though the certificate isn't valid it will still provide the same encryption that a signed certificate provides.

If you use the https protocol then the clients web browser will automatically try to connect to the web server at port 443.

Peter D
A: 

You need a SSL certificate for your site. As far as ensuring that your data is secure, make sure your form action is https://

A: 

Securing the form is always a hazard job but one of the first things you need to do is to add a CAPTCHA component, in this way the form could not be used by vulnerability scanners or bots to try to find any possible vulnerability in your code or in your server. In this way you aren't going to have thousands of e-mails from your form in a receiver mail folder.

Also try to sanitize your input data before to do anything with it, this will prevent SQL injection, XSS and others. Some languages like ASP.NET do this task just by default configuration, but if you have to code it it's not such difficult task. There are more techniques bur start with these two and the 95% of the job will be done.

If you need any other suggestion let me know.

backslash17
+1  A: 

If you've got your SSL set up for the page, that's most of the real PITA part of the job done. The user can connect on port 443, all the data they enter will be secure.

However, what most people haven't answered is the data transmission via email the transport of much of which can't be guaranteed secure - [I don't know how credible this reference is, but worth reading never-the-less: http://ask-leo.com/just_how_secure_is_email_anyway.html] so you would have to encrypt the data using some form of encryption yourself. Perhaps public/private key encryption - maybe RSA or similar. Encrypt the data using the public key, attach it to the email and mail it out. The email receiver then uses the private key to decrypt the data.

If you're using the mailto feature of the form, it's going to be time to get your hands dirty as you're likely going to need to do some coding. As far as I'm aware [and someone please correct me if I'm wrong], IIS doesn't have any ability to encrypt data going out via email - mostly because the receiving email program would likely have no way to decrypt the data, meaning that you need to specify the encryption algorithm, any keys, attachment method etc.

There are numerous libraries out there you can use to handle this. You haven't mentioned if you're programming this yourself or not, nor have you implied a programming language, but since you appear to be using Microsoft technologies, I'll point you to Microsoft's site as a reference:

http://msdn.microsoft.com/en-us/library/5e9ft273.aspx

Hopefully that should point you in the right direction. My thought is you'd need to have the site parse the entered data, encrypt it using the public key and attach it to the email.

Whoever is reading the email would then need a utility to decrypt the data using the private key. I would imagine you'd want the utility to automatically listen for incoming emails with encrypted attachments and automatically decrypt them to disk to save the person doing this manually each time. Alternatively you could have some drag/drop utility that you could drag the attachment to to view it. Just some thoughts.

BenAlabaster
I am starting to think viewing over the ssl port would be better then sending it.
johnny
I'd likely be inclined to agree with you, it's far less work... you could effectively use much the same page retooled for administrative use.
BenAlabaster