Welcome to BARMAGY Sign in | Join | Help

The most common software security mistakes

Through my humble experience with software development I’ve seen developers making fetal security mistakes without even feeling that they are doing something wrong. So I’ve decided to gather these common mistakes in a list so it would be easier to avoid. Through this article I will give examples regardless to the used technology but the concepts applies to all technologies. So here we go

1.       Don’t hide confidential information within your code: whatever you do don’t rely on hiding information within your code because as long your code is distributed to the client then the client might do with it as s/he wishes, which includes disassembling or decompiling your code and obtaining your confidential information. The kind of confidential information that you shouldn’t hide within your code might include but is not limited to passwords, user names, connections strings, IP addresses, domain names, symmetric encryption algorithms and of course  symmetric encryption keys. And of course don’t rely on obfuscation.

2.       Don’t forget to validate user input: sounds obvious but most developers think that user input is only limited to the user controls like text boxes and submit buttons but that is not true. User input might include but not limited to server requests, browser cookies, query strings and post requests. If you are expecting a zip code entered by the user then the user won’t need special characters like (!@#$%^&*()”’;:<>) so your application must not accept them. If the user will send you a request with an integer id in the query string then you don’t need negative values so your application must not accept them. SQL injection attacks and privileges escalations might happen through cookies if you don’t validate its content properly before processing it.

3.       Don’t validate input at the client side: for example in web applications don’t validate user input using java script because the user might disable java script in his/her browser. In case of windows applications the user might be able to reverse engineer the application and reverse the validation algorithm to pass the unwanted input.

4.       Don’t send confidential information to the client side: if you send any confidential information like network credentials to the client side then the user might be able to intercept it using any means like packet sniffing and analyze it to use it to access your resources unauthorized.

5.       Don’t send user confidential data on a network without encryption: if you are sending your user credentials or any other critical data on any sort of network you better encrypt the whole connection so no one would be able to intercept the connection and extract the confidential information from it. For web applications SSL would be sufficient for non critical applications.

6.       Don’t send data to host without confirming it’s the legitimate host: for example don’t authenticate on a server without confirming it’s the legitimate one because it might be just a trap to gather your users’ credentials. Basically this is easily done with the use of Active Directory as a 3rd party to authenticate both parties and confirm for each one that the other party is the legitimate one.

7.       Don’t save any confidential information at the client side: if you saved user passwords on his/her machine and it got compromised then the attacker would obtain the user passwords with ease, so you should always encrypt any confidential data when saving it at the client side to avoid this from happening.

8.       Don’t be selfish and protect your user not only your system: most developers think always that the users are always the bad guys whom are trying to penetrate and bring down the system but it’s rarely when you find developers that think of users as victims whom might get attacked with the use of there system. XSS attacks proves this.

9.       Don’t be optimistic: don’t remove security validations because the current part is only accessed by admins, the admin account maybe highjacked and used to control the whole system that is running your application.

10.   Be paranoid: always think the worst. The more your system is critical and you want it to be secure the more you must be paranoid. Always plan for the worst, for example consider if your servers got compromised so how are you going to protect your users confidential data? What if your servers got flooded or your connections were down? What if your users got hacked and there credentials were stolen? What if your network was penetrated and what if your traffic was filtered? You must always ask your self the worst questions while designing the security schemes of your application.

Thanks for reading and I wish you have enjoyed this article. I would like to hear your opinions so your comments and feedbacks would be really appreciated.

kick it on DotNetKicks.com
Published Tuesday, September 04, 2007 1:04 AM by Fady

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# The most common software security mistakes

You've been kicked (a good thing) - Trackback from DotNetKicks.com
Tuesday, September 04, 2007 1:12 AM by DotNetKicks.com

# re: The most common software security mistakes

A very nice list which should always kept in mind when designing applications.
Tuesday, September 04, 2007 9:20 PM by Wim Haanstra

# re: The most common software security mistakes

thanks and i hope you enjoyed it :)
Wednesday, September 05, 2007 4:38 PM by Fady

# re: The most common software security mistakes

For number 3, always validate user input on the server side, but I don't think it's a bad thing to validate user input on the client as well.  You should really validate both places.  A web application with no client side validation can get really ugly.
Wednesday, September 05, 2007 7:28 PM by Matt Casto

