Menu
Parameter Tampering Attack
Table of Contents
Quick Answer
Parameter tampering happens when a user changes URL query strings, form fields, cookies, headers, or API parameters to access data or actions they should not control. The safest defense is to never trust client-side values and to validate, authorize, and recalculate sensitive decisions on the server.
Parameter tampering is a web application security issue where user-controlled values are changed to bypass intended business rules. It often affects shopping carts, profile updates, role changes, API requests, session cookies, and object identifiers. The risk is highest when an application trusts the browser instead of enforcing rules on the server.
What is Parameter Tampering?
Parameter tampering occurs when an attacker or tester modifies values exchanged between a client and server. These values can include product IDs, account IDs, quantities, prices, role names, discount codes, redirect URLs, cookies, or request headers. If the server accepts the modified values without validation and authorization, it can lead to unauthorized access, privilege escalation, data exposure, fraud, or broken business logic.
Where Parameters Commonly Appear
Web and mobile applications rely on parameters to carry user intent. These values are useful, but they should be treated as untrusted input.
- URL query strings: Values after a question mark, such as
?product_id=123or?redirect=/dashboard. - Form fields: Visible and hidden fields submitted through forms, including quantities, IDs, and preferences.
- Cookies: Client-side values used for sessions, preferences, or tracking state.
- HTTP headers: Request metadata such as referrer, host, language, or custom API headers.
- API request bodies: JSON or form data sent from web apps, mobile apps, or API clients.
Common Types of Parameter Tampering
1. URL Parameter Tampering
URL tampering involves changing query-string values to request another object, change a redirect destination, or alter a workflow. The application should verify that the authenticated user is allowed to access the requested object or action.
2. Form Field Tampering
Hidden fields are not security controls. A browser can hide a price, role, or user ID from the interface, but the value still comes from the client and can be changed before submission.
3. API Parameter Tampering
APIs are often consumed by browsers, mobile apps, and integrations. Every API request should enforce authentication, authorization, validation, and business rules independently of the client app.
4. Cookie and Header Tampering
Cookies and headers can influence sessions, preferences, locale, redirects, and application behavior. Sensitive state should be server-side or cryptographically protected, and session handling should be designed to prevent session hijacking.
Parameter Tampering vs IDOR
Parameter tampering is the broader technique of changing client-controlled values. IDOR, or insecure direct object reference, is a common authorization failure where changing an object identifier exposes another user's record. For example, a secure application should not allow a user to access another order, invoice, or profile simply because an ID value was changed.
| Aspect | Parameter Tampering | IDOR |
|---|---|---|
| Scope | Any changed client-side parameter | Object identifier access control failure |
| Example risk | Changed price, role, redirect, cookie, or API value | Accessing another user's invoice or profile |
| Main defense | Server-side validation and business-rule enforcement | Object-level authorization on every request |
Safe Defensive Examples
The following examples show secure design patterns instead of operational attack steps. The goal is to help developers understand what should be verified on the server.
Safe Example: Do Not Trust Hidden Prices
A hidden form field can carry a product ID or quantity, but pricing should be calculated on the server from trusted data.
// Unsafe idea: trusting price from a hidden form field
// Safer approach: use productId from the request, then calculate price on the server
const product = await products.findById(request.body.productId);
const quantity = Number(request.body.quantity || 1);
if (!product || quantity < 1) {
throw new Error('Invalid purchase request');
}
const total = product.price * quantity; Safe Example: Authorize Object Access
API handlers should verify both the user's identity and their permission to the requested object. Validation checks the shape of input; authorization checks whether the user may perform the action.
// Safer object access pattern
const order = await orders.findById(request.params.orderId);
if (!order || order.userId !== currentUser.id) {
return response.status(403).json({ error: 'Not authorized' });
}
return response.json(order); Prevention and Mitigation Checklist
- Validate all input on the server for type, format, length, range, and allowed values.
- Authorize every sensitive object-level action, even when the UI hides the option.
- Recalculate sensitive values such as prices, discounts, roles, tax, and permissions on the server.
- Use secure server-side session state or signed values when client-side state is unavoidable.
- Apply allowlists for redirect targets, file types, IDs, and workflow states.
- Use parameterized queries to reduce related injection risks such as SQL injection attacks.
- Log suspicious changes and repeated invalid requests for monitoring and investigation.
- Conduct authorized penetration testing and code reviews for business-logic flaws.
- Use HTTPS, but remember that encryption does not replace validation or authorization.
Authorized Testing Checklist
During a permitted security review, testers and developers should confirm that the application rejects unauthorized parameter changes safely.
- Check whether hidden fields influence sensitive decisions.
- Verify that changing object IDs does not expose another user's data.
- Confirm that role, status, price, discount, and workflow values are server-controlled.
- Test APIs directly, not only through the browser UI.
- Document expected behavior, actual behavior, evidence, risk, and remediation guidance.
FAQs
Sources and further reading
- OWASP Web Security Testing Guide — Authorized web application testing methodology
- OWASP Top 10 - Broken Access Control — Access-control weakness category
- OWASP API Security Top 10 - Broken Object Level Authorization — Object-level authorization risk in APIs