Sep 9, 2026·6 min read·35 visits
Astro prior to 7.2.4 allowed attackers to bypass path-based authorization middleware via a partial string matching flaw when stripping custom base paths (e.g., /appX/admin resolved to /app/admin but bypassed middleware looking for /app/admin).
An authorization bypass vulnerability exists in the Astro web framework prior to version 7.2.4. When configured with a non-root base path, Astro's routing engine stripped the base path from incoming request URLs using an insecure prefix-match check without verifying path-segment boundaries. This created a path parser differential between user-defined middleware and the internal router. An unauthenticated attacker could bypass route-based authorization checks to access administrative or privileged endpoints by altering the path prefix segment.
Astro is a modern web framework designed for building content-driven websites. To support hosting applications under subpaths, the framework allows developers to define a custom, non-root base path (such as '/app'). When configured, Astro is responsible for routing requests relative to this base while developer-defined middleware manages global application concerns, including route-level authentication and authorization.
A flaw exists in Astro's path-handling subsystem prior to version 7.2.4. When parsing incoming HTTP request pathnames, the routing mechanism incorrectly evaluates and strips the base path using a simple prefix match without verifying path-segment boundaries. This implementation defect introduces a critical parser differential between the framework's internal routing engine and standard authorization middleware.
The vulnerability is classified as CWE-187 (Partial String Comparison). It represents a significant class of routing-related security flaws where inconsistent interpretations of a resource path between different security boundaries permit unauthorized access to protected components without authentication.
The root cause lies in how Astro's routing modules (such as BaseApp.removeBase, FetchState.#computePathname, and match-request.ts) stripped the configured base prefix from incoming request paths. To determine if an incoming request path fell under the configured base, the engine used a basic string comparison. Specifically, it checked if the requested pathname started with the base string via the JavaScript .startsWith() function.
When a base of '/app' was configured, a request for '/appX/admin' (where 'X' represents an arbitrary trailing character) successfully matched the .startsWith('/app') condition. Upon evaluating this condition as true, the router stripped the base path. It achieved this by calculating the length of the base path plus one character (to account for the expected slash delimiter) and slicing the original string from that index forward.
Applying this calculation to the path '/appX/admin' resulted in a slice operations of pathname.slice(5). This operation sliced off the prefix '/appX' and resolved the remaining path internally to '/admin'. Consequently, Astro treated the incoming request as a legitimate attempt to access the internal '/admin' route, completely ignoring the boundary mismatch of the '/appX' segment.
The security impact of this vulnerability manifests because of how request objects are processed by middleware versus how they are matched by the internal router. Security middleware generally acts as an interceptor. It evaluates the raw, unmodified URL of the request as exposed by context.url.pathname to determine whether the client is authorized to access the requested resource.
When an attacker sends a request to '/appX/admin', the middleware inspects context.url.pathname and detects '/appX/admin'. Because this pathname does not match the protected pattern of '/app/admin' or start with '/app/admin/', the middleware permits the request to pass. The middleware acts under the assumption that the path refers to an unprivileged route.
However, once the middleware passes execution to the core framework, the router processes the URL using the flawed prefix-stripping routine. The path '/appX/admin' is stripped down to '/admin', which matches the internal protected page component. The core routing engine then renders the protected page and returns it to the client, successfully bypassing the access control boundary. This interaction is illustrated in the following diagram:
Exploiting this vulnerability requires specific application conditions. First, the application must be configured with a non-root base path, such as /app. Second, the application must implement middleware that enforces access control on routes by performing prefix or equality checks against context.url.pathname. Finally, the application must host protected routes under that same base path.
To initiate the exploit, an attacker crafts an HTTP request where the base path is concatenated with an arbitrary suffix character, immediately followed by the target route segment. For example, if the application base is /app and the target is /app/admin, the attacker sends a request to /app-admin or /appX/admin over the network.
Because the string /appX/admin begins with the prefix /app, Astro's router strips the prefix and resolves the request to the administrative controller. The authorization middleware, examining the full pathname, fails to detect that the request is targeting a restricted route because it does not match the expected pattern. This allows unauthenticated users to perform privileged administrative actions.
To resolve this vulnerability, Astro's engineering team consolidated the path parsing logic into a robust helper function called stripRequestBase inside packages/internal-helpers/src/path.ts. This helper function completely eliminates naive prefix checking by enforcing strict path-segment boundary validation.
export function stripRequestBase(pathname: string, base: string): string {
// 1. Collapse duplicate leading slashes to prevent multi-slash bypasses
pathname = collapseDuplicateLeadingSlashes(pathname);
const baseWithoutTrailingSlash = removeTrailingForwardSlash(base);
// 2. Perform exact match check
if (pathname === baseWithoutTrailingSlash) {
return '/';
}
// 3. Enforce path-segment boundary by appending a slash separator
if (pathname.startsWith(baseWithoutTrailingSlash + '/')) {
return pathname.slice(baseWithoutTrailingSlash.length);
}
// 4. Return unmodified path if segment boundary is not met
return pathname;
}By verifying that the base path is followed immediately by a slash character (baseWithoutTrailingSlash + '/'), the patched code ensures that arbitrary suffixes like /appX do not trigger the slicing logic. Under the new implementation, a request to /appX/admin will fail the boundary check. The framework will return the unmodified path /appX/admin, leading to a safe 404 Not Found response instead of exposing the protected endpoint.
The vulnerability poses a moderate-to-high risk depending on the sensitivity of the protected routes hosted within the Astro application. Because exploiting the vulnerability requires no special privileges or user interaction, an unauthenticated attacker can consistently bypass middleware checks to access confidential data or execute administrative functions if the underlying route handler does not perform secondary authentication.
The primary remediation strategy is upgrading the core Astro dependency to version 7.2.4 or higher. Developers can update their projects using standard package managers. Executing npm install astro@7.2.4 or the equivalent command for your package manager will apply the path parsing fixes across all internal dependencies.
If immediate patching is not possible, developers can implement a temporary mitigation directly in their application's middleware. The middleware must manually validate that any incoming request pathname that starts with the base path also respects the path-segment boundary. Any path matching the prefix but failing the slash boundary check should be rejected immediately with an HTTP 400 Bad Request or 404 Not Found response.
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N| Product | Affected Versions | Fixed Version |
|---|---|---|
astro withastro | < 7.2.4 | 7.2.4 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-187 (Partial String Comparison) |
| Attack Vector | Network (AV:N) |
| CVSS Score | 6.3 (Medium) |
| EPSS Score | 0.00407 (Percentile: 33.98%) |
| Impact | Authorization Bypass |
| Exploit Status | PoC available (Unit test validation) |
| KEV Status | Not Listed in CISA KEV |
The software performs a string comparison associated with a security decision, but it does not compare the entire string or enforce a boundary check, allowing a partial match to succeed.
CVE-2026-126298 (also tracked as GHSA-r53h-rw34-8h97) is an algorithmic complexity Denial of Service (DoS) vulnerability in the Natural Language Toolkit (NLTK) Python library affecting all versions prior to 3.10.4. The vulnerability resides in the nltk.tree.transforms.chomsky_normal_form function and its corresponding public method Tree.chomsky_normal_form(). When transforming a parse tree into Chomsky Normal Form using the default right-factoring strategy, the function repeatedly invokes list.pop(0) inside a loop iterating over all children of a node. In CPython, removing the initial element of a standard list requires an O(N) memory shift operation, causing the overall binarization algorithm to degrade to O(N^2) quadratic time complexity relative to the width of a node. Furthermore, converting horizontal node width into vertical tree depth bypasses initial parsing depth bounds, triggering subsequent stack exhaustion (RecursionError) when recursive methods traverse the mutated structure. Unauthenticated remote attackers who can submit bracketed tree strings to applications invoking this transformation can exhaust single-threaded CPU resources or induce unhandled application exceptions.
An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.
CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.
CVE-2026-126300 (GHSA-ffr9-mgrr-wcvr) is an inefficient algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) Python library affecting versions 3.2.5 prior to 3.10.4. The flaw resides in the quote-restoration routine of TreebankWordTokenizer.span_tokenize and NLTKWordTokenizer.span_tokenize, where repeated calls to list.pop(0) over matched quote tokens introduce quadratic O(n^2) time complexity. An unauthenticated remote attacker who supplies input containing long sequences of double-quote characters can exhaust CPU resources and degrade service availability.
The Natural Language Toolkit (NLTK) versions 3.6 through 3.10.3 contain an algorithmic complexity vulnerability in the LegalitySyllableTokenizer.tokenize method. When processing tokens composed of continuous runs of vowels, an unguarded string reversal and set membership lookup loop executes in quadratic time relative to the input token length. Remote attackers capable of submitting arbitrary text to applications utilizing this tokenizer can trigger sustained single-core CPU exhaustion and application-level denial of service.
CVE-2026-126304 is a symlink path traversal vulnerability (CWE-59) in the Natural Language Toolkit (NLTK) versions 3.10.0 prior to 3.10.4. The YCOECorpusReader class constructs internal sub-readers for the 'psd' and 'pos' subdirectories using FileSystemPathPointer.join(), which relies exclusively on lexical string-prefix validation rather than canonical path resolution. An attacker who supplies a crafted YCOE corpus containing symbolic links in place of the 'psd' or 'pos' subdirectories can bypass directory confinement and read arbitrary files from sibling corpora or sensitive directories within the NLTK data sandbox.