1

I'm thinking of writing an application that communicates sensitive information (using Python, if that's relevant). Instead of using the standard GUI libraries (like GTK, Qt or wxWidgets), I was thinking of instead making a web interface using something like web.py to run a local server and take input this way.

This would obviously only be accessible by localhost and not public.

If I'm receiving and sending very important/private data from HTML forms that get passed to this local server, is this safe, and is it any more susceptible to MITM attacks than if I were to use something that didn't involve a local server?

I'm using this application to send and recieve, as well as encrypt and decrypt GPG messages. This is something that you don't want to do using javascript. I'm hoping to do this locally using Python and displaying the messages using this local server.

So I guess my question really boils down to:

  1. Are messages sent from a local server to the browser as easy or easier to intercept than those from a regular native GUI application and

  2. Are messages encrypted by python and sent to the browser or messages sent from the browser to python to be encrypted any more secure than messages encrypt client-side using javascript

4
  • Do you have a good reason not to build a web application in the first place? Commented Mar 17, 2014 at 12:28
  • I should have included this in my post, but I plan to use encryption (GPG) in the browser. Usually this is a no no but was hoping that in this case it would be ok because its all local Commented Mar 17, 2014 at 14:01
  • @TimLamballais I'm afraid that will increase my attack surface. I need to send GPG encrypted info from and to the client, and to keep a zero-knowledge policy. Commented Mar 17, 2014 at 17:21
  • Well you should consider that introducing an extra layer in this case means dealing with two client- and two server implementations. Prima facie I'd say that increases attack surface. You should also keep in mind that hardening an actual sever you control is far easier than hardening the user's machine that's running your intermediate server implementation. Either way it's hard to give a fair assessment without extra details. Why do you want to do this? An up to date server with proper TLS + an up to date browser already provide MITM protection. Commented Mar 17, 2014 at 17:34

2 Answers 2

1

It is possible to use tcpdump to read localhost-to-localhost traffic, so I would also consider other programs running locally as possibly capable of intercepting the traffic you're going to encrypt.

0

No attacks from the outside are possible as long as you always use the localhost address (127.0.0.1) to connect to the server (and you only bind to that address too, just to be safe).

However, malicious software which may be running on your machine can still intercept localhost connections. This is very unlikely but possible.

SSL wouldn't do much good either since no certificate authority would issue a certificate for localhost which means using a self-signed certificate. This forces you to accept the Untrusted Certificate warning in your browser every time and if someone is willing and able to plant software on your machine to intercept localhost connections then they will likely also generate a fake SSL certificate which you are unlikely to notice because the warning would remain much the same.

For this reason, if security is extremely important to you, I would look at writing a GUI in Python instead, possibly using a library like pyxpcomext if you prefer writing the GUI in HTML. Or you can have a look at this SO question for more ways to achieve this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .