Well, this time, it didn’t rain. :-) However, due to major communication breakdowns (caused by someone *cough, cough* not following up when he should have), attendance was minimal. Mike Stewart, from the FoxPro test team, was kind enough to give his presentation anyway for the benefit of those who weren’t scared away by the late notice.
His presentation was entitled “Security for Visual FoxPro Applications”, and he originally gave it at DevCon a couple of years ago. Rather than being a way to secure your applications as such, though, it was an overview of what developers needed to know about securing Windows in general.
The first thing he touched on was Physical Security. If an attacker can walk out with your computer, or even just your hard drive, he can break your security at his leisure. If he has time to reboot your computer with a Linux boot disk, he can mount your NTFS drive and read the data without logging in. One way to slow an attacker down is simply to lock your workstation. It’s as simple as hitting Windows+L in later versions of Windows: that will bring you back to a login screen.
Strong passwords are important. Don’t choose passwords that can be trivially cracked by a dictionary attack (literally going through the dictionary trying words): add mixed case letters, numbers, and special characters. Don’t just choose something like FoxRocks!1, and then change it to FoxRocks!2 - that’s trivial to crack. Windows 9x systems have compatibility with LANMAN: unfortunately, this puts huge gaping holes in password security when it upper-cases the password and breaks it into 7-character chunks. In the above example, that leaves “FOXROCK” vulnerable to a dictionary attack, and “S!3″ is much easier to crack. The passwords are stored in the SAM file. This touches again on physical security, because if an attacker can take that file away on a floppy, it’s game over. The important thing here is to Educate Your Users.
The next important thing is to use the least privileges you can get away with. In other words, don’t run as Local Admin! Unfortunately, this is difficult, since some programs are not well-behaved when you aren’t an administrator. One way to get around this is to use the RunAs command. You can either right-click on the EXE and choose Run As… and select an administrator account, or you can use “runas /user:Admin program.exe” from a command prompt.
The Microsoft Baseline Security Analyzer will analyze your system and tell you what you have and haven’t done to secure your system.
Social engineering: what do you do if someone says “hey, this is the helpdesk, can you verify your password for us?” The important thing to remember here is that you _never_ need to give your password away: if they have a need to know, they already have the rights that will enable them to do their job without asking.
Cryptography: don’t try to roll your own. Unless you’re a crypto expert, you’ll probably get it wrong. VFP ships with a Foundation Class to help you encrypt your data: _crypt.vcx. Remember, though, that encryption will slow your access down a lot, so try to avoid it.
Buffer overflows are not an issue for Fox apps, since you work within the VFP runtime, rather than doing direct memory access.
Mike recommended SecurityFocus.com as a good resource: one of the things they’ve talked about has been that COM+ can handle security for your DLLs without needing to roll it all yourself. Mike recommends handling setup programatically, since you can get a bit better control that way.
Cross-site scripting is EEEEEVIL! Some web sites are vulnerable to being sent script commands instead of the expected data. One unnamed site (which I could supply the name for myself, having seen the cookie bounced back to my screen on occasion) used to store the logon password in plaintext on a cookie on the machine. A cross-site scripting attack could have caused this information to be submitted to a hacker’s site.
SQL Injection: this involves sending commands to a SQL engine, instead of just data. For example, say that you have the command “SELECT * FROM table WHERE name = ‘&lcSubmittedName’” - what happens if lcSubmittedName = “Fred’ AND EXECSCRIPT(’RUN FORMAT C:\’)”? (Syntax not quite correct, but you get the idea.)
DBCs should always be set to Read-Only. There is no reason to write to a DBC at run-time, but if you do, you could be hacking the DBC_BeforeOpenTable() event to do something nasty. It’s also possible to hack the backlink in the tables to point to a different dbc, with that same evil code in the DBC events. It’s a bit harder to make a DBF read-only: most apps would object to this. It’s possible to write code to verify the backlink when opening the tables, though.
Mike will be sending his slide deck to be posted on the group’s web site in a couple of days: it includes a bunch of links to useful security sites.