# CVE-2021-43808: Blade `@parent` Exploitation Leading To Possible XSS in Laravel

> Attackers can exploit Blade template placeholders to inject malicious scripts, leading to cross-site scripting attacks against users.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 7 Dec 2021
- **Updated:** 4 Aug 2024
- **Also known as:** CLSA-2026-1767919738, CLSA-2026-1770598645, DEBIAN-CVE-2021-43808, GHSA-66hf-2p6w-jqfw

## What is CVE-2021-43808?

CVE-2021-43808 is a medium-severity cross-site scripting vulnerability in laravel framework, published on 7 Dec 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Laravel is a web application framework. Laravel prior to versions 8.75.0, 7.30.6, and 6.20.42 contain a possible cross-site scripting (XSS) vulnerability in the Blade templating engine. A broken HTML element may be clicked and the user taken to another location in their browser due to XSS. This is due to the user being able to guess the parent placeholder SHA-1 hash by trying common names of sections. If the parent template contains an exploitable HTML structure an XSS vulnerability can be exposed. This vulnerability has been patched in versions 8.75.0, 7.30.6, and 6.20.42 by determining the parent placeholder at runtime and using a random hash that is unique to each request.

Weakness: CWE-327 (Use of a Broken or Risky Cryptographic Algorithm), CWE-79 (Improper Neutralization of Input During Web Page Generation)

## Which versions are affected by CVE-2021-43808?

12 open source packages ship an affected version, including laravel/framework and illuminate/view. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `laravel/framework` | Packagist | All versions | 6.20.42 |
| `laravel/framework` | Packagist | All versions | 6.20.42 |
| `laravel/framework` | Packagist | From 7.0.0 | 7.30.6 |
| `laravel/framework` | Packagist | From 7.0.0 | 7.30.6 |
| `laravel/framework` | Packagist | From 8.0.0 | 8.75.0 |
| `laravel/framework` | Packagist | From 8.0.0 | 8.75.0 |
| `illuminate/view` | Packagist | All versions | 6.20.42 |
| `illuminate/view` | Packagist | All versions | 6.20.42 |
| `illuminate/view` | Packagist | From 7.0.0 | 7.30.6 |
| `illuminate/view` | Packagist | From 7.0.0 | 7.30.6 |
| `illuminate/view` | Packagist | From 8.0.0 | 8.75.0 |
| `illuminate/view` | Packagist | From 8.0.0 | 8.75.0 |

Products: Laravel Framework.

## How do I fix CVE-2021-43808?

Upgrade laravel/framework to a fixed version for your release line: 6.20.42, 7.30.6 or 8.75.0.

## Is CVE-2021-43808 being exploited?

There is no known exploitation of CVE-2021-43808 in the wild and no public exploit code.

## Other vulnerabilities in laravel framework

- [CVE-2021-43617](https://insights.sbomify.com/CVE-2021-43617/): File upload in n/a (critical 9.8)
- [CVE-2020-19316](https://insights.sbomify.com/CVE-2020-19316/): OS Command Injection in Laravel Framework (high 8.8)
- [CVE-2018-6330](https://insights.sbomify.com/CVE-2018-6330/): SQL injection in n/a (high 8.8)
- [CVE-2024-13918](https://insights.sbomify.com/CVE-2024-13918/): Laravel Reflected XSS via Request Parameter in Debug-Mode Error Page (high 8.0)
- [CVE-2024-13919](https://insights.sbomify.com/CVE-2024-13919/): Laravel Reflected XSS via Route Parameter in Debug-Mode Error Page (high 8.0)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-43808 and fix it if it is affected.

What it is: CVE-2021-43808 is a medium-severity cross-site scripting vulnerability in laravel framework, published on 7 Dec 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2021-43808 in the wild and no public exploit code.

Affected packages and fixed versions:
- laravel/framework (Packagist): affected all versions; fixed in 6.20.42
- laravel/framework (Packagist): affected all versions; fixed in 6.20.42
- laravel/framework (Packagist): affected from 7.0.0; fixed in 7.30.6
- laravel/framework (Packagist): affected from 7.0.0; fixed in 7.30.6
- laravel/framework (Packagist): affected from 8.0.0; fixed in 8.75.0
- laravel/framework (Packagist): affected from 8.0.0; fixed in 8.75.0
- illuminate/view (Packagist): affected all versions; fixed in 6.20.42
- illuminate/view (Packagist): affected all versions; fixed in 6.20.42
- illuminate/view (Packagist): affected from 7.0.0; fixed in 7.30.6
- illuminate/view (Packagist): affected from 7.0.0; fixed in 7.30.6
- illuminate/view (Packagist): affected from 8.0.0; fixed in 8.75.0
- illuminate/view (Packagist): affected from 8.0.0; fixed in 8.75.0

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

## Sources

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

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