Home > Articles > Security > Network Security

C Language Issues for Application Security

  • PrintPrint
  • Share ThisShare This
  • DiscussDiscuss
Justin Schuh, John McDonald, and Mark Dowd explore the subtle details of the C programming language that could adversely affect an application's security and robustness.
  • "One day you will understand."

    —Neel Mehta, Senior Researcher, Internet Security Systems X-Force

Introduction

When you're reviewing software to uncover potential security holes, it's important to understand the underlying details of how the programming language implements data types and operations, and how those details can affect execution flow. A code reviewer examining an application binary at the assembly level can see explicitly how data is stored and manipulated as well as the exact implications of an operation on a piece of data. However, when you're reviewing an application at the source code level, some details are abstracted and less obvious. This abstraction can lead to the introduction of subtle vulnerabilities in software that remain unnoticed and uncorrected for long periods of time. A thorough auditor should be familiar with the source language's underlying implementation and how these details can lead to security-relevant conditions in border cases or exceptional situations.

This chapter explores subtle details of the C programming language that could adversely affect an application's security and robustness. Specifically, it covers the storage details of primitive types, arithmetic overflow and underflow conditions, type conversion issues, such as the default type promotions, signed/unsigned conversions and comparisons, sign extension, and truncation. You also look at some interesting nuances of C involving unexpected results from certain operators and other commonly unappreciated behaviors. Although this chapter focuses on C, many principles can be applied to other languages.

  • Share ThisShare This
  • Save To Your Account

Discussions

comments powered by Disqus

Related Resources

#TuesdayTrivia: Spotlight on WP7 (Win a copy of Sams Teach Yourself Windows Phone 7 Application Development)
By on May 2, 2012Comments
These days, what CAN'T a smartphone do? Microsoft is putting their own spin on things to help you experience "life in motion" when using your device. Instead of containing static application icons, the re-imagined Start screen features live Tiles showing real-time content updates.

What Apple and Every Apple Support Professional Must Do
By on April 14, 2012Comments

The Flashback attack is a sign of more to come.  Are you prepared to see your Apple computer (or those you support) as functional UNIX devices that require special skills?


Flashbacks On Your Mac?
By on April 9, 2012Comments
Unless you live under a rock, by now, you should have learned about the Flashback trojan that has compromised over 600,000 Apple computers.

Care to learn what you can do?  Read on...


See All Related Blogs