It has been proved by history that software design defects have always been the major culprit in exploiting vulnerabilities. Security experts have discovered that most vulnerabilities are derived from relatively limited vulnerabilities of common software. Software developers and designers should strictly check various errors in the program and try to reduce or clear the vulnerabilities before the software deployment. The methods listed below help developers improve coding security:
1. compiler warning
The maximum warning level of the compiler should be used by programmers. During compilation, errors in the program should be modified until the warning is cleared. Static and Dynamic Analysis tools should be used to detect and clear security defects.
2. Set Software Architecture Based on security policies
The designer should create a software architecture and implement and strengthen security policies when designing the software. For example, if your system requires different privileges at different times, consider splitting the system into different subsystems that can communicate with each other. Each system has its own privileges. This "divide and conquer" method can effectively improve the security of applications.
Iii. Verification Input
The programmer must validate input from all untrusted data sources when designing the program. Appropriate input verification can clear most software vulnerabilities. When designing a program, you must be skeptical about most external data sources, including command line parameters, network interfaces, environment variables, and user-controlled files.
4. Keep the program simple
Designers should try to make the program short and concise. Complex Design increases the possibility of errors during implementation, configuration, and use. The more complex the program is, the more complicated the security control is required, and the more efforts the Enterprise will make.
5. Drop default access
Access decision-making should be based on permission rather than on any other aspect. This means that access should be denied by default, and the program's protection mechanism should confirm the access conditions based on "who is allowed to access.
6. Follow the principle of least privilege
Each processing process of a program should only use the minimum privilege required to complete its work. Any elevated permission must be kept as short as possible. This method can reduce the possibility of attackers executing arbitrary code with elevated privileges.
7. "purify" data transmitted to other systems
The so-called "purification" means to clear malicious data from the data entered by the user, such as malicious or wrong characters when the user submits the form.
Programmers must "cleanse" all data transmitted to complex subsystems (such as command shells, relational databases, and purchased commercial software components ". Attackers may use SQL Injection commands or other injection attacks to call unused functions of these components. This may not be an input verification problem because the complex subsystem called does not understand the frontend and backend relationships in the call process. Since the calling program understands the relationship between the two, we need to "purify" the data before calling the subsystem ".
8. implement in-depth defense
Program Design must be able to manage risks using multiple defense policies. Only in this way can a layer of defense be ineffective or insufficient. Another layer of Defense can prevent security design defects from being exploited, thus limiting the consequences of attackers exploiting the vulnerabilities. For example, the combination of Secure Programming Technology and secure running environment can reduce the possibility of vulnerabilities in code that may be exploited by attackers in the operating environment during deployment.
IX. Use Effective Quality Assurance Technology
Good quality assurance technology can effectively identify and clear vulnerabilities. Fuzzy testing, penetration testing, and source code auditing can all be used together as part of an effective quality assurance project. Independent security checks can make the system more secure. Qualified external reviewers can provide independent views, such as ideas that external personnel can help identify and correct errors.
Of course, to ensure code security. Enterprises should formulate and implement a set of sound coding standards for development languages and platforms.
Original Chinese TechTarget content