{"id":"CVE-2026-27838","aliases":["CVE-2026-27838","GHSA-42cr-w2gr-m54q","PYSEC-2026-3418"],"related":[],"kind":"vulnerability","state":"published","title":"wger: IDOR via user-unscoped cache keys on routine API actions exposes workout data","summary":"wger is a free, open-source workout and fitness manager. Five routine detail action endpoints check a cache before calling `self.get_object()`. In versions up to and including 2.4, ache keys are scoped only by `pk` — no user ID is included. When a victim has previously accessed their routine via the API, an attacker can retrieve the cached response for the same PK without any ownership check. Commit e964328784e2ee2830a1991d69fadbce86ac9fbf contains a patch for the issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"wger is a free, open-source workout and fitness manager. Five routine detail action endpoints check a cache before calling `self.get_object()`. In versions up to and including 2.4, ache keys are scoped only by `pk` — no user ID is included. When a victim has previously accessed their routine via the API, an attacker can retrieve the cached response for the same PK without any ownership check. Commit e964328784e2ee2830a1991d69fadbce86ac9fbf contains a patch for the issue.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nFive routine detail action endpoints check a cache before calling `self.get_object()`. Cache keys are scoped only by `pk` — no user ID is included. When a victim has previously accessed their routine via the API, an attacker can retrieve the cached response for the same PK without any ownership check.\n\n### Details\n\n`wger/manager/api/views.py` — five actions follow this pattern (lines 134–201):\n\n```python\n@action(detail=True)\ndef date_sequence_display_mode(self, request, pk=None):\n    cache_key = make_routine_api_date_sequence_display_cache_key(pk)\n    cached = cache.get(cache_key)\n    if cached:\n        return Response(cached)   # returned WITHOUT calling self.get_object()\n    # only reaches ownership check on cache miss\n    routine = self.get_object()\n    ...\n```\n\nCache key construction in `wger/utils/cache.py:89–106`:\n\n```python\ndef make_routine_api_date_sequence_display_cache_key(routine_id):\n    return f\"routine-api-date-sequence-display-{routine_id}\"\n    # No user ID in key\n```\n\nCache TTL: 1 month (`4 * 604800` seconds, `settings_global.py:461`).\n\nAffected endpoints:\n```\nGET /api/v2/routine/{pk}/date-sequence-display/\nGET /api/v2/routine/{pk}/date-sequence-gym/\nGET /api/v2/routine/{pk}/structure/\nGET /api/v2/routine/{pk}/logs/\nGET /api/v2/routine/{pk}/stats/\n```\n\n### PoC\n\n```\n1. Victim (user A) visits GET /api/v2/routine/5/structure/ → response cached under key \"routine-api-structure-5\"\n2. Attacker (user B) visits GET /api/v2/routine/5/structure/ → cache hit → returns user A's routine structure without any ownership check\n```\n\nRequires the victim to have previously accessed the endpoint (cache must be populated). Once populated, the cache entry is valid for 1 month.\n\n### Impact\n\nAn attacker with a registered account can retrieve another user's routine details — workout day sequences, exercise structure, training logs, and statistics — from cache without ownership verification.\n\n**Fix**: Include the user ID in the cache key:\n```python\ndef make_routine_api_date_sequence_display_cache_key(routine_id, user_id):\n    return f\"routine-api-date-sequence-display-{user_id}-{routine_id}\"\n```\n\nOr move `self.get_object()` before the cache lookup so ownership is always verified first.","format":"markdown","source":"ghsa"},{"lang":"es","text":"wger es un gestor de entrenamientos y fitness gratuito y de código abierto. Cinco endpoints de acción de detalle de rutina verifican una caché antes de llamar a `self.get_object()`. En versiones hasta la 2.4 inclusive, las claves de caché se limitan solo por `pk` — no se incluye ningún ID de usuario. Cuando una víctima ha accedido previamente a su rutina a través de la API, un atacante puede recuperar la respuesta en caché para el mismo PK sin ninguna verificación de propiedad. El commit e964328784e2ee2830a1991d69fadbce86ac9fbf contiene un parche para el problema.","source":"nvd"}],"published":"2026-02-26T22:04:57.968Z","modified":"2026-07-13T16:43:12.527Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N","score":3.1,"rating":"LOW"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N","score":3.1,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N","score":3.1,"rating":"LOW"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:N/A:N","score":3.5,"rating":"LOW"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N","score":3.1,"rating":"LOW"}],"cwes":["CWE-639"],"affected":[{"ranges":[{"version":"<= 2.4","status":"affected"}],"vendor":"wger-project","product":"wger","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","lastAffected":"2.1"}],"ecosystem":"PyPI","package":"wger","purl":"pkg:pypi/wger","source":"ghsa"},{"ranges":[{"status":"affected","lastAffected":"2.4"}],"vendor":"wger","product":"wger","cpe":"cpe:2.3:a:wger:wger:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","lastAffected":"2.1"}],"ecosystem":"PyPI","package":"wger","purl":"pkg:pypi/wger","source":"pysec"}],"references":[{"url":"https://github.com/wger-project/wger/security/advisories/GHSA-42cr-w2gr-m54q","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/wger-project/wger/commit/e964328784e2ee2830a1991d69fadbce86ac9fbf","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-27838","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/wger-project/wger","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/wger","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-42cr-w2gr-m54q","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-03-03T01:37:27.777Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-27838","url":"https://www.cve.org/CVERecord?id=CVE-2026-27838","licence":"CVE Terms of Use","modified":"2026-03-03T01:37:38.975Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-42cr-w2gr-m54q","url":"https://github.com/advisories/GHSA-42cr-w2gr-m54q","licence":"CC-BY-4.0","modified":"2026-07-13T16:43:12.527Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-27838","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-27838","licence":"Public domain","modified":"2026-06-17T10:27:46.250Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3418","url":"https://osv.dev/vulnerability/PYSEC-2026-3418","licence":"CC-BY-4.0","modified":"2026-07-13T16:33:32.429Z"}],"updatedAt":"2026-11-25T22:59:14.981Z","epss":{"score":0.00301,"percentile":0.24598,"date":"2026-12-01T12:00:22.000Z"}}