Call : (+91) 968636 4243
Mail : info@EncartaLabs.com
EncartaLabs

Secure Coding in C and C++

( Duration: 3 Days )

Your application written in C and C++ works as intended, so you are done, right? But did you consider feeding in incorrect values? 16Gbs of data? A null? An apostrophe? Negative numbers, or specifically -1 or -231? Because that’s what the bad guys will do – and the list is far from complete.

Handling security needs a healthy level of paranoia, and this is what this Secure Coding in C and C++ training course provides: a strong emotional engagement by lots of hands on labs and stories from real life, all to substantially improve code hygiene. Mistakes, consequences, and best practices are our blood, sweat and tears.

By attending Secure Coding in C and C++ workshop, delegates will learn:

  • Getting familiar with essential cyber security concepts
  • Identify vulnerabilities and their consequences
  • Security best practices in C and C++
  • Input validation approaches and principles

  • General C/C++ development

The Secure Coding in C and C++ class is ideal for:

  • C/C++ developers

COURSE AGENDA

1

Cyber security basics

  • What is security?
  • Threat and risk
  • Cyber security threat types
  • Consequences of insecure software
    • Constraints and the market
    • The dark side
2

Buffer overflow

  • Assembly basics and calling conventions
    • x64 assembly essentials
    • Registers and addressing
    • Most common instructions
    • Calling conventions on x64
      • Calling convention – what it is all about
      • The stack frame
      • Stacked function calls
  • Memory management vulnerabilities
    • Memory management and security
    • Vulnerabilities in the real world
    • Buffer security issues
    • Buffer overflow on the stack
      • Buffer overflow on the stack – stack smashing
      • Exploitation – Hijacking the control flow
      • Exploitation – Arbitrary code execution
      • Injecting shellcode
    • Buffer overflow on the heap
      • Unsafe unlinking
    • Pointer manipulation
      • Modification of jump tables
      • Overwriting function pointers
  • Best practices and some typical mistakes
    • Unsafe functions
    • Dealing with unsafe functions
    • What’s the problem with asctime()?
    • Using std::string in C++
    • Unterminated strings
    • readlink() and string termination
    • Manipulating C-style strings in C++
    • Malicious string termination
    • String length calculation mistakes
    • Off-by-one errors
    • Allocating nothing
3

Memory management hardening

  • Securing the toolchain
    • Securing the toolchain in C and C++
    • Compiler warnings and security
    • Using FORTIFY_SOURCE
    • AddressSanitizer (ASan)
      • Using AddressSanitizer (ASan)
      • ASan changes to the prologue
      • ASan changes to memory read/write operations
      • ASan changes to the epilogue
      • Stack smashing protection
        • Detecting BoF with a stack canary
        • Argument cloning
        • Stack smashing protection on various platforms
        • SSP changes to the prologue and epilogue
      • Address Space Layout Randomization (ASLR)
        • ASLR on various platforms
        • Circumventing ASLR – NOP sleds
      • Non-executable memory areas
        • The NX bit
        • Write XOR Execute (W^X)
        • NX on various platforms
        • NX circumvention – Code reuse attacks
        • Return-to-libc / arc injection
        • Return Oriented Programming (ROP)
        • Protection against ROP
4

Common software security weaknesses

  • Security features
    • Authentication
      • Authentication basics
      • Multi-factor authentication
      • Authentication weaknesses – spoofing
    • Password management
      • Inbound password management
      • Storing account passwords
      • Password in transit
      • Dictionary attacks and brute forcing
      • Salting
      • Adaptive hash functions for password storage
      • Password policy
      • NIST authenticator requirements for memorized secrets
      • The dictionary attack
      • The ultimate crack
      • Exploitation and the lessons learned
      • Password database migration
      • Outbound password management
      • Hard coded passwords
      • Protecting sensitive information in memory
      • Challenges in protecting memory
      • Heap inspection
      • Compiler optimization challenges
      • Sensitive info in non-locked memory
  • Code quality
    • Data handling
      • Type mismatch
      • Initialization and cleanup
      • Constructors and destructors
      • Initialization of static objects
      • Array disposal in C++
    • Memory and pointers
      • Memory and pointer issues
      • Pointer handling pitfalls
      • Pointer usage in C and C++
      • Use after free
      • Double free
      • Memory leak
      • Smart pointers and RAII
      • Smart pointer challenges
5

Common software security weaknesses

  • Input validation
    • Input validation principles
      • Blacklists and whitelists
      • Data validation techniques
      • What to validate – the attack surface
      • Where to validate – defense in depth
      • How to validate – validation vs transformations
      • Validation with regex
    • Injection
      • Injection principles
      • Injection attacks
      • Code injection
      • OS command injection
      • Avoiding command injection with the right APIs
      • Process control – library injection
      • DLL hijacking
    • Integer handling problems
      • Representing signed numbers
      • Integer visualization
      • Integer promotion
      • Integer overflow
      • Signed / unsigned confusion
      • Integer truncation
      • Upcasting
      • Precondition testing
      • Postcondition testing
      • Using big integer libraries
      • UBSan changes to arithmetics
    • Files and streams
      • Path traversal
      • Path traversal-related examples
    • Format string issues
      • The problem with printf()
  • Time and state
    • Race conditions
      • File race condition
      • Time of check to time of usage – TOCTTOU
      • Insecure temporary file

Encarta Labs Advantage

  • One Stop Corporate Training Solution Providers for over 6,000 various courses on a variety of subjects
  • All courses are delivered by Industry Veterans
  • Get jumpstarted from newbie to production ready in a matter of few days
  • Trained more than 50,000 Corporate executives across the Globe
  • All our trainings are conducted in workshop mode with more focus on hands-on sessions

View our other course offerings by visiting https://www.encartalabs.com/course-catalogue-all.php

Contact us for delivering this course as a public/open-house workshop/online training for a group of 10+ candidates.

Top
Notice
X