CAPEC

Common Attack Pattern Enumeration and Classification
Common Attack Pattern Enumeration and Classification

A Community Knowledge Resource for Building Secure Software

Home > CAPEC List > Individual CAPEC Dictionary Definition (Release 1.1)   View the CAPEC List

Individual CAPEC Dictionary Definition (Release 1.1)
Individual CAPEC Dictionary Definition (Release 1.1)

Manipulating Opaque Client-based Data Tokens
Attack Pattern ID
Pattern Abstraction: Standard

39

Typical Severity

Medium

Description

Summary

In circumstances where an application holds important data client-side in tokens (cookies, URLs, data files, and so forth) that data can be manipulated. If client
or server-side application components reinterpret that data as authentication tokens or data (such as store item pricing or wallet information) then even opaquely manipulating
that data may bear fruit for an Attacker. In this pattern an attacker undermines the assumption that client side tokens have been adequately protected from tampering through use of encryption or obfuscation.

Attack Execution Flow

Explore
  1. Enumerate information passed to client side: The attacker identifies the parameters used as part of tokens to take business or security decisions

    Attack Step Techniques
    DescriptionEnvironments
    Use WebScarab to reveal hidden fields while browsing.env-Web
    Use a sniffer to capture packetsenv-ClientServer env-Peer2Peer env-CommProtocol
    View source of web page to find hidden fieldsenv-Web
    Examine URL to see if any opaque tokens are in itenv-Web
    Disassemble or decompile client-side applicationenv-ClientServer env-Peer2Peer
    Use debugging tools such as File Monitor, Registry Monitor, Debuggers, etc.env-ClientServer env-Peer2Peer
    Indicators of Susceptibility
    IDTypeDescriptionEnvironments
    c39s1i1PositiveOpaque hidden form fields in a web pageenv-Web
    c39s1i2PositiveOpaque session tokens/ticketsenv-Web env-Peer2Peer env-ClientServer env-CommProtocol
    c39s1i3PositiveOpaque protocol fieldsenv-ClientServer env-Peer2Peer env-CommProtocol
    c39s1i4PositiveOpaque Resource Locatorenv-Web env-Peer2Peer env-ClientServer env-CommProtocol
    Outcomes
    IDTypeDescription
    c39s1o1SuccessAt least one opaque client-side token found
    c39s1o2FailureNo opaque client-side tokens found
  2. Determine protection mechanism for opaque token: The attacker determines the protection mechanism used to protect the confidentiality and integrity of these data tokens. They may may be obfuscated or a full blown encryption may be used.

    Attack Step Techniques
    DescriptionEnvironments
    Look for signs of well-known character encodingsenv-Web env-ClientServer env-Peer2Peer env-CommProtocol
    Look for cryptographic signaturesenv-Web env-ClientServer env-Peer2Peer env-CommProtocol
    Look for delimiters or other indicators of structureenv-Web env-ClientServer env-Peer2Peer env-CommProtocol
    Indicators of Susceptibility
    IDTypeDescriptionEnvironments
    c39s2i1PositiveStandard signatures of well-known encodings detectedenv-Web env-ClientServer env-Peer2Peer env-CommProtocol
    c39s2i2PositiveToken or structural block’s length being multiple of well-known block size of a cryptographic algorithmenv-Web env-ClientServer env-Peer2Peer env-CommProtocol
    c39s2i3PositiveClear structural boundaries or delimitersenv-Web env-ClientServer env-Peer2Peer env-CommProtocol
    c39s2i4NegativeFailure outcome in previous stepenv-Web env-ClientServer env-Peer2Peer env-CommProtocol
    Outcomes
    IDTypeDescription
    c39s2o1SuccessProtection/encoding scheme identified
    c39s2o2FailureNo information about protection/encoding scheme could not be determined
