Media

Bref Doesn't Support Multiple Value Headers in ApiGatewayFormatV2

  • Publicada: 01.02.2024
  • Actualizado: 11.10.2026 10:22

Impacted Resources

bref/src/Event/Http/HttpResponse.php:61-90

Description

When Bref is used in combination with an API Gateway with the v2 format, it does not handle multiple values headers.

Precisely, if PHP generates a response with two headers having the same key but different values only the latest one is kept.

Impact

If an application relies on multiple headers with the same key being set for security reasons, then Bref would lower the application security.

For example, if an application sets multiple Content-Security-Policy headers, then Bref would just reflect the latest one.

PoC

  1. Create a new Bref project.
  2. Create an index.php file with the following content:
php
<?php
header("Content-Security-Policy: script-src 'none'", false);
header("Content-Security-Policy: img-src 'self'", false);
?>
<script>alert(document.domain)</script>
<img src="https://bref.sh/favicon-32x32.png">
  1. Use the following serverless.yml to deploy the Lambda:
yaml
service: app

provider:
    name: aws
    region: eu-central-1

plugins:
    - ./vendor/bref/bref

functions:
    api:
        handler: index.php
        description: ''
        runtime: php-81-fpm
        timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
        events:
            -   httpApi: '*'

# Exclude files from deployment
package:
    patterns:
        - '!node_modules/**'
        - '!tests/**'
  1. Browse the Lambda URL.
  2. Notice that the JavaScript code is executed as the Content-Security-Policy: script-src 'none' header has been removed.
  3. Notice that the external image has not been loaded as the Content-Security-Policy: img-src 'self' header has been kept.
  4. Start a PHP server inside the project directory (e.g. php -S 127.0.0.1:8090).
  5. Browse the index.php script through the PHP server (e.g. http://127.0.0.1:8090/index.php).
  6. Notice that the JavaScript code is not executed as the Content-Security-Policy: script-src 'none' header has been kept.
  7. Notice that the external image has not been loaded as the Content-Security-Policy: img-src 'self' header has been kept.

Suggested Remediation

Concatenate all the multiple value headers' values with a comma (,) as separator and return a single header with all the values to the API Gateway.

References

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
Paquete de Composer bref/bref < 2.1.13 2.1.13

Referencias

Puntuación CVSS 4.8/10
Vector CVSS
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N
Debilidad (CWE)
CWE-436
Plataforma
Composer
Paquete
bref/bref
Publicada
01.02.2024
Actualizado
11.10.2026 10:22

Fuentes y licencias

OSV / GitHub Advisory Database - GHSA-99f9-gv72-fw9r - CC BY 4.0

Historial de vulnerabilidades: bref/bref

Todas las vulnerabilidades publicadas de este paquete (Paquete de Composer), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Entradas en total
4
Primera → última
02.2024 03.2024
Sin corrección
0
Explotada en ataques
0

Distribución por gravedad

  • Media 3
  • Baja 1

Divulgaciones por año

  1. 2024: 4
  2. 2025: 0
  3. 2026: 0
  1. Bref Doesn't Support Multiple Value Headers in ApiGatewayFormatV2 esta entrada
    Media · 4.8 CVE-2024-24753 < 2.1.13 2.1.13
  2. Media · 6.5 CVE-2024-24752 < 2.1.13 2.1.13

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.