`

Top 10 Secure Coding Practices

阅读更多
https://www.securecoding.cert.org/confluence/display/seccode/Top+10+Secure+Coding+Practices

1 Validate input. Validate input from all untrusted data sources. Proper input validation can eliminate the vast majority of software vulnerabilities. Be suspicious of most external data sources, including command line arguments, network interfaces, environmental variables, and user controlled files [Seacord 05].
2 Heed compiler warnings. Compile code using the highest warning level available for your compiler and eliminate warnings by modifying the code [C MSC00-A, C++ MSC00-A]. Use static and dynamic analysis tools to detect and eliminate additional security flaws.
3 Architect and design for security policies. Create a software architecture and design your software to implement and enforce security policies. For example, if your system requires different privileges at different times, consider dividing the system into distinct intercommunicating subsystems, each with an appropriate privilege set.
4 Keep it simple. Keep the design as simple and small as possible [Saltzer 74, Saltzer 75]. Complex designs increase the likelihood that errors will be made in their implementation, configuration, and use. Additionally, the effort required to achieve an appropriate level of assurance increases dramatically as security mechanisms become more complex.
5 Default deny. Base access decisions on permission rather than exclusion. This means that, by default, access is denied and the protection scheme identifies conditions under which access is permitted [Saltzer 74, Saltzer 75].
6 Adhere to the principle of least privilege. Every process should execute with the the least set of privileges necessary to complete the job. Any elevated permission should be held for a minimum time. This approach reduces the opportunities an attacker has to execute arbitrary code with elevated privileges [Saltzer 74, Saltzer 75].
7 Sanitize data sent to other systems. Sanitize all data passed to complex subsystems [C STR02-A] such as command shells, relational databases, and commercial off-the-shelf (COTS) components. Attackers may be able to invoke unused functionality in these components through the use of SQL, command, or other injection attacks. This is not necessarily an input validation problem because the complex subsystem being invoked does not understand the context in which the call is made. Because the calling process understands the context, it is responsible for sanitizing the data before invoking the subsystem.
8 Practice defense in depth. Manage risk with multiple defensive strategies, so that if one layer of defense turns out to be inadequate, another layer of defense can prevent a security flaw from becoming an exploitable vulnerability and/or limit the consequences of a successful exploit. For example, combining secure programming techniques with secure runtime environments should reduce the likelihood that vulnerabilities remaining in the code at deployment time can be exploited in the operational environment [Seacord 05].
9 Use effective quality assurance techniques. Good quality assurance techniques can be effective in identifying and eliminating vulnerabilities. Fuzz testing, penetration testing, and source code audits should all be incorporated as part of an effective quality assurance program. Independent security reviews can lead to more secure systems. External reviewers bring an independent perspective; for example, in identifying and correcting invalid assumptions [Seacord 05].
10 Adopt a secure coding standard. Develop and/or apply a secure coding standard for your target development language and platform.
分享到:
评论

相关推荐

    Core Software Security: Security at the Source

    Secure Coding Frameworks (APIs) Manual Code Review Independent Code Review and Testing (by Experts or Third Parties) Static Analysis Risk Assessment Methodology Integration of SDL with SDLC ...

    OWASP,以开源的方式支撑企业应用安全体系化建设.pdf

    除了OWASP Top 10,OWASP还提供诸如OWASP Secure Coding Practices - Quick Reference Guide的指南,其中总结了安全编程的最佳实践;OWASP Application Security Verification Standard(ASVS)提供了一套安全验证...

    信息安全_数据安全_OWASP SAMM.pdf

    OWASP Secure Coding Practices - Quick Reference Guide提供了安全编码的最佳实践;OWASP ASVS(Application Security Verification Standard)为应用安全验证设定了标准;OWASP Testing Guide和OWASP Code Review ...

    www-chapter-austin:OWASP Foundation Web存储库

    7. **OWASP指导原则**:OWASP提供了诸如OWASP Secure Coding Practices Quick Reference Guide这样的资源,帮助开发者遵循最佳安全实践。 8. **安全开发生命周期**(SDLC):将安全实践融入到整个软件开发生命周期...

    php.ini-development

    best practices at its core. But please be aware, these settings may break ; compatibility with older or less security conscience applications. We ; recommending using the production ini in production...

    python3.6.5参考手册 chm

    PEP 456: Secure and Interchangeable Hash Algorithm PEP 436: Argument Clinic Other Build and C API Changes Other Improvements Significant Optimizations Deprecated Deprecations in the Python API ...

Global site tag (gtag.js) - Google Analytics