Problem/Motivation

There were some poking around on our site and they were looking for security holes. This is related to #3378487: Validating String Encodings Before Insert but for a specific probe that I think we can solve.

Steps to reproduce

  1. Setup a multi-select exposed taxonomy filter in a View (ajax turned on but I don't think that is needed?)
  2. Pass in a multi-dimensional array through the get arg: https://site.test/news?tags%5B0%5D%5B0%5D=4933


Visual

Proposed resolution

Check if the value is scalar.

Remaining tasks

User interface changes

(New or changed features/functionality in the user interface, modules added or removed, changes to URL paths, changes to user interface text.)

API changes

None

Data model changes

None

CommentFileSizeAuthor
#2 Screenshot 2024-05-16 at 17.07.11.png694.38 KBjoelpittet

Issue fork drupal-3447748

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joelpittet created an issue. See original summary.

joelpittet’s picture

Issue summary: View changes
StatusFileSize
new694.38 KB
joelpittet’s picture

Status: Active » Needs review
Issue tags: +Needs tests

I realize this will need tests.

smustgrave’s picture

Status: Needs review » Needs work

MR appears to have failures

Most cases of tickets like these (illegal offset types) I've seen recommendations to backtrace to the point where it's suppose to be scarlar. To make sure we aren't masking a larger issue. But is possible this could be the correct approach in this case.

joelpittet’s picture

@smustgrave Thanks for taking a look. I believe this is correct in this case but thanks for checking. This case I know the user-input is the source of the problem which is in the issue summary. FYI it looks like this ?tags[0][0] to help read the URL encoding above.

This problem is discrete but part of a bigger set of attack vectors in the parent.

If you could point to a place where I can add a test case, that would really help me out. Otherwise I will take a horrible guess...

joelpittet’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

There's Drupal\Tests\Core\Form\FormValidatorTest we could probably expand on

Also can you rebase? I believe that random failure is fixed on head.

ramil g made their first commit to this issue’s fork.

ramil g’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests

Added the test.

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for adding a test to prove the problem exists and fixing my typo!

alexpott’s picture

Version: 11.x-dev » 10.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed b3ad358039 to 11.x and a0e23a634f to 11.0.x and 48de87ec1b to 10.4.x and f323ffae3d to 10.3.x. Thanks!

This replaces an error with a better message and a user can cause this with a crafted URL so this is a nice improvement. Backported to 10.3.x as a non-disruptive bugfix.

  • alexpott committed f323ffae on 10.3.x
    Issue #3447748 by joelpittet, ramil g, smustgrave: TypeError: Illegal...

  • alexpott committed 48de87ec on 10.4.x
    Issue #3447748 by joelpittet, ramil g, smustgrave: TypeError: Illegal...

  • alexpott committed a0e23a63 on 11.0.x
    Issue #3447748 by joelpittet, ramil g, smustgrave: TypeError: Illegal...

  • alexpott committed b3ad3580 on 11.x
    Issue #3447748 by joelpittet, ramil g, smustgrave: TypeError: Illegal...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.