Site AI Auditby Internet Solutions

HTTP Parameter Pollution: Duplicate Parameters, Odd Results

4 tháng 11, 20268 phút đọcBảo mật & SSL
HTTP Parameter Pollution: Duplicate Parameters, Odd Results

Short answer: HTTP parameter pollution (HPP) means sending the same parameter name more than once in a request, for example ?id=1&id=2. Different systems treat such requests differently: one reads the first value, another the last, a third joins them. If a firewall checks one value and the application uses another, an attacker may slip through. The cure is consistent parsing and strict validation after parsing.

What a parameter is

When you search, filter or log in on a website, the browser sends small pieces of information called parameters. In a link they appear after a question mark as name and value pairs, joined by ampersands, such as ?product=12&colour=red. In a form that uses the POST method, the pairs travel in the body of the request but look the same.

The standards do not say what must happen when the same name appears twice. This leaves each programming language, framework and server free to choose its own behaviour, and they have chosen differently.

How different systems read duplicates

Take the request ?id=1&id=2. Depending on the technology behind a site, the result can be:

None of these is wrong in itself. The problem arises when two components in a chain read the same request differently.

It helps to think of each layer as a translator. If two translators hear the same sentence and give different meanings to the same word, a person who understands both can write a sentence that sounds harmless to one and harmful to the other. Security teams call this a parser differential, and it appears in many kinds of attacks, not only with parameters. The defence is the same everywhere: reduce the number of interpretations, and make the strictest layer decide.

How attackers use it

A typical modern website has several layers: a CDN or a web application firewall, a web server, an application framework and sometimes another internal service. Each layer parses the request on its own.

A simple example

A shop lets a customer choose a payment method with a link such as /pay?method=card. A page that builds this link from user input might place a value taken from the address bar directly into a new link. If a visitor opens /checkout?method=card%26amount%3D1 on a poorly written page, the encoded ampersand can become a real one in the link that the page prints, which adds an extra amount parameter. Other users who click that link would send a request with a changed amount. Proper encoding stops this, and server-side checks of the amount stop it even if encoding fails.

The details depend on the code, and a site owner does not need to build such attacks. The point is that anything that crosses a boundary between two parsers deserves caution.

How to prevent it

  1. Decide what a duplicate means. For each parameter, define whether it can appear once or many times. Most should appear once.
  2. Reject unexpected duplicates. If a parameter that should be single arrives twice, return an error. This is the strongest and simplest rule.
  3. Validate after parsing. Check the type, range and permission of the final value that your code will use, not the raw text.
  4. Encode when building links. Whenever you place a value into an address, encode it for that place, so that characters such as ampersands cannot create new parameters.
  5. Keep layers consistent. If you use a firewall or a proxy, test that it reads parameters in the same way as the application. Ask the vendor how duplicates are handled.
  6. Never trust client-side checks. Prices, roles and permissions must be decided on the server, as explained in the article on mass assignment.
  7. Sign what matters. For important requests, such as callbacks, verify a signature over a clear, single canonical form of the data, as in the guide to webhook signature verification.

For teams that write their own code, add an automated test for each sensitive endpoint that sends a duplicate parameter and expects an error. Tests like this are cheap, they run on every release and they protect against a future change of framework, a new version of a library or a well-meant refactoring that quietly changes how duplicates are handled. For teams that rely on ready-made software, make a note to ask the vendor about duplicates the next time you discuss security, and watch the release notes for fixes that mention request parsing.

How to test your own site

Testing should be done only on your own site or one that you have permission to test, preferably on a staging copy.

If the behaviour surprises you, ask for a rule that rejects duplicate parameters on sensitive pages. That one rule removes most of the risk.

Where parameters carry money, identity or permissions, apply the strictest handling. A product filter that receives two colours is a harmless curiosity, but a payment form that receives two amounts is a serious defect. Rank your endpoints by what they can change, and review the top of the list first. In most small sites that means login, password reset, checkout and any admin action, and a short review of these four areas covers the most important cases.

