Skip to content

Incorrect handling of the GET params #40405

@monteshot

Description

@monteshot

Preconditions and environment

Magento versions tested: 2.4.6-p12 and 2.4.8-p1

Issue: When incorrect parameters are sent, Magento 2 responds incorrectly (the exception is masked and not reflected in the response code).

Example URL:
https://443s--demo--248ce--demo.coder.perspectiveteam.com/push-it-messenger-bag.html?product=11508&selected_configurable_option=UhnG&related_product=xvON%2C%28%29%28%22%27%28%2E%2E%2C&item=11508&form_key=FF4VnOPZcMln2xlf&item_id=wgFd&qty=jvos

There is simple product processing with potentially hazardous parameters, for example:
qty=jvos

Image

Under the hood, Magento sets data in PreconfiguredValues using data from buyRequest without validation:

\Magento\Wishlist\Plugin\Helper\Product\View::beforePrepareAndRender

\Magento\Catalog\Block\Product\View::getProductDefaultQty

I believe that setting the value in the Qty field should be performed only if qty is numeric.

Correct processing of this parameter (or possibly another parameter that causes the issue) would lead to proper cache behavior, since 5xx errors are not cached by default.

Steps to reproduce

Open any product and set the incorrect qty params on simple product

Expected result

M2 Returns 200(OK) code which can help prevent DDoS attack to the merchant

Actual result

M2 Returns 500 code which is one of the reasons of DDoS attack to the merchant

Additional information

Chrome dev tools
Image

Potential solution
Image

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Labels

Area: CatalogComponent: CatalogIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Reported on 2.4.8-p1Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

Status

Ready for Development

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions