Following Best Coding Practices Doesn't Always Mean Better Security
wiredmikey writes "While some best practices such as software security training are effective in getting developers to write secure code, following best practices does not necessarily lead to better security, WhiteHat Security has found. Software security controls and best practices had some impact on the actual security of organizations, but not as much as one would expect, WhiteHat Security said in its Website Security Statistics Report. The report correlated vulnerability data from tens of thousands of Websites with the software development lifecycle (SDLC) activity data obtained via a survey. But there is good news — as organizations introduced best practices in secure software development, the average number of serious vulnerabilities found per Website declined dramatically over the past two years. 'Organizations need to understand how different parts of the SDLC affects how vulnerabilities are introduced during software development,' Jeremiah Grossman, co-founder and CTO of WhiteHat said. Interestingly, all the Websites tested under the study, 86 percent had at least one serious vulnerability exposed to attack every single day in 2012, and on average, resolving vulnerabilities took 193 days from the time an organization was first notified of the issue."
Asking software companies if the require their developers to adhere to "best practice" won't lead to any usefull number at all.
Or does anyone think anyone would admit to use only second-best programming standards?
Let alone the question what programming techniques count as "best practice".
bickerdyke
If secure coding could be described by a few simple rules, coders would have already been replaced by programs.
"Best practices" is such a wonderful term; its sheer flexibility permits the person invoking it to assure his audience that he meant exactly what he said, even when he didn't say much of substance.
Now if you'll excuse me, I'm late for a game of bullshit bingo.
Write failed: Broken pipe
Secure code needs a holistic view. The usual component architecture that works pretty well for reliability and correctness, but not so well for performance, fails utterly for security. What is needed is a really competent secure software expert, that can do everything from architecture down to coding and is part of the team right from the beginning. This person must also have means to enforce security. Unfortunately, people that can do this job are very rare, and most projects do not have that role anyways.
Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
Or to just cut past all the damned metaphors just because you teach your programmers not to have Bobby Drop Tables size screw ups doesn't mean there isn't a bazillion other ways they can screw up.
ACs don't waste your time replying, your posts are never seen by me.
Of course it does, and TFA even says so. Of course going to "software security training" isn't exactly a "best practice" either. Just because someone goes to a training session doesn't mean they'll learn anything.
Following best practices in code will most definitely make your code more secure. But more secure is very relative. You can still have plenty of vulnerabilities, just fewer than before.
Best practices or no, we all make mistakes, and plenty of them. It only takes one mistake to leave a hole. Whether it is a simple bug, or a design flaw. And the bad guys only need to find one flaw. So yes Best Practices help. But it doesn't mean your code is going to be Fort Knox.
I started reading the report and I quit halfway through the executive summary. This is one of those reports that says, "We documented a bunch of stuff happening. No idea why it happened, but let's speculate." I generally respect the folks at White Hat (have met several at conferences etc.) but I simply don't see the value in this report. I think they've lost track of why it's worthwhile to conduct a study in the first place. Perhaps Richard Feynman can help.
[Sir Garlon] is the marvellest knight that is now living, for he destroyeth many good knights, for he goeth invisible.
sprintf is a minefield of bad. You *have* to know how to use it correctly.
For example
char xyz1 =1;
unsigned int xyz2 = 2;
long long xyz3 = 3;
short xyz4 = 4;
char buffer[50];
sprintf(buffer, "%d %d %d %d", xyz1, xyz2, xyz3, xyz4);
That is a bad statement (especially if you are porting between platforms). with at least 6 different places for over runs and underruns. 1 place for a incorrect signed type. Your code btw returns a pointer from the stack. Which means it will just 'go away' and is subject to change. You may get lucky and it works for 'awhile' until you call something else.
Each datatype has its own % type. For example a short is %h most people do not know that (and that varies between different CRTs). The code I have above would overrun a buffer and read out too much data (off the stack probably from the buffer var or the padding between them). The first %d would do the same thing. The 3rd one would not read enough. Make those numbers bigger and I would overflow the buffer.
I learned this the *VERY* hard way (400+ statements all with over runs and under runs). Use printf/sprintf in the right way. Read the doc completely match your types exactly. It is also different on windows vs linux vs random embedded platform. After looking at about 6 different sprintf implementations they quality varies wildly from stupid to able to handle the above statement with aplomb.
Also just because you are using a 'type safe' language does not mean you are safe from this. Many just pass along to sprintf/printf so you are still subject to the same rules. Sometimes with even less control.