Experiment
  1. Modify parameter/token values: Trying each parameter in turn, the attacker modifies the values

    Attack Step Techniques
    DescriptionEnvironments
    Modify tokens logicallyenv-Web env-ClientServer env-Peer2Peer env-CommProtocol
    Modify tokens arithmeticallyenv-Web env-ClientServer env-Peer2Peer env-CommProtocol
    Modify tokens bitwiseenv-Web env-ClientServer env-Peer2Peer env-CommProtocol
    Modify structural components of tokensenv-Web env-ClientServer env-Peer2Peer env-CommProtocol
    Modify order of parameters/tokensenv-Web env-ClientServer env-Peer2Peer env-CommProtocol
    Indicators of Susceptibility
    IDTypeDescriptionEnvironments
    c39s3i1PositiveSuccess outcome in first step.env-Web env-ClientServer env-Peer2Peer env-CommProtocol
    c39s3i2NegativeFailure outcome in first stepenv-Web env-ClientServer env-Peer2Peer env-CommProtocol
  2. Cycle through values for each parameter.: Depending on the nature of the application, the attacker now cycles through values of each parameter and observes the effects of this modification in the data returned by the server

    Attack Step Techniques
    DescriptionEnvironments
    Use network-level packet injection tools such as netcatenv-Web env-ClientServer env-Peer2Peer env-CommProtocol
    Use application-level data modification tools such as Tamper Data, WebScarab, TamperIE, etc.env-Web
    Use modified client (modified by reverse engineering)env-ClientServer env-Peer2Peer env-CommProtocol
    Use debugging tools to modify data in clientenv-ClientServer env-Peer2Peer
    Indicators of Susceptibility
    IDTypeDescriptionEnvironments
    c39s4i1PositiveSuccess outcome in first stepenv-Web env-ClientServer env-Peer2Peer env-CommProtocol
    c39s4i2NegativeFailure outcome in first stepenv-Web env-ClientServer env-Peer2Peer env-CommProtocol
    Outcomes
    IDTypeDescription
    c39s4o1SuccessSubversion of security controls on server
    c39s4o2FailureClient token reset by server
    c39s4o3InconclusiveDetailed error message describing problem with token, received from server
    Security Controls
    IDTypeDescription
    c39s4sc1DetectiveUnexpected/invalid token/parameter value in application logs on server
    c39s4sc2CorrectiveReset session upon receipt of unexpected/invalid token/parameter value
Attack Prerequisites

An attacker already has some access to the system or can steal the client based data tokens from another user who has access to the system.

For an Attacker to viably execute this attack, some data (later interpreted by the application) must be held client-side in a way that can be manipulated without detection. This means that the data or tokens are not CRCd as part of their value or through a separate meta-data store elsewhere.

Typical Likelihood of Exploit

Very High

Methods of Attack
  • Modification of Resources
Examples-Instances

Description

With certain price watching websites, that aggregate products available prices, the user can buy items through whichever vendors has product availability, the best price, or other differentiator. Once a user selects an item, the site must broker the purchase of that item with the vendor. Because vendors sell the same product through different channel partners at different prices, token exchange between price watching sites and selling vendors will often contain pricing information. With some price watching sites, manipulating URL-data (which is encrypted) even opaquely yields different prices charged by the fulfilling vendor. If the manipulated price turns out higher, the Attacker can cancel purchase. If the Attacker succeeded in manipulating the token and creating a lower price, he/she proceeds.

Description


Upon successful authentication user is granted an encrypted authentication cookie by the server and it is stored on the client.  One piece of information stored in the authentication cookie reflects the access level of the user (e.g. "u" for user).  The authentication cookie is encrypted using the Electronic Code Book (ECB) mode, that naively encrypts each of the plaintext blocks to each of the ciphertext blocks separately.  An attacker knows the structure of the cookie and can figure out what bits (encrypted) store the information relating to the access level of the user.  An attacker modifies the authentication cookie and effectively substitutes "u" for "a" by flipping some of the corresponding bits of ciphertext (trial and error).  Once the correct "flip" is found, when the system is accessed, the attacker is granted administrative privileges in the system.  Note that in this case an attacker did not have to figure out the exact encryption algorithm or find the secret key, but merely exploit the weakness inherent in using the ECB encryption mode.

