magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.57k stars 9.32k forks source link

Changes to 2.4.6 url encoding, trigger certain WaF rules #38089

Open toonvd opened 1 year ago

toonvd commented 1 year ago

Preconditions and environment

Steps to reproduce

Check URLs in checkout for example

Expected result

Another character that does not suggest an attempt to abuse temp files should be used.

Actual result

A tilde is used and often ends up at the start or the end of the path

Additional information

No response

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 year ago

Hi @toonvd. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 1 year ago

Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Bravo commented 1 year ago

Hi @toonvd,

Thank you for reporting and collaboration.

Could you please elaborate the steps to reproduce in order to reproduce the issue and also if possible please provide us screenshots it will helps us to proceed further.

Thanks.

toonvd commented 1 year ago

Hi

The commit and explanation should be more than enough. Taking screenshots of a blocked request really doesn't add any value.

Here's an example of a link:

https://toonistesting.nl/customer/account/login/referer/aHR0cHM6Ly93d3cucHNmb29kYW5kbGlmZXN0eWxlLm5sL2N1c3RvbWVyL2FjT291bnQvaW5kZBg~

As you can see, this link ends with a tilde because of the replace function in the referenced commit. Files starting and ending with a tilde are temp files for many editors + almost all Windows applications. Hence it triggers blocks / false positives.

m2-assistant[bot] commented 11 months ago

Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-November commented 11 months ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 11 months ago

Hi @engcom-November. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 11 months ago

Hi @engcom-November, here is your Magento Instance: https://95565bd0b05b1e00f489c50571316078.instances-prod.magento-community.engineering Admin access: https://95565bd0b05b1e00f489c50571316078.instances-prod.magento-community.engineering/admin_3edd Login: d74f0bd7 Password: 9514622e0087

engcom-November commented 11 months ago

Hello @toonvd,

Thank you for the report!

According to RFC 3986 tilde is a unreserved character and can be used in the url. But as the url is getting blocked, could you try to reconfigure the WAF to allow tilde character.

Thank you.

toonvd commented 11 months ago

Hi

This is not about RFC but about common sense. A lot of enterprise WaFs block or alert on tilde by default. (Barracuda, Fortinet, several Modsec rulesets,...). The reason for this is an old IIS vulnerability, Windows using tilde for temp files and other applications like text editors (joe, gedit,...) using tildes for temp files.

Gitlab also fixed this 3 years ago because of this exact reason. https://gitlab.com/gitlab-org/gitlab/-/issues/22648

engcom-November commented 11 months ago

Hello @toonvd,

Thank you for the quick response!

In this case, as you mentioned tilde might cause false postive in some of the WAF's. So this issue can be confirmed.

Thank you.

github-jira-sync-bot commented 11 months ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-10723 is successfully created for this GitHub issue.

m2-assistant[bot] commented 11 months ago

:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.