CWE
CWE/SANS Top 25 Most Dangerous Software Errors Common Weakness Scoring System
Common Weakness Risk Analysis Framework
Home > CWE List > COMPOSITE SLICE: CWE-291: Trusting Self-reported IP Address (2.1)  

CWE-291: Trusting Self-reported IP Address

 
Trusting Self-reported IP Address
Definition in a New Window Definition in a New Window
Compound Element ID: 291 (Compound Element Variant: Composite)Status: Incomplete
+ Description

Description Summary

The use of IP addresses as authentication is flawed and can easily be spoofed by malicious users.

Extended Description

As IP addresses can be easily spoofed, they do not constitute a valid authentication mechanism. Alternate methods should be used if significant authentication is necessary.

+ Time of Introduction
  • Architecture and Design
+ Applicable Platforms

Languages

All

+ Common Consequences
ScopeEffect
Access Control
Non-Repudiation

Technical Impact: Hide activities; Gain privileges / assume identity

Malicious users can fake authentication information, impersonating any IP address.

+ Likelihood of Exploit

High

+ Demonstrative Examples

Example 1

Both of these examples

(Bad Code)
Example Languages: C and C++ 
sd = socket(AF_INET, SOCK_DGRAM, 0);
serv.sin_family = AF_INET;
serv.sin_addr.s_addr = htonl(INADDR_ANY);
servr.sin_port = htons(1008);
bind(sd, (struct sockaddr *) & serv, sizeof(serv));

while (1) {
memset(msg, 0x0, MAX_MSG);
clilen = sizeof(cli);
if (inet_ntoa(cli.sin_addr)==getTrustedAddress()) {
n = recvfrom(sd, msg, MAX_MSG, 0, (struct sockaddr *) & cli, &clilen);
}
}
(Bad Code)
Example Language: Java 
while(true) {
DatagramPacket rp=new DatagramPacket(rData,rData.length);
outSock.receive(rp);
String in = new String(p.getData(),0, rp.getLength());
InetAddress clientIPAddress = rp.getAddress();
int port = rp.getPort();

if (isTrustedAddress(clientIPAddress) & secretKey.equals(in)) {
out = secret.getBytes();
DatagramPacket sp =new DatagramPacket(out,out.length, IPAddress, port); outSock.send(sp);
}
}

This example checks if a request is from a trusted address before responding to a request, but the code only verifies the address as stored in the request packet. An attacker can spoof this address, thus impersonating a trusted client

+ Potential Mitigations

Phase: Architecture and Design

Use other means of identity verification that cannot be simply spoofed. Possibilities include a username/password or certificate.

+ Weakness Ordinalities
OrdinalityDescription
Resultant
(where the weakness is typically related to the presence of some other weaknesses)
+ Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
RequiresWeakness BaseWeakness Base348Use of Less Trusted Source
Research Concepts1000
RequiresWeakness BaseWeakness Base471Modification of Assumed-Immutable Data (MAID)
Research Concepts1000
ChildOfWeakness BaseWeakness Base290Authentication Bypass by Spoofing
Development Concepts (primary)699
Research Concepts (primary)1000
PeerOfWeakness VariantWeakness Variant292Trusting Self-reported DNS Name
Research Concepts1000
PeerOfWeakness VariantWeakness Variant293Using Referer Field for Authentication
Research Concepts1000
+ Causal Nature

Explicit

+ Taxonomy Mappings
Mapped Taxonomy NameNode IDFitMapped Node Name
CLASPTrusting self-reported IP address
+ Content History
Submissions
Submission DateSubmitterOrganizationSource
CLASPExternally Mined
Modifications
Modification DateModifierOrganizationSource
2008-09-08CWE Content TeamMITREInternal
updated Common_Consequences, Relationships, Other_Notes, Taxonomy_Mappings, Weakness_Ordinalities
2010-02-16CWE Content TeamMITREInternal
updated Description, Other_Notes
2011-06-01CWE Content TeamMITREInternal
updated Common_Consequences, Demonstrative_Examples
Composite Components
Composite Components
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
 
Modification of Assumed-Immutable Data (MAID)
Definition in a New Window Definition in a New Window
Weakness ID: 471 (Weakness Base)Status: Draft
+ Description

Description Summary

The software does not properly protect an assumed-immutable element from being modified by an attacker.
+ Time of Introduction
  • Implementation
+ Applicable Platforms

Languages

All

+ Common Consequences
ScopeEffect
Integrity

Technical Impact: Modify application data

+ Demonstrative Examples

Example 1

