Skip to content

Crypt::Rijndael CBC decrypt rejects Chrome cookie payloads accepted by XS #1923

Closed

Description

@fglock

Summary

The DBI SQLite fetch path corrupts Chrome cookie ciphertext stored as SQLite TEXT, which later causes Crypt::Rijndael CBC decryption to fail its correct block-size check.

Exact root cause

In the fixture, encrypted_value is declared BLOB but some rows have SQLite storage class TEXT and contain arbitrary ciphertext bytes, including NUL and invalid UTF-8. In DBI.fetchrow_arrayref and fetchrow_hashref, ResultSet.getObject() returns a Java String; JDBC has already replaced invalid UTF-8 sequences with U+FFFD. The current default SQLite path then UTF-8 encodes that lossy String into a Perl byte string. The first fixture row is 67 raw bytes (v10 plus a 64-byte CBC payload), but the PerlOnJava DBI fetch returns 117 bytes. After HTTP-Cookies-Chrome removes v10, it passes 114 bytes to CBC decrypt, which correctly rejects the non-block-aligned input.

Use SQLite's raw column bytes when fetching text values, then preserve the configured Unicode behavior only for valid UTF-8. The ECB/CBC block-size check in Crypt::Rijndael is correct and should remain.

Evidence

Activity

  1. added
    bugSomething isn't working
    area:runtimeCore Perl runtime semantics
    area:cpan-portCPAN compatibility ports and providers
    area:backendJVM interpreter or execution-backend behavior
    on Oct 29, 2026
  2. fglock commented on Oct 29, 2026

    @fglock
    OwnerAuthor

    State: complete
    Agent/session: codex-api-20261029-rijndael-cbc
    Scope: #1923, preserve raw SQLite TEXT bytes in DBI array/hash fetches.
    Work: PR #1925 merged to master as 394157f9b12d06b733cf1eb25297d1db056f0716; source commit 7088249fdc66a96f53acd1f08e8205606bd72c09 was based on master b6546aba3c82e53642ca01b25ffdf2658cb32bb5.
    Result: Preserve raw SQLite TEXT bytes before JDBC replaces malformed UTF-8; valid UTF-8 Unicode mode remains supported. Regression coverage and changelog entry merged.
    Evidence: GitHub CI run 40900515733 passed on Ubuntu and Windows. Current-source nice -n 19 make, make check-links, DBI regression, SQLite Unicode, and Storable byte tests passed; focused PerlOnJava tests passed on JVM and interpreter. The regression passes system Perl and failed on the unfixed parent on both backends. HTTP-Cookies-Chrome 4.001 _get_rows, load, and save passed on both backends against the same DBI fix.
    Closure: #1923 closed automatically when PR #1925 merged at 2026-10-29 16:06:55 UTC. No follow-up was needed.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:backendJVM interpreter or execution-backend behaviorarea:cpan-portCPAN compatibility ports and providersarea:runtimeCore Perl runtime semanticsbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions