# CVE-2026-19487: Perl versions from 5.9.4 before 5.41.9 produce incorrect regular expression match results when a stale failure flag ends the Aho-Corasick pr

> Perl regex engine incorrectly matches patterns due to a stale flag, potentially causing security filtering or access control decisions to fail.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 13 Aug 2026
- **Updated:** 13 Aug 2026
- **Also known as:** AZL-95756, BELL-CVE-2026-19487, CLSA-2026-1789043015, CLSA-2026-1789204224, DEBIAN-CVE-2026-19487, ECHO-f6c7-844b-6a34, GHSA-cg68-cm33-8vqv, MINI-gw6q-gcc9-gpwm, MINI-q9f6-w44g-cwv7, OESA-2026-3930, OESA-2026-3931, OESA-2026-3932, OESA-2026-3933, OESA-2026-4013, UBUNTU-CVE-2026-19487

## What is CVE-2026-19487?

CVE-2026-19487 is a medium-severity vulnerability, published on 13 Aug 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Perl versions from 5.9.4 before 5.41.9 produce incorrect regular expression match results when a stale failure flag ends the Aho-Corasick prescan early in S_find_byclass.

The prescan walks the subject for positions where the full pattern could match, and the engine tries it from the leftmost one recorded. A failing transition sets the failed flag, and a later successful transition does not clear it, so the prescan reads the stale flag as a failure and stops before it can record a candidate that starts earlier. It takes a subject where one candidate is recorded and a later character then forces a fallback through a fail link that succeeds.

Example:

  "ABCDE" =~ m/ABCF|BCDE|C/;    # matches C at offset 2, not BCDE
  "ABCDE" =~ m/ABCF|BCDE|C(G)/; # no match, BCDE missed

An alternation like this can miss input it should match, or match it on the wrong branch, so an access or filtering decision made from the result can be wrong.

Weakness: CWE-670 (Always-Incorrect Control Flow Implementation)

## Which versions are affected by CVE-2026-19487?


## How do I fix CVE-2026-19487?

Upgrade to a fixed version.

## Is CVE-2026-19487 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-19487 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-19487 and fix it if it is affected.

What it is: CVE-2026-19487 is a medium-severity vulnerability, published on 13 Aug 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-19487 exists.

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/CVE-2026-19487/ (Markdown: https://insights.sbomify.com/CVE-2026-19487/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-19487
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-19487
- OSV: https://osv.dev/vulnerability/CVE-2026-19487

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-19487/
Summaries are generated and may contain mistakes; the official description above is the record.
