You've installed malware, a kind that I haven't heard of before. There's a sighting report here:
Malwr - Malware Analysis by Cuckoo Sandbox
As much as I'd like to know more about it, that would take up a lot of your time and it's not what you came for. The important thing for you is to get rid of it.
Note that your "anti-virus" software failed to detect the problem. That brings out the uselessness of such products. They don't protect you; all they do is slow down and destabilize your system. According to the site I linked above, none of the commercial anti-virus products detects this malware.
Since the malware seems to be previously unknown, there are no instructions for removing it. Do not rely on anyone's opinion about that. The only safe thing for you to do is to wipe your boot volume.
Back up all data to at least two different storage devices, if you haven't already done so. One backup is not enough to be safe. The backups can be made with Time Machine or with a mirroring tool such as "Carbon Copy Cloner." Preferably both.
Boot into Recovery mode, launch Disk Utility, and erase the startup volume with the default options. This operation will destroy all data on the volume, so you had be better be sure of your backups. Quit Disk Utility and install OS X. When you reboot, you'll be prompted to go through the initial setup process. That’s when you transfer the data from one of your backups.
Transfer only "Users" and "Settings" – not "Applications" or "Other files." Don't transfer the Guest account, if it was enabled on the old system. Test to make sure the problem is resolved.
You can then reinstall your third-party software from fresh downloads or known-good copies. Don't reinstall Sophos or anything that isn't either from the Mac App Store or from a well-known developer. Any software that you installed recently is suspect.
After reinstalling the software, test again.
Finally, change every password you have and check all your financial accounts for unauthorized transactions. Do this after your system has been secured, not before.