In the code excerpt below, an array returned by a Java method is modified despite the fact that arrays are mutable.

(Bad Code)
Example Language: Java 
String[] colors = car.getAllPossibleColors();
colors[0] = "Red";
+ Observed Examples
ReferenceDescription
CVE-2002-1757Relies on $PHP_SELF variable for authentication.
CVE-2005-1905Gain privileges by modifying assumed-immutable code addresses that are accessed by a driver.
+ Potential Mitigations

Phases: Architecture and Design; Operation; Implementation

Implement proper protection for immutable data (e.g. environment variable, hidden form fields, etc.)

+ Other Notes

Factors: MAID issues can be primary to many other weaknesses, and they are a major factor in languages such as PHP.

This happens when a particular input is critical enough to the functioning of the application that it should not be modifiable at all, but it is. A common programmer assumption is that certain variables are immutable; especially consider hidden form fields in web applications. So there are many examples where the MUTABILITY property is a major factor in a vulnerability.

Common data types that are attacked are environment variables, web application parameters, and HTTP headers.

+ Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfCategoryCategory19Data Handling
Development Concepts (primary)699
ChildOfWeakness ClassWeakness Class664Improper Control of a Resource Through its Lifetime
Research Concepts (primary)1000
RequiredByCompound Element: CompositeCompound Element: Composite291Trusting Self-reported IP Address
Research Concepts1000
RequiredByCompound Element: CompositeCompound Element: Composite426Untrusted Search Path
Research Concepts1000
ParentOfWeakness BaseWeakness Base472External Control of Assumed-Immutable Web Parameter
Development Concepts (primary)699
Research Concepts1000
ParentOfWeakness VariantWeakness Variant473PHP External Variable Modification
Development Concepts (primary)699
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness Variant607Public Static Final Field References Mutable Object
Development Concepts699
Research Concepts (primary)1000
CanFollowWeakness BaseWeakness Base425Direct Request ('Forced Browsing')
Research Concepts1000
CanFollowWeakness BaseWeakness Base602Client-Side Enforcement of Server-Side Security
Research Concepts1000
PeerOfWeakness BaseWeakness Base621Variable Extraction Error
Research Concepts1000
+ Taxonomy Mappings
Mapped Taxonomy NameNode IDFitMapped Node Name
PLOVERModification of Assumed-Immutable Data
+ Content History
Submissions
Submission DateSubmitterOrganizationSource
PLOVERExternally Mined
Modifications
Modification DateModifierOrganizationSource
2008-07-01Sean EidemillerCigitalExternal
added/updated demonstrative examples
2008-07-01Eric DalciCigitalExternal
updated Potential_Mitigations, Time_of_Introduction
2008-09-08CWE Content TeamMITREInternal
updated Relationships, Other_Notes, Taxonomy_Mappings
2009-07-27CWE Content TeamMITREInternal
updated Other_Notes
2010-02-16CWE Content TeamMITREInternal
updated Potential_Mitigations
2010-04-05CWE Content TeamMITREInternal
updated Related_Attack_Patterns
2010-12-13CWE Content TeamMITREInternal
updated Related_Attack_Patterns
2011-06-01CWE Content TeamMITREInternal
updated Common_Consequences
 
Use of Less Trusted Source
Definition in a New Window Definition in a New Window
Weakness ID: 348 (Weakness Base)Status: Draft
+ Description

Description Summary

The software 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.
+ Time of Introduction
  • Architecture and Design
  • Implementation
+ Applicable Platforms

Languages

All

+ Common Consequences
ScopeEffect
Access Control

Technical Impact: Bypass protection mechanism

+ Observed Examples
ReferenceDescription
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.
BID:15326Similar to CVE-2004-1950
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.
+ Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfWeakness ClassWeakness Class345Insufficient Verification of Data Authenticity
Development Concepts (primary)699
Research Concepts (primary)1000
RequiredByCompound Element: CompositeCompound Element: Composite291Trusting Self-reported IP Address
Research Concepts1000
+ Taxonomy Mappings
Mapped Taxonomy NameNode IDFitMapped Node Name
PLOVERUse of Less Trusted Source
+ Content History
Submissions
Submission DateSubmitterOrganizationSource
PLOVERExternally Mined
Modifications
Modification DateModifierOrganizationSource
2008-07-01Eric DalciCigitalExternal
updated Time_of_Introduction
2008-09-08CWE Content TeamMITREInternal
updated Relationships, Taxonomy_Mappings
2011-06-01CWE Content TeamMITREInternal
updated Common_Consequences
Page Last Updated: September 12, 2011