SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\\xFF\\xFE<scr...' for column 'message' at row 1

Created on 19 July 2024, about 2 months ago
Updated 12 August 2024, 27 days ago

Problem/Motivation

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

Steps to reproduce

  1. Setup a select field exposed taxonomy filter in a View
  2. Pass in a incorrect string through the get arg: https://site.test/news?tags%5B0%5D=4978&year=%FF%FE%3Cscript%3Ealert%282...

β†’

Proposed resolution

Encode the values as UTF8

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
Database LoggingΒ  β†’

Last updated 2 days ago

  • Maintained by
  • πŸ‡¦πŸ‡·Argentina @dagmar
Created by

πŸ‡¨πŸ‡¦Canada joelpittet Vancouver

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @joelpittet
  • πŸ‡¨πŸ‡¦Canada joelpittet Vancouver
  • Status changed to Needs review about 2 months ago
  • πŸ‡¨πŸ‡¦Canada joelpittet Vancouver
  • Pipeline finished with Success
    about 2 months ago
    Total: 635s
    #228367
  • πŸ‡¨πŸ‡¦Canada joelpittet Vancouver

    Keep changing the version...

  • πŸ‡¨πŸ‡¦Canada joelpittet Vancouver

    Not sure where the tests should go, my guess would be \Drupal\Tests\dblog\Functional\DbLogTest anybody confirm?

    I am ok writing the test, though if someone wants to take a crack at it I am happy to leave it to someone else.

  • Status changed to Needs work about 2 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Not sure where the tests should go, my guess would be \Drupal\Tests\dblog\Functional\DbLogTest

    That's where I would or Drupal\Tests\dblog\Kernel\DbLogTest if possible to do kernel

  • πŸ‡§πŸ‡ͺBelgium weseze

    We are seeing the same type of issue with specifically crafted URL's causing errors when logging the "location" field for a page not found log.

    These url's contain the "\x85" byte sequence. (displayed as character "…")
    Using this byte sequence in the request url, for a non existing URL, causes a log entry to be written in dblog (the page not found message), and trying to write this to database than causes a fatal error to be thrown.

    This does not cause any direct security risks, just annoying to have all these fatal errors in the log.

    Should we also apply "mb_convert_encoding()" to al $context parameters?

Production build 0.71.5 2024