# re: The most common software security mistakes

@Matt
thanks for the feedback
i didn't mean that validating on the client side while validating on the server side is wrong
i meant counting only on the client side validation is wrong
for example you can't authenticate a user on the client side, or check for invalid characters, XSS and sql injections on the client side without doing so on the server side
i suggest that validation at the client side should be only for usability not for security so the user don't have to wait till a web page load or till a windows applications calls a XML web service or something similar
Wednesday, September 05, 2007 11:05 PM by Fady

# re: The most common software security mistakes

Great list Fady
For #3, You have to validate on both sides, but the primary validation is the server side one, and the extra is the client side
Saturday, September 08, 2007 11:21 PM by Mohammed Hossam

# re: The most common software security mistakes

@Mohammed
thanks Mohammed
"For #3, You have to validate on both sides, but the primary validation is the server side one, and the extra is the client side "
yes thats right, i was just emphasizing that client side validation can always be bypassed
for example you can't write something like this in javascript at the client side :)
if(password == "secret")
doStuff()
Saturday, September 08, 2007 11:51 PM by Fady

# re: The most common software security mistakes

well i think its not all the scurity mistakes that software have but i really loved the list u had did and thats why i love open scoures coz it can fix others mistakes nice work and i had learn somethins new and keep writing .
Thursday, January 10, 2008 4:04 AM by mostafa

# re: The most common software security mistakes

@mostafa
thanks man, yes this is not a full list of course, it's just the most common mistakes as the way i see it, others may not agree with me and see this list from a different aspect
thanks again and i hope u enjoyed the article
Friday, January 11, 2008 4:35 AM by Fady

# re: The most common software security mistakes

FPnxPA  <a href="http://qszqltynjkwu.com/">qszqltynjkwu</a>, [url=http://pdjvzvfxbren.com/]pdjvzvfxbren[/url], [link=http://fgtceqjlplkm.com/]fgtceqjlplkm[/link], http://fefjniwcwnza.com/
Friday, March 21, 2008 4:44 PM by mwpofrq

# re: The most common software security mistakes

M6E0Xd  <a href="http://vyjgoiorvlub.com/">vyjgoiorvlub</a>, [url=http://bomcktxrjknh.com/]bomcktxrjknh[/url], [link=http://vsdpdgyoludq.com/]vsdpdgyoludq[/link], http://fllmbyvcnynx.com/
Tuesday, May 20, 2008 9:56 AM by wgebsdeymdf

# re: The most common software security mistakes

fikuKv  <a href="http://pqxmypwuwern.com/">pqxmypwuwern</a>, [url=http://ztumkpmiekmn.com/]ztumkpmiekmn[/url], [link=http://gawchfeorniv.com/]gawchfeorniv[/link], http://tbbpkubcpety.com/
Tuesday, May 20, 2008 10:44 AM by thblttmnlm

# Cheap Avodart

Hi! rather righteous employ!
[url=http://bodk2544winw.byethost13.com]avodart side effects[/url]
Best regards! ;)
Wednesday, July 02, 2008 12:56 PM by FreeAvodart

# Cheap Doxazosin

Hi! deeply advantageous labour!
[url=http://hest6544floy.0catch.com/doxazosin-used-to-treat.html]doxazosin used to treat[/url]
Best regards! ;)
Wednesday, July 02, 2008 9:59 PM by FreeDoxazosin

# Cheap Hytrin

Hi! deeply usefulness come to c clear up!
[url=http://bodk2544winw.00freehost.com/hytrin-dyspepsia.html]hytrin dyspepsia[/url]
Best regards! ;)
Thursday, July 03, 2008 1:36 PM by FreeHytrin

# Cheap Proscar

Hi! utter advantageous come to c clear up!
[url=http://lucy5480regi.100freemb.com/painful-erection-proscar.html]painful erection proscar[/url]
Best regards! ;)
Thursday, July 03, 2008 6:10 PM by FreeProscar

# Cheap Kamagra

Hi! rather advantageous come to c clear up!
[url=http://hest6544floy.byethost31.com/kamagra-st-lemon-flavour.html]kamagra st lemon flavour[/url]
Best regards! ;)
Thursday, July 03, 2008 10:33 PM by FreeKamagra

What do you think?

(required) 
required 
(required)