Nagarro TechMAPS Secure Coding
Nagarro TechMAPS Secure Coding
Nagarro C++
Secure
coding
practice
● As a developer, you are not only
responsible to meet the business
requirements of a project but also take
into account the security of it
● C/C++ are historically languages that do
not enforce any safety and it all comes to
down the developer to make sure its
code is secure
What are secure
coding practices?
● Secure coding practices are a set of recommendations to develop
safe, reliable and security systems, for example by eliminating
unexpected behaviours that can lead to undefined program
behaviour and exploitable vulnerabilities
● The conformance to this practices is necessary but usually not
sufficient.
● It’s also necessary, for example, to provide a safe and secure design of
your applications
● Safety-critical systems typically have stricter requirements than
imposed by the coding standards.
● One example would be MISRA C/C++ compliance which requires that
all memory to be statically allocated
● Validate input
Validate input from all untrusted data
sources. Proper input validation can
Top 12 eliminate the vast majority of software
vulnerabilities. Be suspicious of most
external data sources:
Secure ■
■
■
Command line arguments
Network interfaces
Environmental variables
Coding ●
■ User controlled files
● Keep it simple
Keep the design as simple and small as possible.
Secure
Complex designs increase the likelihood that
errors will be made in their implementation,
configuration, and use. Additionally, the effort
Coding
required to achieve an appropriate level of
assurance increases dramatically as security
mechanisms become more complex.
practices
● 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.
● Adhere to the principle of least privilege
Every process should execute with the least set of
privileges necessary to complete the job. Any
elevated permission should only be accessed for
the least amount of time required to complete the
Top 12 privileged task. This approach reduces the
opportunities an attacker has to execute arbitrary
code with elevated privileges.
Secure ● Sanitize data sent to other systems
Sanitize all data passed to complex subsystems
Coding ●
resulting system cannot be effectively evaluated.
Model threats
● It’s a list of the most widespread and critical errors that can lead to
serious vulnerabilities in software
● They are often easy to find and easy to exploit
● They are dangerous because they will frequently allow attackers to
completely take over the software, steal data or prevent software from
working at all
● It can be used as a measuring stick of progress in the effort to secure
the code
● Entries are sorted into 3 high-level categories
○ Insecure Interaction between components
○ Risky Resource Management
○ Porous Defenses
● https://cwe.mitre.org/top25/archive/2023/2023_top25_list.html
Questions?