Related Vulnerability

Description


Archangel Weblog 0.90.02 allows remote attackers to bypass authentication by setting the ba_admin cookie to 1.

Related Vulnerability

CVE-2006-0944

Attacker Skill or Knowledge Required

Medium: If the client site token is obfuscated. High: If the client site token is encrypted.

Resources Required

The Attacker needs no special hardware-based resources in order to conduct this attack. Software plugins, such as Tamper Data for Firefox, may help in manipulating URL- or cookie-based data.

Probing Techniques

Tamper with the client side data token and observe the effects it has on interaction with the system.

This attack is in and of itself a trial-and-error-based probing technique.

Solutions and Mitigations

One solution to this problem is to protect encrypted data with a CRC of some sort. If knowing who last manipulated the data is important, then using a cryptographic "message authentication code" (or hMAC) is prescribed. However, this guidance is not a panecea. In particular, any value created by (and therefore encrypted by) the client, which itself is a "malicous" value, all the protective cryptography in the world can't make the value 'correct' again. Put simply, if the client has control over the whole process of generating and encoding the value--then simply protecting its integrity doesn't help.

Make sure to protect client side authentication tokens for confidentiality (encryption) and integrity (signed hash)

Make sure that all session tokens use a good source of randomness

Perform validation on the server side to make sure that client side data tokens are consistent with what is expected.

Attack Motivation-Consequences
  • Data Modification
  • Privilege Escalation
Context Description

The context in which this attack can operate is any circumstance in
which important data, stored client-side, is reinterpreted by the client itself or a
server-side component. The server-side component may or may not be the same system that
produced the data (it is not in the given example instance). But, in all cases, the data
stored is protected through some means--such as encryption. However, it's important to
stipulate that the means used to protect this data does not employ an effetive integrity
check.

Related Weaknesses
CWE-IDWeakness NameWeakness Relationship Type
353Failure to Add Integrity Check ValueTargeted
285Missing or Inconsistent Access ControlSecondary
302Authentication Bypass by Assumed-Immutable DataTargeted
472External Control of Assumed-Immutable Web ParameterTargeted
565Use of Cookies in Security DecisionTargeted
315Plaintext Storage in a CookieTargeted
539Information Leak Through Persistent CookiesTargeted
384Session FixationSecondary
233Parameter ProblemsSecondary
Related Attack Patterns
IDNameRelationship TypeRelationship Description
31Accessing/Intercepting/Modifying HTTP CookiesMore Abstract
22Exploiting Trust in Client (aka Make the Client Invisible)More Detailed
Relevant Security Requirements

Sensitive information stored client side must be integrity checked upon return before use

Related Security Principles
  • Reluctance to Trust
  • Never Assuming that your Secrets are Safe
  • Least Privilege
  • Complete Mediation
Related Guidelines
  • Never Use Unvalidated Input as Part of a Directive to any Internal Component
Purpose

Penetration

Exploitation

CIA Impact
Confidentiality ImpactIntegrity ImpactAvailability Impact
HighHighLow
Technical Context
Architectural ParadigmFrameworkPlatformLanguage
AllAllAllAll
Source
Submission(s)
SubmitterOrganizationDateComment
John StevenCigital, Inc2007-02-10Initial core pattern content
Modification(s)
ModifierOrganizationDateComment
Chiradeep B. ChhayaCigital, Inc2007-02-23Fleshed out pattern with extra content
Eugene LebanidzeCigital, Inc2007-02-27Added new examples and other content
Richard StruseVOXEM, Inc2007-03-26Review and feedback leading to changes in Solutions and Related Attack Patterns
Sean BarnumCigital, Inc2007-04-13Modified pattern content according to review and feedback
Amit SethiCigital, Inc.2007-10-29Added extended Attack Execution Flow
 
Page Last Updated: April 18, 2008