HPP and SEO: a different problem with a similar name

Duplicate parameters also cause trouble for search engines, although for different reasons. Addresses with several parameters can create many versions of the same page, which leads to duplicate content and wasted crawling. This aspect is covered in the guide to URL parameters and SEO. Cleaning up parameters helps both security and search.

Common mistakes

How Site AI Audit helps

Site AI Audit does not test for parameter pollution. It reviews the public side of a site: the SSL certificate and its expiry date, the redirect from HTTP to HTTPS, security headers and exposed software versions, and also SEO, speed and e-mail authentication. The first check is free, covers up to 50 pages and needs no sign-up. You can run a free check of your website or see the plans for weekly monitoring and alerts.

Related reading

The bottom line

Duplicate parameters are a small detail with a big lesson: when two systems read the same request differently, attackers look for the gap. Parse once, reject what you do not expect, validate the final values on the server and encode what you output.

FAQ

Is HTTP parameter pollution common?

It is not as famous as injection flaws, but it appears in real applications, especially where several layers parse requests, such as a firewall and an app.

Which value does PHP use for duplicates?

PHP’s standard behaviour keeps the last value for a repeated name unless the name ends with square brackets, which creates an array.

Can a firewall stop it?

It can help, but only if it parses parameters the same way as your application. Test this instead of assuming it.

Does it affect WordPress sites?

Core WordPress is written with care, but custom code, plugins and proxies can create the conditions. Keep extra code to a minimum and update what you use.

What is the simplest protection?

Reject requests with duplicate parameters wherever only one value makes sense, and validate the final value on the server.

#Technical SEO#Web vulnerabilities#Website security
Hãy kiểm tra website của chính bạn — miễn phí.Website của bạn cần sửa gì — và nên bắt đầu từ đâu.
Bắt đầu miễn phí
Internet Solutions

Sản phẩm khác từ đội ngũ chúng tôi

Do Internet Solutions phát triển. Hãy thử các sản phẩm khác của chúng tôi — mỗi sản phẩm giúp bạn tiết kiệm thời gian theo một cách riêng.

internet-solutions.net ↗
01Tự động đăng mạng xã hội
PostRSS

Bài mới từ nguồn cấp RSS của bạn được tự động đăng lên Facebook, X, LinkedIn, Telegram và hơn 60 mạng khác.

Gói miễn phí · từ 2014Truy cập →
02Chat trực tuyến AI cho website
Talkmio

Website của bạn trả lời khách truy cập 24/7 từ chính nội dung của bạn, bằng ngôn ngữ của họ.

Gói miễn phí · không cần thẻTruy cập →
03Trợ lý AI
Ask Mio

Trò chuyện, viết code, thiết kế, viết bài và nghiên cứu. Mio chọn mô hình tốt nhất cho từng việc.

Gói miễn phíTruy cập →
04Lái tự động AI cho blog và mạng xã hội
AI Blog Autopilot

AI viết bài SEO dài 2.000–3.000 từ và chia sẻ từng bài lên hơn 60 mạng xã hội.

3 bài đầu tiên miễn phíTruy cập →
05Thu thập SEO chuyên sâu
Site SEO AI Audit

Thu thập SEO toàn diện trên 7 lĩnh vực, gồm cả khả năng hiển thị trong tìm kiếm AI, với cách sửa xếp theo mức tác động.

Lần kiểm tra đầu tiên miễn phíTruy cập →
06Nguồn cấp RSS và sản phẩm
RSS Feed Creator

Tạo RSS từ bất kỳ trang web nào, cùng nguồn cấp sản phẩm cho Google và Meta tự động cập nhật.

Gói miễn phíTruy cập →
07Phát triển website và SEO
Internet Solutions

Website, cửa hàng trực tuyến và hệ thống theo yêu cầu, do đội ngũ của chúng tôi thiết kế, xây dựng và vận hành.

Từ 2011Truy cập →