GHSL-2021-1009: URL access filters bypass in Alpine - CVE-2022-23553
The URL access filters in Alpine compare the raw request URI using startsWith, so a URI like /allowed/..;/blocked passes the allowlist but is later resolved to /blocked. An attacker could bypass access controls and read protected files such as source code.
Originally disclosed on GitHub Security Lab
1.10.2
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The filters use String.startsWith on the raw, non-canonicalised request URI instead of a normalised path, allowing path traversal sequences to bypass the check.
Impact
This issue may lead to access control bypasses and may enable leaking source code when protecting application code on executable WAR files.
What the attacker needed
Alpine application with URL filters configured; Attacker can send crafted HTTP requests
The fix
The issue was fixed in version 1.10.4.
How it was found
- Clone the Alpine example application.
- Add a secret folder with a secret file under the webapp directory.
- Configure a BlacklistUrlFilter to deny access to /secret.
- Start the example application.
- Request the secret file directly and observe a 403 Forbidden response.
- Request the secret file using a path like /foo/..;/secret/secret.txt and observe the secret content returned.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Alpine has filters that block or allow URLs based on their start. The filter checks the URL exactly as sent, but the server later cleans it up. By adding special path segments like '..;' an attacker can make a blocked URL appear to start with an allowed prefix, then the server resolves it to the blocked resource.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.