Use of Less Trusted Source

Draft Base
Structure: Simple
Description

The product has two different sources of the same data or information, but it uses the source that has less support for verification, is less trusted, or is less resistant to attack.

Common Consequences 1
Scope: Access Control

Impact: Bypass Protection MechanismGain Privileges or Assume Identity

An attacker could utilize the untrusted data source to bypass protection mechanisms and gain access to sensitive data.

Demonstrative Examples 1
This code attempts to limit the access of a page to certain IP Addresses. It checks the 'HTTP_X_FORWARDED_FOR' header in case an authorized user is sending the request through a proxy.

Code Example:

Bad
PHP
php
The 'HTTP_X_FORWARDED_FOR' header can be user controlled and so should never be trusted. An attacker can falsify the header to gain access to the page.
This fixed code only trusts the 'REMOTE_ADDR' header and so avoids the issue:

Code Example:

Good
PHP
php

...*

Be aware that 'REMOTE_ADDR' can still be spoofed. This may seem useless because the server will send the response to the fake address and not the attacker, but this may still be enough to conduct an attack. For example, if the generatePage() function in this code is resource intensive, an attacker could flood the server with fake requests using an authorized IP and consume significant resources. This could be a serious DoS attack even though the attacker would never see the page's sensitive content.
Observed Examples 4
CVE-2001-0860Product uses IP address provided by a client, instead of obtaining it from the packet headers, allowing easier spoofing.
CVE-2004-1950Web product uses the IP address in the X-Forwarded-For HTTP header instead of a server variable that uses the connecting IP address, allowing filter bypass.
CVE-2001-0908Product logs IP address specified by the client instead of obtaining it from the packet headers, allowing information hiding.
CVE-2006-1126PHP application uses IP address from X-Forwarded-For HTTP header, instead of REMOTE_ADDR.
Applicable Platforms
Languages:
Not Language-Specific : Undetermined
Modes of Introduction
Architecture and Design
Implementation
Taxonomy Mapping
  • PLOVER