GHSA-2ffv-r4r9-r8xr: Illuminate/cookie Remote Code Execution Vulnerability

CRITICAL
CWE-94
Published
Advisory Summary

GHSA-2ffv-r4r9-r8xr is a CRITICAL remote code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Illuminate/cookie libraries in the Packagist ecosystem. The issue involves laravel rce vulnerability in "cookie" session driver. Remediation is available by upgrading affected packages to version 6.18.31, 7.22.4.

GHSA-2ffv-r4r9-r8xr at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-2ffv-r4r9-r8xr
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Illuminate/cookie
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix GHSA-2ffv-r4r9-r8xr

To remediate this vulnerability, upgrade all affected Illuminate/cookie dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

illuminate/cookie fixed: 6.18.31
Upgrade illuminate/cookie to 6.18.31
illuminate/cookie fixed: 7.22.4
Upgrade illuminate/cookie to 7.22.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for illuminate/cookie

How to Check if You Are Affected

To determine whether your application is affected by GHSA-2ffv-r4r9-r8xr, inspect your project dependencies for Illuminate/cookie:

inspect dependencies for illuminate/cookie

Analyze the terminal output to locate any version of Illuminate/cookie in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.18.31), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Illuminate/cookie, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Application's using the "cookie" session driver were the primary applications affected by this vulnerability. Since we have not yet released a security release for the Laravel 5.5 version of the framework, we recommend that all applications running Laravel 5.5 and earlier do not use the "cookie" session driver in their production deployments. Regarding the vulnerability, applications using the "cookie" session driver that were also exposing an encryption oracle via their application were vulnerable to remote code execution. An encryption oracle is a mechanism where arbitrary user input is encrypted and the encrypted string is later displayed or exposed to the user. This combination of scenarios lets the user generate valid Laravel signed encryption strings for any plain-text string, thus allowing them to craft Laravel session payloads when an application is using the "cookie" driver. This fix prefixes cookie values with an HMAC hash of the cookie's name before encryption and then verifies a matching hash on decryption, making it impossible to craft a valid cookie payload even if an encryption oracle is exposed via the application.

GHSA-2ffv-r4r9-r8xr Affected Illuminate/cookie Versions

2 component(s)
Fixed Versions:
6.18.317.22.4
Product / Package Ecosystem Affected Versions Fixed Version
illuminate/cookie
Packagist
≥ 4.1.0
< 6.18.31
6.18.31
illuminate/cookie
Packagist
≥ 7.0.0
< 7.22.4
7.22.4

References

Frequently Asked Questions

What is GHSA-2ffv-r4r9-r8xr?
GHSA-2ffv-r4r9-r8xr is a security vulnerability in Illuminate/cookie involving Laravel RCE vulnerability in "cookie" session driver under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Illuminate/cookie versions are affected?
Affected versions include releases prior to 6.18.31, 7.22.4 across affected packages: illuminate/cookie.
What version fixes GHSA-2ffv-r4r9-r8xr?
Upgrading to 6.18.31, 7.22.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is illuminate/cookie affected?
Yes, illuminate/cookie is affected in releases prior to 6.18.31, 7.22.4. Upgrade your dependency to 6.18.31, 7.22.4 or later.
What CWE is associated with GHSA-2ffv-r4r9-r8xr?
GHSA-2ffv-r4r9-r8xr is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check Packagist dependencies for GHSA-2ffv-r4r9-r8xr?
Run the dependency tree command: 'inspect dependencies for illuminate/cookie'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-2ffv-r4r9-r8xr",
  "modified" : "2024-05-15T21:52:29Z",
  "published" : "2024-05-15T21:52:29Z",
  "aliases" : [ ],
  "summary" : "Laravel RCE vulnerability in \"cookie\" session driver",
  "details" : "Application's using the \"cookie\" session driver were the primary applications affected by this vulnerability. Since we have not yet released a security release for the Laravel 5.5 version of the framework, we recommend that all applications running Laravel 5.5 and earlier do not use the \"cookie\" session driver in their production deployments.\n\nRegarding the vulnerability, applications using the \"cookie\" session driver that were also exposing an encryption oracle via their application were vulnerable to remote code execution. An encryption oracle is a mechanism where arbitrary user input is encrypted and the encrypted string is later displayed or exposed to the user. This combination of scenarios lets the user generate valid Laravel signed encryption strings for any plain-text string, thus allowing them to craft Laravel session payloads when an application is using the \"cookie\" driver.\n\nThis fix prefixes cookie values with an HMAC hash of the cookie's name before encryption and then verifies a matching hash on decryption, making it impossible to craft a valid cookie payload even if an encryption oracle is exposed via the application.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "illuminate/cookie"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.1.0"
      }, {
        "fixed" : "6.18.31"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "illuminate/cookie"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.0"
      }, {
        "fixed" : "7.22.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://blog.laravel.com/laravel-cookie-security-releases"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/illuminate/cookie/2020-07-27-1.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/illuminate/cookie"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-05-15T21:52:29Z",
    "nvd_published_at" : null
  }
}