It is actually pretty simple. The number one thing all programs should understand is to never, ever trust the user input. You ask them to enter a username, and they'll put thirty commas in. Well, if your system uses commas for dilemmas and you don't sanitize the input, your system is screwed. Some common examples:
SQL is done by text. This allows humans to interact with databases very easily, as you don't need to make a binary protocol because computers can parse text very quickly. Downfall is that people assume that their javascript will prevent a user from inputing an invalid email address. Whoops, they disabled javascript and put their email address with quotes and semicolons. Even when a language has built in functions to help with it, people still screw up.
Char strings. If you write 5,000 bytes into a 20 byte char array, your computer will let you. You'll clobber everything in the stack/heap, but your CPU won't care when it is writing. And a common problem that new users to C have with char arrays is that some functions will write up to the last byte and not append a null character at the end. Whoops, have fun next time you read that. *NOTE: Windows is changing most if not all of their strcpy/sprintf type fuctions into secure modes to help combat this.
There are tons more problems, but that is the big one. People trust the user's input too much. Users will do everything in their power, even without trying, to screw up your program. Every single action should check to make sure every part of it is correct. When reading numbers, check to make sure it is actually a number. It isn't hard to see a GET input and then change values. And if you are assuming an integer, make sure you didn't get real number instead. Check for divide by 0 for any variable that a user could control. Make sure numbers that need to be positive are positive.
Quan Chi2 - Fri Sep 15, 2006 3:49 pm
Post subject:
You're right. You made good points, and those are the points that I think should be discussed. Its so simple that its a problem. A lot of well written web applications are being exploited. So I think its a significant issue to be discussed among people in this field, computer science. He could discuss computer forensics in the part of his essay that discusses solutions, but correct me if I'm wrong.