Skip to content

[Address Book Bug] Template filter \Magento\Framework\Filter\Template cannot deal with improper input #39353

Open
@wubinworks

Description

@wubinworks

Preconditions and environment

User input value such as {{var firstname}} is parsed in Address Book.

  • Magento version: 2.4.3 ~ 2.4.7
  • Reproduce: see images below
  • It seems there are no security/performance/info leak issues

Steps to reproduce

01

Magento 2.4.7 + use the system default HTML Address Template
Company: {{if city}}{{var city}}, {{/if}}
Street Address(street1): {{var firstname}}{{var lastname}}{{var country}}


02


03


04

Expected result

The displayed address should be what the customer input.
{{something}} should not be parsed.

Actual result

Customer input got parsed.

Additional information

The cause is this line Template.php#L317.
str_replace is dangerous when you don't know what will be replaced, how many times the original string will be modified.
The best way is to sanitize the user input. The "deferred directives" may not be reliable because you still cannot control the user input value.

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”.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Area: AccountComponent: CustomerIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P3May be fixed according to the position in the backlog.Progress: ready for devReported on 2.4.7Indicates 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

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions