Listen to this page: audio icon

CWE (Common Weakness Enumeration)

CWE is the acronym for the Common Weakness Enumeration - This is an external link..

Top 25 Most Dangerous Software Errors

The CWE/SANS Top 25 Most Dangerous Software Errors is a list of the most widespread and critical errors that can lead to serious vulnerabilities in software. They are:

For your guide and reference, here are the Top 25 Most Dangerous Software Errors as put forward by CWE.

Click a CWE Error to expand/collapse it.
1. CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Error Description

If attackers can influence the SQL that you use to communicate with your database, then suddenly all your data belongs to them. If you use SQL queries in security controls such as authentication, attackers could alter the logic of those queries to bypass security. They could modify the queries to steal, corrupt, or otherwise change your underlying data. They'll even steal data one byte at a time if they have to, and they have the patience and know-how to do so. SQL injection is responsible for the compromises of many high-profile organizations, including Sony Pictures, PBS, MySQL.com, security company HBGary Federal, and many others.

Weakness Prevalence High
Remediation Cost Low
Attack Frequency Often
Consequences Data loss, Security bypass
Ease of Detection Easy
Attacker Awareness High
See: CWE 89 - This is an external link.
2. CWE-78: Improper Neutralization of Special Elements used in an OS Command ("OS Command Injection")
Error Description

Your software is often the bridge between an outsider on the network and the internals of your operating system. When you invoke another program on the operating system, but you allow untrusted inputs to be fed into the command string that you generate for executing that program, then you are inviting attackers to cross that bridge into a land of riches by executing their own commands instead of yours.

Weakness Prevalence Medium
Remediation Cost Medium
Attack Frequency Often
Consequences Code execution
Ease of Detection Easy
Attacker Awareness High
See: CWE-78 - This is an external link.
3. CWE-120: Buffer Copy without Checking Size of Input ("Classic Buffer Overflow")
Error Description

Buffer overflows is a reminder of that law of physics that says: if you try to put more stuff into a container than it can hold, you're going to make a mess. The scourge of C applications for decades, buffer overflows have been remarkably resistant to elimination. However, copying an untrusted input without checking the size of that input is the simplest error to make in a time when there are much more interesting mistakes to avoid. That's why this type of buffer overflow is often referred to as "classic." It's decades old, and it's typically one of the first things you learn about in Secure Programming 101.

Weakness Prevalence High
Remediation Cost Low
Attack Frequency Often
Consequences Code execution, Denial of service, Data loss
Ease of Detection Easy
Attacker Awareness High
See: - This is an external link.
4. CWE-79: Improper Neutralization of Input During Web Page Generation ("Cross-site Scripting")
Error Description

Cross-site scripting (XSS) is one of the most prevalent, obstinate, and dangerous vulnerabilities in web applications. It's pretty much inevitable when you combine the stateless nature of HTTP, the mixture of data and script in HTML, lots of data passing between web sites, diverse encoding schemes, and feature-rich web browsers. If you're not careful, attackers can inject Javascript or other browser-executable content into a web page that your application generates. Your web page is then accessed by other users, whose browsers execute that malicious script as if it came from you (because, after all, it "did" come from you). Suddenly, your web site is serving code that you didn't write. The attacker can use a variety of techniques to get the input directly into your server, or use an unwitting victim as the middle man in a technical version of the "why do you keep hitting yourself?" game.

Weakness Prevalence High
Remediation Cost Low
Attack Frequency Often
Consequences Code execution, Security bypass
Ease of Detection Easy
Attacker Awareness High
See: CWE-79 - This is an external link.
5. CWE-306: Missing Authentication for Critical Function
Error Description

In countless action movies, the villain breaks into a high-security building by crawling through heating ducts or pipes, scaling elevator shafts, or hiding under a moving cart. This works because the pathway into the building doesn't have all those nosy security guards asking for identification. Software may expose certain critical functionality with the assumption that nobody would think of trying to do anything but break in through the front door. But attackers know how to case a joint and figure out alternate ways of getting into a system.

Weakness Prevalence Common
Remediation Cost Low to High
Attack Frequency Sometimes
Consequences Security bypass
Ease of Detection Moderate
Attacker Awareness High
See: CWE-306 - This is an external link.
6. CWE-862: Missing Authorization
Error Description

