---
id: CVE-2026-27205
aliases:
  - GHSA-68rp-wp8r-4726
  - PYSEC-2026-2151
title: 'Flask session does not add `Vary: Cookie` header when accessed in some ways'
summary: 'Flask session does not add `Vary: Cookie` header when accessed in some ways'
severity: low
vendor: flask
product: flask
ecosystem: pip
affected:
  - flask < 3.1.3
patched:
  - flask 3.1.3
published: '2026-02-19'
updated: '2026-09-10'
sourceUpdated: '2026-09-10T03:49:54.354981590Z'
source: OSV
sourceUrl: 'https://osv.dev/vulnerability/GHSA-68rp-wp8r-4726'
references:
  - url: 'https://github.com/pallets/flask/security/advisories/GHSA-68rp-wp8r-4726'
  - url: 'https://nvd.nist.gov/vuln/detail/CVE-2026-27205'
  - url: >-
      https://github.com/pallets/flask/commit/089cb86dd22bff589a4eafb7ab8e42dc357623b4
  - url: 'https://github.com/pallets/flask'
  - url: 'https://github.com/pallets/flask/releases/tag/3.1.3'
tags:
  - osv
  - pip
epss: 0.00357
epssPercentile: 0.29525
ingestedAt: '2026-07-13T18:57:53.732Z'
---

## Overview

When the `session` object is accessed, Flask should set the `Vary: Cookie` header. This instructs caches not to cache the response, as it may contain information specific to a logged in user. This is handled in most cases, but some forms of access such as the Python `in` operator were overlooked.

The severity depends on the application's use of the session, and the cache's behavior regarding cookies. The risk depends on all these conditions being met.

1. The application must be hosted behind a caching proxy that does not ignore responses with cookies.
2. The application does not set a `Cache-Control` header to indicate that a page is private or should not be cached.
3. The application accesses the session in a way that does not access the values, only the keys, and does not mutate the session.

## Affected packages

- `flask < 3.1.3`

## Remediation

Upgrade to a patched release:

- `flask 3.1.3`
