Top 10 Secure Coding Practices - CERT Secure Coding (2024)

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 only be accessed forthe least amount of time required to complete the privilegedtask. 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.

Bonus Secure Coding Practices

  1. Define security requirements. Identify and document security requirements early in the development life cycle and make sure that subsequent development artifacts are evaluated for compliance with those requirements. When security requirements are not defined, the security of the resulting system cannot be effectively evaluated.
  2. Model threats. Use threat modeling to anticipate the threats to which the software will be subjected. Threat modeling involves identifying key assets, decomposing the application, identifying and categorizing the threats to each asset or component, rating the threats based on a risk ranking, and then developing threat mitigation strategies that are implemented in designs, code, and test cases [Swiderski 04].

Bonus Photograph

We like the following photograph because it illustrates how the easiest way to break system security is often to circumvent it rather than defeat it (as is the case with most software vulnerabilities related to insecure coding practices).

Top 10 Secure Coding Practices - CERT Secure Coding (1)

The photograph depicted a street (named Konsequenz) in the University Bielefeld, Germany, at lat/long. 52.036818, 8.491467. It is visible viaGoogle Street View.

We don't know who took this photograph. If you do, please let us know in the comments!

References

[Saltzer 74] Saltzer, J. H. "Protection and the Control of Information Sharing in Multics." Communications of the ACM 17, 7 (July 1974): 388-402.

[Saltzer 75] Saltzer, J. H. & Schroeder, M. D. "The Protection of Information in Computer Systems." Proceedings of the IEEE 63, 9 (September 1975), 1278-1308.

[Seacord 05] Seacord, R. Secure Coding in C and C++. Upper Saddle River, NJ: Addison-Wesley, 2006 (ISBN 0321335724).

[Swiderski 04] Swiderski, F. & Snyder, W. Threat Modeling. Redmond, WA: Microsoft Press, 2004.

Top 10 Secure Coding Practices - CERT Secure Coding (2024)
Top Articles
Best NBA 2K24 builds for MyCareer: PG, SG, SF, PF & C - Charlie INTEL
NBA 2K24 Best Builds For Current And Next-Gen
Far-right activist Laura Loomer's access to Trump reveals a crisis in his campaign
Does Shell Gas Station Sell Pregnancy Tests
Costco store locator - Florida
Fresenius Medical Care to launch 5008 dialysis machine: improved patients` quality of life and efficient use of resources
Mashle: Magic And Muscles Gogoanime
Seacrest 7 Piece Dining Set
Warren County Skyward
On Trigger Enter Unity
Married At First Sight Novel Serenity And Zachary Chapter 950
Leicht Perlig Biography
Urology Match Spreadsheet
Fairwinds Shred Fest 2023
Ellaeats Tumblr
Five Guys Calorie Calculator
Onlybaddiestv
Eliud Kipchoge Resting Heart Rate
Ratchet & Clank Rift Apart: Trofea - lista | GRYOnline.pl
Jordan Torres Leaked
Theramed Junior Strawberry 6+ Tandpasta 75 ml - 12 stuks - Voordeelverpakking | bol
The Boogeyman Showtimes Near Marcus Menomonee Falls Cinema
Isaimini 2023: Tamil Movies Download HD Hollywood
Winta Zesu Net Worth
Davias Grille
Lewelling Garden Supply
6 Beste EN Nuud Kortingscode | Tot 55% korting | September 2024
I-80 New Jersey Traffic and Road Conditions
20 of the Best Restaurants in Moscow, Russia by a Local
Publishers Clearing House deceived consumers about their sweepstakes contests, FTC says
Craigslist Cars Los Angeles
Framingham Risk Score Calculator for Coronary Heart Disease
Sport & Fitness in Hainbuch: Zubehör & Ausrüstung günstig kaufen
Did Taylor Swift Date Greg Gutfeld
Roses Gordon Highway
Carlynchristy
Rexella Van Impe Net Worth
What Do Manta Rays Eat In Ark
Www Texaslottery Com
Splunk Stats Count By Hour
Rub Md Okc
Webworx Call Management
Publix Coral Way And 147
Lifetime Benefits Login
Tillamook Headlight Herald Obituaries
Where To Find Mega Ring In Pokemon Radical Red
13364 Nw 42Nd Street
Toldeo Craigslist
Richard Grieve Judge Judy
Westside Veterinary Hospital Arab Photos
7-11 Paystub Portal
Physician Dressed As A Sorceress Crossword Clue
Latest Posts
Article information

Author: Virgilio Hermann JD

Last Updated:

Views: 6504

Rating: 4 / 5 (61 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Virgilio Hermann JD

Birthday: 1997-12-21

Address: 6946 Schoen Cove, Sipesshire, MO 55944

Phone: +3763365785260

Job: Accounting Engineer

Hobby: Web surfing, Rafting, Dowsing, Stand-up comedy, Ghost hunting, Swimming, Amateur radio

Introduction: My name is Virgilio Hermann JD, I am a fine, gifted, beautiful, encouraging, kind, talented, zealous person who loves writing and wants to share my knowledge and understanding with you.