Suppose you're hosting a house party for a few close friends and their guests. You invite everyone into your living room, but while you're catching up with one of your friends, one of the guests raids your fridge, peeks into your medicine cabinet, and ponders what you've hidden in the nightstand next to your bed. Software faces similar authorization problems that could lead to more dire consequences. If you don't ensure that your software's users are only doing what they're allowed to, then attackers will try to exploit your improper authorization and exercise unauthorized functionality that you only intended for restricted users. In May 2011, Citigroup revealed that it had been compromised by hackers who were able to steal details of hundreds of thousands of bank accounts by changing the account information that was present in fields in the URL; authorization would check that the user had the rights to access the account being specified. Earlier, a similar missing-authorization attack was used to steal private information of iPad owners from an AT&T site.

Weakness Prevalence High
Remediation Cost Low to Medium
Attack Frequency Often
Consequences Security bypass
Ease of Detection Moderate
Attacker Awareness High
See: CWE-862 - This is an external link.
7. CWE-798: Use of Hard-coded Credentials
Error Description

Hard-coding a secret password or cryptograpic key into your program is bad manners, even though it makes it extremely convenient - for skilled reverse engineers. While it might shrink your testing and support budgets, it can reduce the security of your customers to dust. If the password is the same across all your software, then every customer becomes vulnerable if (rather, when) your password becomes known. Because it's hard-coded, it's usually a huge pain for sysadmins to fix. And you know how much they love inconvenience at 2 AM when their network's being hacked - about as much as you'll love responding to hordes of angry customers and reams of bad press if your little secret should get out. Most of the CWE Top 25 can be explained away as an honest mistake; for this issue, though, many customers won't see it that way. The high-profile Stuxnet worm, which caused operational problems in an Iranian nuclear site, used hard-coded credentials in order to spread. Another way that hard-coded credentials arise is through unencrypted or obfuscated storage in a configuration file, registry key, or other location that is only intended to be accessible to an administrator. While this is much more polite than burying it in a binary program where it can't be modified, it becomes a Bad Idea to expose this file to outsiders through lax permissions or other means.

Weakness Prevalence Medium
Remediation Cost Medium to High
Attack Frequency Rarely
Consequences Security bypass
Ease of Detection Moderate
Attacker Awareness High
See: CWE-798 - This is an external link.
8. CWE-311: Missing Encryption of Sensitive Data
Error Description

Whenever sensitive data is being stored or transmitted anywhere outside of your control, attackers may be looking for ways to get to it. Thieves could be anywhere - sniffing your packets, reading your databases, and sifting through your file systems. If your software sends sensitive information across a network, such as private data or authentication credentials, that information crosses many different nodes in transit to its final destination. Attackers can sniff this data right off the wire, and it doesn't require a lot of effort. All they need to do is control one node along the path to the final destination, control any node within the same networks of those transit nodes, or plug into an available interface. If your software stores sensitive information on a local file or database, there may be other ways for attackers to get at the file. They may benefit from lax permissions, exploitation of another vulnerability, or physical theft of the disk. You know those massive credit card thefts you keep hearing about? Many of them are due to unencrypted storage.

Weakness Prevalence High
Remediation Cost Medium
Attack Frequency Sometimes
Consequences Data loss
Ease of Detection Easy
Attacker Awareness High
See: CWE-311 - This is an external link.
9. CWE-434: Unrestricted Upload of File with Dangerous Type
Error Description

You may think you're allowing uploads of innocent images (rather, images that won't damage your system - the Interweb's not so innocent in some places). But the name of the uploaded file could contain a dangerous extension such as .php instead of .gif, or other information (such as content type) may cause your server to treat the image like a big honkin' program. So, instead of seeing the latest paparazzi shot of your favorite Hollywood celebrity in a compromising position, you'll be the one whose server gets compromised.

Weakness Prevalence Common
Remediation Cost Medium
Attack Frequency Sometimes
Consequences Code execution
Ease of Detection Moderate
Attacker Awareness Medium
See: CWE-434 - This is an external link.
10. CWE-807: Reliance on Untrusted Inputs in a Security Decision
Error Description

In countries where there is a minimum age for purchasing alcohol, the bartender is typically expected to verify the purchaser's age by checking a driver's license or other legally acceptable proof of age. But if somebody looks old enough to drink, then the bartender may skip checking the license altogether. This is a good thing for underage customers who happen to look older. Driver's licenses may require close scrutiny to identify fake licenses, or to determine if a person is using someone else's license. Software developers often rely on untrusted inputs in the same way, and when these inputs are used to decide whether to grant access to restricted resources, trouble is just around the corner.

Weakness Prevalence High
Remediation Cost Medium
Attack Frequency Often
Consequences Security bypass
Ease of Detection Moderate
Attacker Awareness High
See: CWE-807 - This is an external link.
11. CWE-250: Execution with Unnecessary Privileges
Error Description

