Input validation: Beware hidden user input

Attackers can provide input to programs using subtle channels. Examples include:

  1. Environment variables.

  2. Windows registry values; way too many programs change things in the registry that they should never change.

  3. Configuration files, including dotfiles and files in /etc on Unix/Linux/BSD, files in the application’s directory on Mac OS and Windows systems, etc.

  4. Network configuration management, including Microsoft domain controllers, Mac OSX NetInfo.

  5. DNS lookups.

  6. Data from a database lookup.

  7. HTTP and other protocol request headers, in other words, not just content, but EVERYTHING arriving from the remote system (also known as the attacker’s system).

All of these and all of the ones not listed require input validation. In other words, ALL data that originates outside of your program must be validated. Many of these things should almost never change or are not hostile in normal usage. However, attackers will not let “normal” be normal.

Examples

At least two bugs in Windows allow an attacker to perform a privilege escalation or denial of service attack via crafted registry values: CVE-2010-3961 and CVE-2010-0238.

An Apple bug allowed attackers to use a crafted DNS PTR record to blacklist arbitrary clients. This is CVE-2010-0500.

A buffer overflow in the DNS resolver library allowed an attacker to run arbitrary code on victim machines. This is CVE-2005-0033

To summarize the take-away from these examples: Anything you did not code is attacker-supplied data.

Published by

Kenneth Ingham

Kenneth has been working with security since the early 1980s. He was a system administrator when the Morris Worm was released, and one of his work areas was helping secure the systems. Since then, Kenneth has studied network and computer security, and spent many, many hours looking at how software fails. With knowledge about failures, he can help you produce software that is less likely to suffer a security breach. Kenneth has a Ph.D. in Computer Science, and his research topic was on computer security. Kenneth has helped developers creating systems for financial services institutions, telecommunications companies, and embedded system and process control.

Leave a Reply

Your email address will not be published. Required fields are marked *