Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++: what are the most common vulnerabilities and how to avoid them?

Tags:

c++

As I code, I try to be security-conscious all the time. The problem is that I need to know what to look for and what to prevent.

Is there a list somewhere of the most common (C++) software vulnerabilities and how to avoid them?

What about C++ software for specific uses, e.g. a linux console software or a web application?

like image 654
augustin Avatar asked Oct 22 '10 03:10

augustin


People also ask

What is the most common cause of vulnerability in a system?

One of the most common process vulnerabilities is an authentication weakness, where users, and even IT administrators, use weak passwords. Human vulnerabilities are created by user errors that can expose networks, hardware, and sensitive data to malicious actors.


2 Answers

Many resources are available, some in question are:

  • SEI CERT C++ Coding Standard
  • SEI CERT C Coding Standard
  • The more language-agnostic Writing Secure Code book from Microsoft Press (funny, I know)
  • David Wheeler's Secure Programming in Linux/Unix
like image 63
逆さま Avatar answered Nov 15 '22 20:11

逆さま


This site may have links to what you are looking for:

http://www.deitel.com/ResourceCenters/Programming/C/CSecurity/tabid/1549/Default.aspx


I guess I'll add that one of the most common problems in C and C++ is buffer overflow:

http://en.wikipedia.org/wiki/Buffer_overflow#Use_of_safe_libraries

For that, use only functions that check boundaries, like strncpy() instead of strcpy().

like image 26
chrisaycock Avatar answered Nov 15 '22 20:11

chrisaycock