Your software may need special privileges to perform certain operations, but wielding those privileges longer than necessary can be extremely risky. When running with extra privileges, your application has access to resources that the application's user can't directly reach. For example, you might intentionally launch a separate program, and that program allows its user to specify a file to open; this feature is frequently present in help utilities or editors. The user can access unauthorized files through the launched program, thanks to those extra privileges. Command execution can happen in a similar fashion. Even if you don't launch other programs, additional vulnerabilities in your software could have more serious consequences than if it were running at a lower privilege level.

Weakness Prevalence Medium
Remediation Cost Medium
Attack Frequency Sometimes
Consequences Code execution
Ease of Detection Moderate
Attacker Awareness High
See: CWE-250 - This is an external link.
12. CWE-352: Cross-Site Request Forgery (CSRF)
Error Description

Cross-site request forgery occurs when the attacker tricks a user into activating a request that goes to your site. Thanks to scripting and the way the web works in general, the user might not even be aware that the request is being sent. But once the request gets to your server, it looks as if it came from the user, not the attacker. This might not seem like a big deal, but the attacker has essentially masqueraded as a legitimate user and gained all the potential access that the user has. This is especially handy when the user has administrator privileges, resulting in a complete compromise of your application's functionality. When combined with XSS, the result can be extensive and devastating. If you've heard about XSS worms that stampede through very large web sites in a matter of minutes (like Facebook), there's usually CSRF feeding them.

Weakness Prevalence High
Remediation Cost High
Attack Frequency Often
Consequences Data loss, Code execution
Ease of Detection Moderate
Attacker Awareness Medium
See: CWE-352 - This is an external link.
13. CWE-22: Improper Limitation of a Pathname to a Restricted Directory ("Path Traversal")
Error Description

While data is often exchanged using files, sometimes you don't intend to expose every file on your system while doing so. When you use an outsider's input while constructing a filename, the resulting path could point outside of the intended directory. An attacker could combine multiple ".." or similar sequences to cause the operating system to navigate out of the restricted directory, and into the rest of the system.

Weakness Prevalence Widespread
Remediation Cost Low
Attack Frequency Often
Consequences Code execution, Data loss, Denial of service
Ease of Detection Easy
Attacker Awareness High
See: CWE-22 - This is an external link.
14. CWE-494: Download of Code Without Integrity Check
Error Description

If you download code and execute it, you're trusting that the source of that code isn't malicious. Maybe you only access a download site that you trust, but attackers can perform all sorts of tricks to modify that code before it reaches you. They can hack the download site, impersonate it with DNS spoofing or cache poisoning, convince the system to redirect to a different site, or even modify the code in transit as it crosses the network. This scenario even applies to cases in which your own product downloads and installs its own updates. When this happens, your software will wind up running code that it doesn't expect, which is bad for you but great for attackers.

Weakness Prevalence Medium
Remediation Cost Medium to High
Attack Frequency Rarely
Consequences Code execution
Ease of Detection Moderate
Attacker Awareness Low
See: CWE-494 - This is an external link.
15. CWE-863: Incorrect Authorization
Error Description

While the lack of authorization is more dangerous, incorrect authorization can be just as problematic. Developers may attempt to control access to certain resources, but implement it in a way that can be bypassed. For example, once a person has logged in to a web application, the developer may store the permissions in a cookie. By modifying the cookie, the attacker can access other resources. Alternately, the developer might perform authorization by delivering code that gets executed in the web client, but an attacker could use a customized client that removes the check entirely.

Weakness Prevalence High
Remediation Cost Low to Medium
Attack Frequency Often
Consequences Security bypass
Ease of Detection Moderate
Attacker Awareness High
See: CWE-863 - This is an external link.
16. CWE-829: Inclusion of Functionality from Untrusted Control Sphere
Error Description

The idea seems simple enough: you can make a lot of smaller parts of a document (or program), then combine them all together into one big document (or program) by "including" or "requiring" those smaller pieces. This is a common enough way to build programs. Combine this with the common tendency to allow attackers to influence the location of some of these pieces - perhaps even from the attacker's own server - then suddenly you're importing somebody else's code.

Weakness Prevalence High
Remediation Cost Low to Medium
Attack Frequency Often
Consequences Security bypass
Ease of Detection Moderate
Attacker Awareness High/td>
See: CWE-829 - This is an external link.
17. CWE-732: Incorrect Permission Assignment for Critical Resource
Error Description

It's rude to take something without asking permission first, but impolite users (i.e., attackers) are willing to spend a little time to see what they can get away with. If you have critical programs, data stores, or configuration files with permissions that make your resources readable or writable by the world - well, that's just what they'll become. While this issue might not be considered during implementation or design, sometimes that's where the solution needs to be applied. Leaving it up to a harried sysadmin to notice and make the appropriate changes is far from optimal, and sometimes impossible.

