# GHSA-gm98-g2wf-7c68: amphp/artax Cookie leakage to wrong origins and non-restricted cookie acceptance

> An attacker can leak cookies to incorrect origins or set cookies for arbitrary domains, potentially compromising session integrity in applications using the Artax HTTP client.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 15 May 2024

## What is GHSA-gm98-g2wf-7c68?

GHSA-gm98-g2wf-7c68 is a vulnerability in amphp/artax, published on 15 May 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

In artax version before 1.0.6 and 2 before 2.0.6, cookies of `foo.bar.example.com` were leaked to `foo.bar`. Additionally, any site could set cookies for any other site. 
Artax fixed this issue by following newer browser implementations now. Cookies can only be set on domains higher or equal to the current domain, but not on any public suffixes.

## Which versions are affected by GHSA-gm98-g2wf-7c68?

4 open source packages ship an affected version, including amphp/artax.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `amphp/artax` | Packagist | All versions | 1.0.6 |
| `amphp/artax` | Packagist | All versions | 1.0.6 |
| `amphp/artax` | Packagist | From 2 | 2.0.6 |
| `amphp/artax` | Packagist | From 2 | 2.0.6 |

## How do I fix GHSA-gm98-g2wf-7c68?

Upgrade amphp/artax to a fixed version for your release line: 1.0.6 or 2.0.6.

## Is GHSA-gm98-g2wf-7c68 being exploited?

There is no known exploitation of GHSA-gm98-g2wf-7c68 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-gm98-g2wf-7c68 and fix it if it is affected.

What it is: GHSA-gm98-g2wf-7c68 is a vulnerability in amphp/artax, published on 15 May 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-gm98-g2wf-7c68 in the wild and no public exploit code.

Affected packages and fixed versions:
- amphp/artax (Packagist): affected all versions; fixed in 1.0.6
- amphp/artax (Packagist): affected all versions; fixed in 1.0.6
- amphp/artax (Packagist): affected from 2; fixed in 2.0.6
- amphp/artax (Packagist): affected from 2; fixed in 2.0.6

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-gm98-g2wf-7c68/ (Markdown: https://insights.sbomify.com/GHSA-gm98-g2wf-7c68/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-gm98-g2wf-7c68

---
From sbomify Insights: https://insights.sbomify.com/GHSA-gm98-g2wf-7c68/
Summaries are generated and may contain mistakes; the official description above is the record.