Weakness Prevalence Medium
Remediation Cost Low to High
Attack Frequency Often
Consequences Data loss, Code execution
Ease of Detection Easy
Attacker Awareness High
See: CWE-732 - This is an external link.
18. CWE-676: Use of Potentially Dangerous Function
Error Description

Safety is critical when handling power tools. The programmer's toolbox is chock full of power tools, including library or API functions that make assumptions about how they will be used, with no guarantees of safety if they are abused. If potentially-dangerous functions are not used properly, then things can get real messy real quick.

Weakness Prevalence High
Remediation Cost Medium
Attack Frequency Rarely
Consequences Data loss, Code execution
Ease of Detection Easy
Attacker Awareness High
See: CWE-676 - This is an external link.
19. CWE-327: Use of a Broken or Risky Cryptographic Algorithm
Error Description

If you are handling sensitive data or you need to protect a communication channel, you may be using cryptography to prevent attackers from reading it. You may be tempted to develop your own encryption scheme in the hopes of making it difficult for attackers to crack. This kind of grow-your-own cryptography is a welcome sight to attackers. Cryptography is just plain hard. If brilliant mathematicians and computer scientists worldwide can't get it right (and they're always breaking their own stuff), then neither can you. You might think you created a brand-new algorithm that nobody will figure out, but it's more likely that you're reinventing a wheel that falls off just before the parade is about to start.

Weakness Prevalence High
Remediation Cost Medium to High
Attack Frequency Rarely
Consequences Data loss, Security bypass
Ease of Detection Moderate
Attacker Awareness Medium
See: CWE-327 - This is an external link.
20. CWE-131: Incorrect Calculation of Buffer Size
Error Description

In languages such as C, where memory management is the programmer's responsibility, there are many opportunities for error. If the programmer does not properly calculate the size of a buffer, then the buffer may be too small to contain the data that the programmer plans to write - even if the input was properly validated. Any number of problems could produce the incorrect calculation, but when all is said and done, you're going to run head-first into the dreaded buffer overflow.

Weakness Prevalence High
Remediation Cost Low
Attack Frequency Often
Consequences Code execution, Denial of service, Data loss
Ease of Detection Easy to Moderate
Attacker Awareness High
See: CWE-131 - This is an external link.
21. CWE-307: Improper Restriction of Excessive Authentication Attempts
Error Description

Attackers may try to break into your account by writing programs that repeatedly guess different passwords. Without some kind of protection against brute force techniques, the attack will eventually succeed. You don't have to be advanced to be persistent.

Weakness Prevalence High
Remediation Cost Medium
Attack Frequency Sometimes
Consequences Code execution, Data loss, Denial of service
Ease of Detection Easy
Attacker Awareness Medium
See: CWE-307 - This is an external link.
22. CWE-601: URL Redirection to Untrusted Site ("Open Redirect")
Error Description

Weakness Prevalence High
Remediation Cost Medium
Attack Frequency Sometimes
Consequences Code execution, Data loss, Denial of service
Ease of Detection Easy
Attacker Awareness Medium
See: CWE-601 - This is an external link.
23. CWE-134: Uncontrolled Format String
Error Description

The mantra is that successful relationships depend on communicating clearly, and this applies to software, too. Format strings are often used to send or receive well-formed data. By controlling a format string, the attacker can control the input or output in unexpected ways - sometimes, even, to execute code.

Weakness Prevalence High
Remediation Cost Medium
Attack Frequency Sometimes
Consequences Code execution, Data loss, Denial of service
Ease of Detection Easy
Attacker Awareness Medium
See: CWE-134 - This is an external link.
24. CWE-190: Integer Overflow or Wraparound
Error Description

Weakness Prevalence Common
Remediation Cost Low
Attack Frequency Sometimes
Consequences Denial of service, Code execution, Data loss
Ease of Detection Easy
Attacker Awareness High
See: CWE-190 - This is an external link.
25. CWE-759: Use of a One-Way Hash without a Salt
Error Description

Salt is good for your password security. Instead of storing passwords in plain text, a common practice is to apply a one-way hash, which effectively randomizes the output and can make it more difficult if (or when?) attackers gain access to your password database. If you don't add a little salt to your hash, then the health of your application is in danger.

Weakness Prevalence Medium
Remediation Cost Medium to High
Attack Frequency Rarely
Consequences Security bypass
Ease of Detection Moderate
Attacker Awareness High
See: CWE-759 - This is an external link.

References

▲ Top